Salome HOME
Delete usaged StdMeshers_Helper. Fix bug 11772
[modules/smesh.git] / src / StdMeshers / StdMeshers_Helper.hxx
1 // File:      StdMeshers_Helper.hxx
2 // Created:   15.02.06 14:48:09
3 // Author:    Sergey KUUL
4 // Copyright: Open CASCADE 2006
5
6
7 #ifndef StdMeshers_Helper_HeaderFile
8 #define StdMeshers_Helper_HeaderFile
9
10 #include <SMESH_Mesh.hxx>
11 #include <TopoDS_Shape.hxx>
12 #include <SMDS_MeshNode.hxx>
13 #include <TopoDS_Face.hxx>
14 #include <gp_XY.hxx>
15
16 #include <map>
17
18 typedef pair<const SMDS_MeshNode*, const SMDS_MeshNode*> NLink;
19 typedef map<NLink, const SMDS_MeshNode*> NLinkNodeMap;
20 typedef map<NLink, const SMDS_MeshNode*>::iterator ItNLinkNode;
21
22 /*!
23  * \brief It helps meshers to add elements
24  *
25  * It allow meshers not to care about creation of medium nodes
26  * when filling a quadratic mesh. Helper does it itself.
27  * It defines degree of elements to create when IsQuadraticSubMesh()
28  * is called.
29  */
30
31 class StdMeshers_Helper 
32 {
33  public:
34   // ---------- PUBLIC METHODS ----------
35
36   /// Empty constructor
37   StdMeshers_Helper(SMESH_Mesh& theMesh)
38     { myMesh=(void *)&theMesh; myCreateQuadratic = false; }
39
40   SMESH_Mesh* GetMesh() const
41     { return (SMESH_Mesh*)myMesh; }
42     
43   /// Copy constructor
44   //Standard_EXPORT StdMeshers_Helper (const StdMeshers_Helper& theOther);
45
46   /// Destructor
47   //Standard_EXPORT virtual ~StdMeshers_Helper ();
48
49   /**
50    * Check submesh for given shape
51    * Check if all elements on this shape
52    * are quadratic, if yes => set true to myCreateQuadratic 
53    * (default value is false). Also fill myNLinkNodeMap
54    * Returns myCreateQuadratic
55    */
56   bool IsQuadraticSubMesh(const TopoDS_Shape& theShape);
57
58   /*!
59    * \brief Returns true if given node is medium
60     * \param n - node to check
61     * \param typeToCheck - type of elements containing the node to ask about node status
62     * \retval bool - check result
63    */
64   static bool IsMedium(const SMDS_MeshNode*      node,
65                        const SMDSAbs_ElementType typeToCheck = SMDSAbs_All);
66
67   /**
68    * Auxilary function for filling myNLinkNodeMap
69    */
70   void AddNLinkNode(const SMDS_MeshNode* n1,
71                     const SMDS_MeshNode* n2,
72                     const SMDS_MeshNode* n12);
73
74   /**
75    * Auxilary function for filling myNLinkNodeMap
76    */
77   void AddNLinkNodeMap(const NLinkNodeMap& aMap)
78     { myNLinkNodeMap.insert(aMap.begin(), aMap.end()); }
79
80   /**
81    * Returns myNLinkNodeMap
82    */
83   const NLinkNodeMap& GetNLinkNodeMap() { return myNLinkNodeMap; }
84
85   /**
86    * Auxilary function for GetMediumNode()
87    */
88   gp_XY GetNodeUV(const TopoDS_Face& F,
89                   const SMDS_MeshNode* n);
90
91   /**
92    * Special function for search or creation medium node
93    */
94   const SMDS_MeshNode* GetMediumNode(const SMDS_MeshNode* n1,
95                                      const SMDS_MeshNode* n2,
96                                      const bool force3d);
97   /**
98    * Special function for creation quadratic triangle
99    */
100   SMDS_MeshFace* AddFace(const SMDS_MeshNode* n1,
101                          const SMDS_MeshNode* n2,
102                          const SMDS_MeshNode* n3);
103
104   /**
105    * Special function for creation quadratic quadrangle
106    */
107   SMDS_MeshFace* AddFace(const SMDS_MeshNode* n1,
108                          const SMDS_MeshNode* n2,
109                          const SMDS_MeshNode* n3,
110                          const SMDS_MeshNode* n4);
111
112   /**
113    * Special function for creation quadratic tetraahedron
114    */
115   SMDS_MeshVolume* AddVolume(const SMDS_MeshNode* n1,
116                              const SMDS_MeshNode* n2,
117                              const SMDS_MeshNode* n3,
118                              const SMDS_MeshNode* n4);
119
120   /**
121    * Special function for creation quadratic pentahedron
122    */
123   SMDS_MeshVolume* AddVolume(const SMDS_MeshNode* n1,
124                              const SMDS_MeshNode* n2,
125                              const SMDS_MeshNode* n3,
126                              const SMDS_MeshNode* n4,
127                              const SMDS_MeshNode* n5,
128                              const SMDS_MeshNode* n6);
129
130   /**
131    * Special function for creation quadratic hexahedron
132    */
133   SMDS_MeshVolume* AddVolume(const SMDS_MeshNode* n1,
134                              const SMDS_MeshNode* n2,
135                              const SMDS_MeshNode* n3,
136                              const SMDS_MeshNode* n4,
137                              const SMDS_MeshNode* n5,
138                              const SMDS_MeshNode* n6,
139                              const SMDS_MeshNode* n7,
140                              const SMDS_MeshNode* n8);
141
142
143
144  private:
145
146   void* myMesh;
147
148   int myShapeID;
149
150   // Key for creation quadratic faces
151   bool myCreateQuadratic;
152
153   // special map for using during creation quadratic faces
154   NLinkNodeMap myNLinkNodeMap;
155
156 };
157
158
159 #endif