Version: 8.3.0
SMESH_MeshEditor.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 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, or (at your option) any later version.
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 // File : SMESH_MeshEditor.hxx
24 // Created : Mon Apr 12 14:56:19 2004
25 // Author : Edward AGAPOV (eap)
26 // Module : SMESH
27 //
28 #ifndef SMESH_MeshEditor_HeaderFile
29 #define SMESH_MeshEditor_HeaderFile
30 
31 #include "SMESH_SMESH.hxx"
32 
33 #include "SMESH_Controls.hxx"
34 #include "SMESH_TypeDefs.hxx"
35 #include "SMESH_ComputeError.hxx"
36 
37 #include <utilities.h>
38 
39 #include <TColStd_HSequenceOfReal.hxx>
40 #include <gp_Dir.hxx>
41 
42 #include <list>
43 #include <map>
44 #include <set>
45 
46 class SMDS_MeshElement;
47 class SMDS_MeshFace;
48 class SMDS_MeshNode;
49 class SMESHDS_Mesh;
50 class SMESHDS_SubMesh;
51 class SMESH_Group;
52 class SMESH_Mesh;
53 class SMESH_MesherHelper;
54 class SMESH_NodeSearcher;
55 class SMESH_subMesh;
56 class TopoDS_Edge;
57 class TopoDS_Shape;
58 class TopoDS_Vertex;
59 class gp_Ax1;
60 class gp_Pnt;
61 class gp_Vec;
62 
63 // ============================================================
67 // ============================================================
68 
70 {
71 public:
72 
73  SMESH_MeshEditor( SMESH_Mesh* theMesh );
74 
75  SMESH_Mesh * GetMesh() { return myMesh; }
76  SMESHDS_Mesh * GetMeshDS();
77 
78  const SMESH_SequenceOfElemPtr& GetLastCreatedNodes() const { return myLastCreatedNodes; }
79  const SMESH_SequenceOfElemPtr& GetLastCreatedElems() const { return myLastCreatedElems; }
80  void ClearLastCreated();
81  SMESH_ComputeErrorPtr & GetError() { return myError; }
82 
83  // --------------------------------------------------------------------------------
84  struct ElemFeatures
85  {
87  bool myIsPoly, myIsQuad;
88  int myID;
90  std::vector<int> myPolyhedQuantities;
91  std::vector<const SMDS_MeshNode*> myNodes; // not managed by ElemFeatures
92 
93  SMESH_EXPORT ElemFeatures( SMDSAbs_ElementType type=SMDSAbs_All, bool isPoly=false, bool isQuad=false )
94  :myType( type ), myIsPoly(isPoly), myIsQuad(isQuad), myID(-1), myBallDiameter(0) {}
95 
96  SMESH_EXPORT ElemFeatures& Init( SMDSAbs_ElementType type, bool isPoly=false, bool isQuad=false )
97  { myType = type; myIsPoly = isPoly; myIsQuad = isQuad; return *this; }
98 
99  SMESH_EXPORT ElemFeatures& Init( const SMDS_MeshElement* elem, bool basicOnly=true );
100 
101  SMESH_EXPORT ElemFeatures& Init( double diameter )
102  { myType = SMDSAbs_Ball; myBallDiameter = diameter; return *this; }
103 
104  SMESH_EXPORT ElemFeatures& Init( std::vector<int>& quanities, bool isQuad=false )
105  { myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad;
106  myPolyhedQuantities.swap( quanities ); return *this; }
107 
108  SMESH_EXPORT ElemFeatures& Init( const std::vector<int>& quanities, bool isQuad=false )
109  { myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad;
110  myPolyhedQuantities = quanities; return *this; }
111 
112  SMESH_EXPORT ElemFeatures& SetPoly(bool isPoly) { myIsPoly = isPoly; return *this; }
113  SMESH_EXPORT ElemFeatures& SetQuad(bool isQuad) { myIsQuad = isQuad; return *this; }
114  SMESH_EXPORT ElemFeatures& SetID (int ID) { myID = ID; return *this; }
115  };
116 
120  SMDS_MeshElement* AddElement(const std::vector<const SMDS_MeshNode*> & nodes,
121  const ElemFeatures& features);
125  SMDS_MeshElement* AddElement(const std::vector<int> & nodeIDs,
126  const ElemFeatures& features);
127 
128  int Remove (const std::list< int >& theElemIDs, const bool isNodes);
129  // Remove a node or an element.
130  // Modify a compute state of sub-meshes which become empty
131 
132  void Create0DElementsOnAllNodes( const TIDSortedElemSet& elements,
133  TIDSortedElemSet& all0DElems,
134  const bool duplicateElements);
135  // Create 0D elements on all nodes of the given. \a all0DElems returns
136  // all 0D elements found or created on nodes of \a elements
137 
138  bool InverseDiag (const SMDS_MeshElement * theTria1,
139  const SMDS_MeshElement * theTria2 );
140  // Replace two neighbour triangles with ones built on the same 4 nodes
141  // but having other common link.
142  // Return False if args are improper
143 
144  bool InverseDiag (const SMDS_MeshNode * theNode1,
145  const SMDS_MeshNode * theNode2 );
146  // Replace two neighbour triangles sharing theNode1-theNode2 link
147  // with ones built on the same 4 nodes but having other common link.
148  // Return false if proper faces not found
149 
150  bool DeleteDiag (const SMDS_MeshNode * theNode1,
151  const SMDS_MeshNode * theNode2 );
152  // Replace two neighbour triangles sharing theNode1-theNode2 link
153  // with a quadrangle built on the same 4 nodes.
154  // Return false if proper faces not found
155 
156  bool Reorient (const SMDS_MeshElement * theElement);
157  // Reverse theElement orientation
158 
159  int Reorient2D (TIDSortedElemSet & theFaces,
160  const gp_Dir& theDirection,
161  const SMDS_MeshElement * theFace);
162  // Reverse theFaces whose orientation to be same as that of theFace
163  // oriented according to theDirection. Return nb of reoriented faces
164 
165  int Reorient2DBy3D (TIDSortedElemSet & theFaces,
166  TIDSortedElemSet & theVolumes,
167  const bool theOutsideNormal);
168  // Reorient faces basing on orientation of adjacent volumes.
169  // Return nb of reoriented faces
170 
179  bool TriToQuad (TIDSortedElemSet & theElems,
181  const double theMaxAngle);
188  bool QuadToTri (TIDSortedElemSet & theElems,
196  bool QuadToTri (TIDSortedElemSet & theElems,
197  const bool the13Diag);
202  void QuadTo4Tri (TIDSortedElemSet & theElems);
203 
210  int BestSplit (const SMDS_MeshElement* theQuad,
212 
213 
214  typedef std::map < const SMDS_MeshElement*, int, TIDCompare > TFacetOfElem;
215 
217  enum SplitVolumToTetraFlags { HEXA_TO_5 = 1, // split into tetrahedra
220  HEXA_TO_2_PRISMS, // split into prisms
221  HEXA_TO_4_PRISMS };
228  void SplitVolumes (const TFacetOfElem & theElems, const int theMethodFlags);
229 
237  void GetHexaFacetsToSplit( TIDSortedElemSet& theHexas,
238  const gp_Ax1& theFacetNormal,
239  TFacetOfElem & theFacets);
240 
250  void SplitBiQuadraticIntoLinear(TIDSortedElemSet& theElems);
251 
252  enum SmoothMethod { LAPLACIAN = 0, CENTROIDAL };
253 
254  void Smooth (TIDSortedElemSet & theElements,
255  std::set<const SMDS_MeshNode*> & theFixedNodes,
256  const SmoothMethod theSmoothMethod,
257  const int theNbIterations,
258  double theTgtAspectRatio = 1.0,
259  const bool the2D = true);
260  // Smooth theElements using theSmoothMethod during theNbIterations
261  // or until a worst element has aspect ratio <= theTgtAspectRatio.
262  // Aspect Ratio varies in range [1.0, inf].
263  // If theElements is empty, the whole mesh is smoothed.
264  // theFixedNodes contains additionally fixed nodes. Nodes built
265  // on edges and boundary nodes are always fixed.
266  // If the2D, smoothing is performed using UV parameters of nodes
267  // on geometrical faces
268 
270  typedef std::map < const SMDS_MeshElement*,
271  std::list<const SMDS_MeshElement*>, TElemSort > TTElemOfElemListMap;
272  typedef std::map<const SMDS_MeshNode*, std::list<const SMDS_MeshNode*> > TNodeOfNodeListMap;
273  typedef TNodeOfNodeListMap::iterator TNodeOfNodeListMapItr;
274  typedef std::vector<TNodeOfNodeListMapItr> TVecOfNnlmiMap;
275  typedef std::map<const SMDS_MeshElement*, TVecOfNnlmiMap, TElemSort > TElemOfVecOfNnlmiMap;
276  typedef std::auto_ptr< std::list<int> > PGroupIDs;
277 
278  PGroupIDs RotationSweep (TIDSortedElemSet theElements[2],
279  const gp_Ax1& theAxis,
280  const double theAngle,
281  const int theNbSteps,
282  const double theToler,
283  const bool theMakeGroups,
284  const bool theMakeWalls=true);
285  // Generate new elements by rotation of theElements around theAxis
286  // by theAngle by theNbSteps
287 
302  EXTRUSION_FLAG_GROUPS = 0x04,
303  EXTRUSION_FLAG_BY_AVG_NORMAL = 0x08,
304  EXTRUSION_FLAG_USE_INPUT_ELEMS_ONLY = 0x10,
305  EXTRUSION_FLAG_SCALE_LINEAR_VARIATION = 0x20
306  };
307 
312  {
313  gp_Dir myDir; // direction of extrusion
314  Handle(TColStd_HSequenceOfReal) mySteps; // magnitudes for each step
315  std::vector<double> myScales, myMediumScales;// scale factors
316  gp_XYZ myBaseP; // scaling center
317  SMESH_SequenceOfNode myNodes; // nodes for using in sewing
318  int myFlags; // see ExtrusionFlags
319  double myTolerance; // tolerance for sewing nodes
320  const TIDSortedElemSet* myElemsToUse; // elements to use for extrusion by normal
321 
322  int (ExtrusParam::*myMakeNodesFun)(SMESHDS_Mesh* mesh,
323  const SMDS_MeshNode* srcNode,
324  std::list<const SMDS_MeshNode*> & newNodes,
325  const bool makeMediumNodes);
326 
327  public:
328  ExtrusParam( const gp_Vec& theStep,
329  const int theNbSteps,
330  const std::list<double>& theScales,
331  const gp_XYZ* theBaseP,
332  const int theFlags = 0,
333  const double theTolerance = 1e-6);
334  ExtrusParam( const gp_Dir& theDir,
335  Handle(TColStd_HSequenceOfReal) theSteps,
336  const int theFlags = 0,
337  const double theTolerance = 1e-6);
338  ExtrusParam( const double theStep,
339  const int theNbSteps,
340  const int theFlags,
341  const int theDim); // for extrusion by normal
342 
343  SMESH_SequenceOfNode& ChangeNodes() { return myNodes; }
344  int& Flags() { return myFlags; }
345  bool ToMakeBoundary() const { return myFlags & EXTRUSION_FLAG_BOUNDARY; }
346  bool ToMakeGroups() const { return myFlags & EXTRUSION_FLAG_GROUPS; }
347  bool ToUseInpElemsOnly() const { return myFlags & EXTRUSION_FLAG_USE_INPUT_ELEMS_ONLY; }
348  bool IsLinearVariation() const { return myFlags & EXTRUSION_FLAG_SCALE_LINEAR_VARIATION; }
349  int NbSteps() const { return mySteps->Length(); }
350 
351  // stores elements to use for extrusion by normal, depending on
352  // state of EXTRUSION_FLAG_USE_INPUT_ELEMS_ONLY flag;
353  // define myBaseP for scaling
354  void SetElementsToUse( const TIDSortedElemSet& elems, const TIDSortedElemSet& nodes );
355 
356  // creates nodes and returns number of nodes added in \a newNodes
357  int MakeNodes( SMESHDS_Mesh* mesh,
358  const SMDS_MeshNode* srcNode,
359  std::list<const SMDS_MeshNode*> & newNodes,
360  const bool makeMediumNodes)
361  {
362  return (this->*myMakeNodesFun)( mesh, srcNode, newNodes, makeMediumNodes );
363  }
364  private:
365 
366  int makeNodesByDir( SMESHDS_Mesh* mesh,
367  const SMDS_MeshNode* srcNode,
368  std::list<const SMDS_MeshNode*> & newNodes,
369  const bool makeMediumNodes);
370  int makeNodesByDirAndSew( SMESHDS_Mesh* mesh,
371  const SMDS_MeshNode* srcNode,
372  std::list<const SMDS_MeshNode*> & newNodes,
373  const bool makeMediumNodes);
374  int makeNodesByNormal2D( SMESHDS_Mesh* mesh,
375  const SMDS_MeshNode* srcNode,
376  std::list<const SMDS_MeshNode*> & newNodes,
377  const bool makeMediumNodes);
378  int makeNodesByNormal1D( SMESHDS_Mesh* mesh,
379  const SMDS_MeshNode* srcNode,
380  std::list<const SMDS_MeshNode*> & newNodes,
381  const bool makeMediumNodes);
382  // step iteration
383  void beginStepIter( bool withMediumNodes );
384  bool moreSteps();
385  double nextStep();
386  std::vector< double > myCurSteps;
389  };
390 
403  PGroupIDs ExtrusionSweep (TIDSortedElemSet theElems[2],
404  const gp_Vec& theStep,
405  const int theNbSteps,
406  TTElemOfElemListMap& newElemsMap,
407  const int theFlags,
408  const double theTolerance = 1.e-6);
409 
420  PGroupIDs ExtrusionSweep (TIDSortedElemSet theElems[2],
421  ExtrusParam& theParams,
422  TTElemOfElemListMap& newElemsMap);
423 
424 
425  // Generate new elements by extrusion of theElements
426  // by theStep by theNbSteps
427 
435  EXTR_CANT_GET_TANGENT
436  };
437 
438  Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
439  SMESH_subMesh* theTrackPattern,
440  const SMDS_MeshNode* theNodeStart,
441  const bool theHasAngles,
442  std::list<double>& theAngles,
443  const bool theLinearVariation,
444  const bool theHasRefPoint,
445  const gp_Pnt& theRefPoint,
446  const bool theMakeGroups);
447  Extrusion_Error ExtrusionAlongTrack (TIDSortedElemSet theElements[2],
448  SMESH_Mesh* theTrackPattern,
449  const SMDS_MeshNode* theNodeStart,
450  const bool theHasAngles,
451  std::list<double>& theAngles,
452  const bool theLinearVariation,
453  const bool theHasRefPoint,
454  const gp_Pnt& theRefPoint,
455  const bool theMakeGroups);
456  // Generate new elements by extrusion of theElements along path given by theTrackPattern,
457  // theHasAngles are the rotation angles, base point can be given by theRefPoint
458 
459  PGroupIDs Transform (TIDSortedElemSet & theElements,
460  const gp_Trsf& theTrsf,
461  const bool theCopy,
462  const bool theMakeGroups,
463  SMESH_Mesh* theTargetMesh=0);
464  // Move or copy theElements applying theTrsf to their nodes
465 
466  typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
467 
468  void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
469  const double theTolerance,
470  TListOfListOfNodes & theGroupsOfNodes,
471  bool theSeparateCornersAndMedium);
472  // Return list of group of nodes close to each other within theTolerance.
473  // Search among theNodes or in the whole mesh if theNodes is empty.
474 
475  void MergeNodes (TListOfListOfNodes & theNodeGroups,
476  const bool theAvoidMakingHoles = false);
477  // In each group, the cdr of nodes are substituted by the first one
478  // in all elements.
479 
480  typedef std::list< std::list< int > > TListOfListOfElementsID;
481 
482  void FindEqualElements(TIDSortedElemSet & theElements,
483  TListOfListOfElementsID & theGroupsOfElementsID);
484  // Return list of group of elements build on the same nodes.
485  // Search among theElements or in the whole mesh if theElements is empty.
486 
487  void MergeElements(TListOfListOfElementsID & theGroupsOfElementsID);
488  // In each group remove all but first of elements.
489 
490  void MergeEqualElements();
491  // Remove all but one of elements built on the same nodes.
492  // Return nb of successfully merged groups.
493 
494  int SimplifyFace (const std::vector<const SMDS_MeshNode *>& faceNodes,
495  std::vector<const SMDS_MeshNode *>& poly_nodes,
496  std::vector<int>& quantities) const;
497  // Split face, defined by <faceNodes>, into several faces by repeating nodes.
498  // Is used by MergeNodes()
499 
500  static bool CheckFreeBorderNodes(const SMDS_MeshNode* theNode1,
501  const SMDS_MeshNode* theNode2,
502  const SMDS_MeshNode* theNode3 = 0);
503  // Return true if the three nodes are on a free border
504 
505  static bool FindFreeBorder (const SMDS_MeshNode* theFirstNode,
506  const SMDS_MeshNode* theSecondNode,
507  const SMDS_MeshNode* theLastNode,
508  std::list< const SMDS_MeshNode* > & theNodes,
509  std::list< const SMDS_MeshElement* >& theFaces);
510  // Return nodes and faces of a free border if found
511 
512  enum Sew_Error {
514  // for SewFreeBorder()
520  // for SewSideElements()
525  SEW_INTERNAL_ERROR
526  };
527 
528 
529  Sew_Error SewFreeBorder (const SMDS_MeshNode* theBorderFirstNode,
530  const SMDS_MeshNode* theBorderSecondNode,
531  const SMDS_MeshNode* theBorderLastNode,
532  const SMDS_MeshNode* theSide2FirstNode,
533  const SMDS_MeshNode* theSide2SecondNode,
534  const SMDS_MeshNode* theSide2ThirdNode = 0,
535  const bool theSide2IsFreeBorder = true,
536  const bool toCreatePolygons = false,
537  const bool toCreatePolyedrs = false);
538  // Sew the free border to the side2 by replacing nodes in
539  // elements on the free border with nodes of the elements
540  // of the side 2. If nb of links in the free border and
541  // between theSide2FirstNode and theSide2LastNode are different,
542  // additional nodes are inserted on a link provided that no
543  // volume elements share the splitted link.
544  // The side 2 is a free border if theSide2IsFreeBorder == true.
545  // Sewing is performed between the given first, second and last
546  // nodes on the sides.
547  // theBorderFirstNode is merged with theSide2FirstNode.
548  // if (!theSide2IsFreeBorder) then theSide2SecondNode gives
549  // the last node on the side 2, which will be merged with
550  // theBorderLastNode.
551  // if (theSide2IsFreeBorder) then theSide2SecondNode will
552  // be merged with theBorderSecondNode.
553  // if (theSide2IsFreeBorder && theSide2ThirdNode == 0) then
554  // the 2 free borders are sewn link by link and no additional
555  // nodes are inserted.
556  // Return false, if sewing failed.
557 
558  Sew_Error SewSideElements (TIDSortedElemSet& theSide1,
559  TIDSortedElemSet& theSide2,
560  const SMDS_MeshNode* theFirstNode1ToMerge,
561  const SMDS_MeshNode* theFirstNode2ToMerge,
562  const SMDS_MeshNode* theSecondNode1ToMerge,
563  const SMDS_MeshNode* theSecondNode2ToMerge);
564  // Sew two sides of a mesh. Nodes belonging to theSide1 are
565  // merged with nodes of elements of theSide2.
566  // Number of elements in theSide1 and in theSide2 must be
567  // equal and they should have similar node connectivity.
568  // The nodes to merge should belong to side s borders and
569  // the first node should be linked to the second.
570 
571  void InsertNodesIntoLink(const SMDS_MeshElement* theFace,
572  const SMDS_MeshNode* theBetweenNode1,
573  const SMDS_MeshNode* theBetweenNode2,
574  std::list<const SMDS_MeshNode*>& theNodesToInsert,
575  const bool toCreatePoly = false);
576  // insert theNodesToInsert into theFace between theBetweenNode1 and theBetweenNode2.
577  // If toCreatePoly is true, replace theFace by polygon, else split theFace.
578 
579  void UpdateVolumes (const SMDS_MeshNode* theBetweenNode1,
580  const SMDS_MeshNode* theBetweenNode2,
581  std::list<const SMDS_MeshNode*>& theNodesToInsert);
582  // insert theNodesToInsert into all volumes, containing link
583  // theBetweenNode1 - theBetweenNode2, between theBetweenNode1 and theBetweenNode2.
584 
585  void ConvertToQuadratic(const bool theForce3d, const bool theToBiQuad);
586  void ConvertToQuadratic(const bool theForce3d,
587  TIDSortedElemSet& theElements, const bool theToBiQuad);
588  // Converts all mesh to quadratic or bi-quadratic one, deletes old elements,
589  // replacing them with quadratic or bi-quadratic ones with the same id.
590  // If theForce3d = 1; this results in the medium node lying at the
591  // middle of the line segments connecting start and end node of a mesh element.
592  // If theForce3d = 0; this results in the medium node lying at the
593  // geometrical edge from which the mesh element is built.
594 
595  bool ConvertFromQuadratic();
596  void ConvertFromQuadratic(TIDSortedElemSet& theElements);
597  // Converts all mesh from quadratic to ordinary ones, deletes old quadratic elements, replacing
598  // them with ordinary mesh elements with the same id.
599  // Returns true in case of success, false otherwise.
600 
601  static void AddToSameGroups (const SMDS_MeshElement* elemToAdd,
602  const SMDS_MeshElement* elemInGroups,
603  SMESHDS_Mesh * aMesh);
604  // Add elemToAdd to the all groups the elemInGroups belongs to
605 
606  static void RemoveElemFromGroups (const SMDS_MeshElement* element,
607  SMESHDS_Mesh * aMesh);
608  // remove element from the all groups
609 
610  static void ReplaceElemInGroups (const SMDS_MeshElement* elemToRm,
611  const SMDS_MeshElement* elemToAdd,
612  SMESHDS_Mesh * aMesh);
613  // replace elemToRm by elemToAdd in the all groups
614 
615  static void ReplaceElemInGroups (const SMDS_MeshElement* elemToRm,
616  const std::vector<const SMDS_MeshElement*>& elemToAdd,
617  SMESHDS_Mesh * aMesh);
618  // replace elemToRm by elemToAdd in the all groups
619 
623  static void GetLinkedNodes( const SMDS_MeshNode* node,
624  TIDSortedElemSet & linkedNodes,
626 
638  static Sew_Error FindMatchingNodes(std::set<const SMDS_MeshElement*>& theSide1,
639  std::set<const SMDS_MeshElement*>& theSide2,
640  const SMDS_MeshNode* theFirstNode1,
641  const SMDS_MeshNode* theFirstNode2,
642  const SMDS_MeshNode* theSecondNode1,
643  const SMDS_MeshNode* theSecondNode2,
644  TNodeNodeMap & theNodeReplaceMap);
645 
652  static bool IsMedium(const SMDS_MeshNode* node,
653  const SMDSAbs_ElementType typeToCheck = SMDSAbs_All);
654 
655  int FindShape (const SMDS_MeshElement * theElem);
656  // Return an index of the shape theElem is on
657  // or zero if a shape not found
658 
659  void DoubleElements( const TIDSortedElemSet& theElements );
660 
661  bool DoubleNodes( const std::list< int >& theListOfNodes,
662  const std::list< int >& theListOfModifiedElems );
663 
664  bool DoubleNodes( const TIDSortedElemSet& theElems,
665  const TIDSortedElemSet& theNodesNot,
666  const TIDSortedElemSet& theAffectedElems );
667 
668  bool AffectedElemGroupsInRegion( const TIDSortedElemSet& theElems,
669  const TIDSortedElemSet& theNodesNot,
670  const TopoDS_Shape& theShape,
671  TIDSortedElemSet& theAffectedElems);
672 
673  bool DoubleNodesInRegion( const TIDSortedElemSet& theElems,
674  const TIDSortedElemSet& theNodesNot,
675  const TopoDS_Shape& theShape );
676 
677  double OrientedAngle(const gp_Pnt& p0, const gp_Pnt& p1, const gp_Pnt& g1, const gp_Pnt& g2);
678 
679  bool DoubleNodesOnGroupBoundaries( const std::vector<TIDSortedElemSet>& theElems,
680  bool createJointElems,
681  bool onAllBoundaries);
682 
683  bool CreateFlatElementsOnFacesGroups( const std::vector<TIDSortedElemSet>& theElems );
684 
685  void CreateHoleSkin(double radius,
686  const TopoDS_Shape& theShape,
688  const char* groupName,
689  std::vector<double>& nodesCoords,
690  std::vector<std::vector<int> >& listOfListOfNodes);
691 
697  bool Make2DMeshFrom3D();
698 
700 
701  int MakeBoundaryMesh(const TIDSortedElemSet& elements,
702  Bnd_Dimension dimension,
703  SMESH_Group* group = 0,
704  SMESH_Mesh* targetMesh = 0,
705  bool toCopyElements = false,
706  bool toCopyExistingBondary = false,
707  bool toAddExistingBondary = false,
708  bool aroundElements = false);
709 
710  private:
711 
716  int convertElemToQuadratic(SMESHDS_SubMesh * theSm,
717  SMESH_MesherHelper& theHelper,
718  const bool theForce3d);
719 
724  int removeQuadElem( SMESHDS_SubMesh * theSm,
725  SMDS_ElemIteratorPtr theItr,
726  const int theShapeID);
735  PGroupIDs generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
736  const SMESH_SequenceOfElemPtr& elemGens,
737  const std::string& postfix,
738  SMESH_Mesh* targetMesh=0,
739  const bool topPresent=true);
748  void sweepElement(const SMDS_MeshElement* elem,
749  const std::vector<TNodeOfNodeListMapItr> & newNodesItVec,
750  std::list<const SMDS_MeshElement*>& newElems,
751  const size_t nbSteps,
752  SMESH_SequenceOfElemPtr& srcElements);
753 
764  bool applyMerge( const SMDS_MeshElement* elems,
765  std::vector< ElemFeatures >& newElemDefs,
766  TNodeNodeMap& nodeNodeMap,
767  const bool avoidMakingHoles );
777  void makeWalls (TNodeOfNodeListMap & mapNewNodes,
778  TTElemOfElemListMap & newElemsMap,
779  TElemOfVecOfNnlmiMap & elemNewNodesMap,
780  TIDSortedElemSet& elemSet,
781  const int nbSteps,
782  SMESH_SequenceOfElemPtr& srcElements);
783 
785  {
786  gp_Pnt myPnt;
787  gp_Dir myTgt;
788  double myAngle, myPrm;
789 
790  SMESH_MeshEditor_PathPoint(): myPnt(99., 99., 99.), myTgt(1.,0.,0.), myAngle(0), myPrm(0) {}
791  void SetPnt (const gp_Pnt& aP3D) { myPnt =aP3D; }
792  void SetTangent (const gp_Dir& aTgt) { myTgt =aTgt; }
793  void SetAngle (const double& aBeta) { myAngle=aBeta; }
794  void SetParameter(const double& aPrm) { myPrm =aPrm; }
795  const gp_Pnt& Pnt ()const { return myPnt; }
796  const gp_Dir& Tangent ()const { return myTgt; }
797  double Angle ()const { return myAngle; }
798  double Parameter ()const { return myPrm; }
799  };
800  Extrusion_Error makeEdgePathPoints(std::list<double>& aPrms,
801  const TopoDS_Edge& aTrackEdge,
802  bool aFirstIsStart,
803  std::list<SMESH_MeshEditor_PathPoint>& aLPP);
804  Extrusion_Error makeExtrElements(TIDSortedElemSet theElements[2],
805  std::list<SMESH_MeshEditor_PathPoint>& theFullList,
806  const bool theHasAngles,
807  std::list<double>& theAngles,
808  const bool theLinearVariation,
809  const bool theHasRefPoint,
810  const gp_Pnt& theRefPoint,
811  const bool theMakeGroups);
812  static void linearAngleVariation(const int NbSteps,
813  std::list<double>& theAngles);
814 
815  bool doubleNodes( SMESHDS_Mesh* theMeshDS,
816  const TIDSortedElemSet& theElems,
817  const TIDSortedElemSet& theNodesNot,
818  TNodeNodeMap& theNodeNodeMap,
819  const bool theIsDoubleElem );
820 
821  void copyPosition( const SMDS_MeshNode* from,
822  const SMDS_MeshNode* to );
823 
824 private:
825 
827 
828  // Nodes and elements created during last operation
829  SMESH_SequenceOfElemPtr myLastCreatedNodes, myLastCreatedElems;
830 
831  // Description of error/warning occurred during last operation
833 };
834 
835 #endif