Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
MxPyramidCellExtract.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 _MxPyramidCellExtract_h
24#define _MxPyramidCellExtract_h
25
26#include <MeshVizXLM/mesh/geometry/MiGeometryI.h>
27#include <MeshVizXLM/extractors/MxHalfPyramidCell.h>
28
29#include <Inventor/STL/vector>
30#include <Inventor/STL/utility>
31
32class MxTabOfMarchingCase;
33class MiVolumeCell;
34
59class MESHVIZXLM_EXTR_API MxPyramidCellExtract
60{
61public:
62
68 static void getIsosurfTopology(unsigned char caseId, std::vector< std::pair<size_t,size_t> >& edgeList );
69
83 static MbVec3d getIsoParametricCoord(const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell, const MbVec3d &point);
84
104 static void getWeight(const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell, const MbVec3d &point, std::vector<double>& weights)
105 {
106 getWeight(getIsoParametricCoord(meshGeometry,pyramidCell,point),weights);
107 }
108
121 static void getWeight(const MbVec3d &ipcoord, std::vector<double>& weights)
122 {
123 double rm, sm, tm;
124
125 rm = 1. - ipcoord[0];
126 sm = 1. - ipcoord[1];
127 tm = 1. - ipcoord[2];
128
129 weights[0] = rm * sm * tm;
130 weights[1] = ipcoord[0] * sm * tm;
131 weights[2] = ipcoord[0] * ipcoord[1] * tm;
132 weights[3] = ipcoord[1] * rm * tm;
133 weights[4] = ipcoord[2];
134 }
135
147 static void getDerivs(const MbVec3d &ipcoord, std::vector<double>& derivs);
148
162 static bool isPointInsideCell(const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell, const MbVec3d &point, std::vector<double>& weights)
163 {
164 size_t n0 = pyramidCell->getNodeIndex(0);
165 size_t n1 = pyramidCell->getNodeIndex(1);
166 size_t n2 = pyramidCell->getNodeIndex(2);
167 size_t n3 = pyramidCell->getNodeIndex(3);
168 size_t n4 = pyramidCell->getNodeIndex(4);
169 s_halfPyramid.setNodeIds(n0,n1,n2,n4);
170 bool inside = s_halfPyramid.isPointInsideCell(meshGeometry,point,weights);
171 if (!inside)
172 {
173 s_halfPyramid.setNodeIds(n0,n2,n3,n4);
174 inside = s_halfPyramid.isPointInsideCell(meshGeometry,point,weights);
175 }
176 if(inside)
177 getWeight(meshGeometry,pyramidCell,point,weights);
178 return inside;
179 }
180
184 static double getVolume(const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell);
185
189 static MbVec3d getFacetNormal(size_t facetId, const MiGeometryI& meshGeometry, const MiVolumeCell* pyramidCell);
190
194 static double getLongestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
195
199 static double getShortestEdgeLength(const MiGeometryI& meshGeometry, const MiVolumeCell* cell);
200
201private:
202
203 static bool initClass();
204 static void exitClass();
205
206 static void initMarchingCase0();
207 static void initMarchingCase1();
208 static void initMarchingCase2();
209 static void initMarchingCase3();
210 static void initMarchingCase4();
211 static void initMarchingCase5();
212
213
214 static bool s_isInit;
215 static MxTabOfMarchingCase* s_tabOfMarchingPyramid;
216 static MxHalfPyramidCell s_halfPyramid;
217};
218
219#endif
220
virtual size_t getNodeIndex(size_t node) const =0
Gets the index (in the mesh) of a node.
<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 pyrami...
static void getIsosurfTopology(unsigned char caseId, std::vector< std::pair< size_t, size_t > > &edgeList)
Returns the isosurface topology of the associated caseId.
static double getShortestEdgeLength(const MiGeometryI &meshGeometry, const MiVolumeCell *cell)
Gets the shortest edge of a pyramid cell.
static double getLongestEdgeLength(const MiGeometryI &meshGeometry, const MiVolumeCell *cell)
Gets the longest edge of a pyramid cell.
static MbVec3d getIsoParametricCoord(const MiGeometryI &meshGeometry, const MiVolumeCell *pyramidCell, const MbVec3d &point)
Computes the iso parametric coordinates of the given point in the given cell with the given geometry.
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 ...
static double getVolume(const MiGeometryI &meshGeometry, const MiVolumeCell *pyramidCell)
Gets the volume of the cell.
static void getWeight(const MiGeometryI &meshGeometry, const MiVolumeCell *pyramidCell, const MbVec3d &point, std::vector< double > &weights)
Gets the weights in the given cell of the given point.
static void getWeight(const MbVec3d &ipcoord, std::vector< double > &weights)
Gets the weights of a point defined by its iso parametric coordinates.
static MbVec3d getFacetNormal(size_t facetId, const MiGeometryI &meshGeometry, const MiVolumeCell *pyramidCell)
Gets the normal of the given facet in a tetrahedron cell.
static bool isPointInsideCell(const MiGeometryI &meshGeometry, const MiVolumeCell *pyramidCell, const MbVec3d &point, std::vector< double > &weights)
Checks if a point is inside or outside a pyramid cell.