Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
MxHexahedron27CellExtract.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2017 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#ifndef _MxHexahedron27CellExtract_h
24#define _MxHexahedron27CellExtract_h
25
26#include <MeshVizXLM/mesh/geometry/MiGeometryI.h>
27
28#include <Inventor/STL/vector>
29#include <Inventor/STL/utility>
30
31class MiVolumeCell;
32
62class MESHVIZXLM_EXTR_API MxHexahedron27CellExtract
63{
64public:
65
79 static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell, const MbVec3d &point);
80
86 static MbVec3d getIsoParametricCoord(size_t nodeIndex);
87
107 static void getWeight(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell, const MbVec3d &point, std::vector<double>& weights)
108 {
109 MbVec3d ipcoord = getIsoParametricCoord(meshGeometry,hexahedronCell,point);
110 getWeight(ipcoord,weights);
111 }
112
125 static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights);
126
138 static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
139
153 static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiVolumeCell* hexahedronCell, const MbVec3d &point, std::vector<double>& weights)
154 {
155 MbVec3d pcoord = getIsoParametricCoord(meshGeometry,hexahedronCell,point);
156 bool inside = ( -1.E-5 < pcoord[0] && pcoord[0] < 1 + 1.E-5 &&
157 -1.E-5 < pcoord[1] && pcoord[1] < 1 + 1.E-5 &&
158 -1.E-5 < pcoord[2] && pcoord[2] < 1 + 1.E-5 );
159 if (inside)
160 getWeight(pcoord,weights);
161 return inside;
162 }
163
171 static size_t getNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes)
172 {
173 facetNodes.assign(s_facetNode[facet],s_facetNode[facet]+4);
174 return 4;
175 }
176
185 static size_t getSubTriangleNodesIndex(size_t face, std::vector<size_t>& triangleNodeIds)
186 {
187 triangleNodeIds.assign(s_subFacetNode[face],s_subFacetNode[face]+24);
188 return 8;
189 }
190
199 static size_t getSubTetrahedronNodesIndex (std::vector<size_t>& tetrahedronNodeIds)
200 {
201 tetrahedronNodeIds.assign(s_subTetrahedronNodeIds,s_subTetrahedronNodeIds+(48*4));
202 return 48;
203 }
204
205
206private:
213 static void get27Derivs(double r, double s, double t, size_t numNodes, std::vector<double>& derivs);
214
215 friend std::ostream& operator << (std::ostream& s, const MxHexahedron27CellExtract& cell);
216private:
217
218 static bool initClass();
219 static void exitClass();
220
221 static void computeSubTetrahedronNodesIndex();
222 static void addSubWedge(size_t n0,size_t n1,size_t n2, size_t n3,size_t n4,size_t n5, size_t orient, std::vector<size_t>& wedgeNodeIds);
223 template <typename _F>
224 static void addSymetricWedgesByPlane(_F& symetricByPlane, std::vector<size_t>& wedgeNodeIds);
225 static void decomposeWedge(size_t orient, size_t n0,size_t n1,size_t n2, size_t n3,size_t n4,size_t n5, std::vector<size_t>& tetraNodeIds);
226
227 static void computeSubTriangleNodesIndex();
228 template <typename _F>
229 static void addSymetricTrianglesByPlane(_F& symetricByPlane, std::vector<size_t>& triangleNodeIds);
230 static void addTriangle(size_t n0, size_t n1, size_t n2, std::vector<size_t>& triangleNodeIds);
231 static bool s_isInit;
232 static double s_nodesIsoParametricCoords[27][3];
233 static size_t s_subFacetNode[6][24]; // each face is split into 8 triangles
234
235 static size_t s_subTetrahedronNodeIds[48*4]; // an hexa27 is split into 48 tetras
236 static size_t s_facetNode[6][4];
237
238 static int s_imat0[36];
239 static int s_imat1[24];
240 static int s_imat2[24];
241 static int s_imat3[18];
242 static int s_iperm[24];
243};
244
245#endif
246
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Generic geometry interfa...
Definition MiGeometryI.h:39
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines an abstract cell...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Utility class for quadra...
static MbVec3d getIsoParametricCoord(size_t nodeIndex)
Returns the iso parametric coordinates of one of the 27 nodes of a quadratic hexahedron.
static size_t getSubTriangleNodesIndex(size_t face, std::vector< size_t > &triangleNodeIds)
Gets a triangulation of the given facet of a quadratic hexahedron of 27 nodes.
static size_t getSubTetrahedronNodesIndex(std::vector< size_t > &tetrahedronNodeIds)
Gets a decomposition in sub-tetrahedra of a quadratic hexahedron of 27 nodes.
static size_t getNodesIndexOfFacet(size_t facet, std::vector< size_t > &facetNodes)
Gets the array of "linear" node indices belonging to a given facet.
static bool isPointInsideCell(const MiGeometryI &meshGeometry, const MiVolumeCell *hexahedronCell, const MbVec3d &point, std::vector< double > &weights)
Checks if a point is inside or outside a quadratic hexahedron cell of 27 nodes.
static MbVec3d getIsoParametricCoord(const MiGeometryI &meshGeometry, const MiVolumeCell *hexahedronCell, const MbVec3d &point)
Computes the iso parametric coordinates of the given point in the given cell with the given geometry.
static void getWeight(const MbVec3d &ipcoord, std::vector< double > &weights)
Gets the weights of a point defined by its iso parametric coordinates.
static void getWeight(const MiGeometryI &meshGeometry, const MiVolumeCell *hexahedronCell, const MbVec3d &point, std::vector< double > &weights)
Gets the weights in the given cell of the given point.
static void getDerivs(const MbVec3d &ipcoord, std::vector< double > &derivs)
Gets the value of the derivatives of the shape functions (aka weights) at the point given by its iso ...