1 // File: StdMeshers_Helper.hxx
2 // Created: 15.02.06 14:48:09
4 // Copyright: Open CASCADE 2006
7 #ifndef StdMeshers_Helper_HeaderFile
8 #define StdMeshers_Helper_HeaderFile
10 #include <SMESH_Mesh.hxx>
11 #include <TopoDS_Shape.hxx>
12 #include <SMDS_MeshNode.hxx>
13 #include <TopoDS_Face.hxx>
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;
23 * \brief It helps meshers to add elements
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()
31 class StdMeshers_Helper
34 // ---------- PUBLIC METHODS ----------
37 StdMeshers_Helper(SMESH_Mesh& theMesh)
38 { myMesh=(void *)&theMesh; myCreateQuadratic = false; }
40 SMESH_Mesh* GetMesh() const
41 { return (SMESH_Mesh*)myMesh; }
44 //Standard_EXPORT StdMeshers_Helper (const StdMeshers_Helper& theOther);
47 //Standard_EXPORT virtual ~StdMeshers_Helper ();
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
56 bool IsQuadraticSubMesh(const TopoDS_Shape& theShape);
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
64 static bool IsMedium(const SMDS_MeshNode* node,
65 const SMDSAbs_ElementType typeToCheck = SMDSAbs_All);
68 * Auxilary function for filling myNLinkNodeMap
70 void AddNLinkNode(const SMDS_MeshNode* n1,
71 const SMDS_MeshNode* n2,
72 const SMDS_MeshNode* n12);
75 * Auxilary function for filling myNLinkNodeMap
77 void AddNLinkNodeMap(const NLinkNodeMap& aMap)
78 { myNLinkNodeMap.insert(aMap.begin(), aMap.end()); }
81 * Returns myNLinkNodeMap
83 const NLinkNodeMap& GetNLinkNodeMap() { return myNLinkNodeMap; }
86 * Auxilary function for GetMediumNode()
88 gp_XY GetNodeUV(const TopoDS_Face& F,
89 const SMDS_MeshNode* n);
92 * Special function for search or creation medium node
94 const SMDS_MeshNode* GetMediumNode(const SMDS_MeshNode* n1,
95 const SMDS_MeshNode* n2,
98 * Special function for creation quadratic triangle
100 SMDS_MeshFace* AddFace(const SMDS_MeshNode* n1,
101 const SMDS_MeshNode* n2,
102 const SMDS_MeshNode* n3);
105 * Special function for creation quadratic quadrangle
107 SMDS_MeshFace* AddFace(const SMDS_MeshNode* n1,
108 const SMDS_MeshNode* n2,
109 const SMDS_MeshNode* n3,
110 const SMDS_MeshNode* n4);
113 * Special function for creation quadratic tetraahedron
115 SMDS_MeshVolume* AddVolume(const SMDS_MeshNode* n1,
116 const SMDS_MeshNode* n2,
117 const SMDS_MeshNode* n3,
118 const SMDS_MeshNode* n4);
121 * Special function for creation quadratic pentahedron
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);
131 * Special function for creation quadratic hexahedron
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);
150 // Key for creation quadratic faces
151 bool myCreateQuadratic;
153 // special map for using during creation quadratic faces
154 NLinkNodeMap myNLinkNodeMap;