Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
PbCell.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-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _PB_CELL_
25#define _PB_CELL_
26
27#include <Inventor/SbBox.h>
28#include <Inventor/SbLinear.h>
29#include <MeshViz/graph/PbBase.h>
30#include <MeshViz/misc/PbArrayOfInt.h>
31#include <Inventor/STL/vector>
32
33typedef std::vector<bool> SbBoolVector;
34
35class PbArrayOfFloat;
36class PoMesh3D;
37class PiMarchingCase;
38
49class PbCell : public PbBase {
50
51
52 public:
53
58
62 PbCell(const PbCell &cell);
63
68
72 PbCell& operator=(const PbCell &cell) ;
73
77 virtual float getLongestEdgeLength() const = 0;
78
82 virtual SbBox3f getBoundingBox() const;
83
88 virtual void getBounds(float &xmin,float &ymin, float &zmin,
89 float &xmax,float &ymax, float &zmax) const;
90
94 virtual SbVec3f getCenter() const;
95
99 virtual float getVolume() const = 0;
100
104 virtual float getArea() const = 0;
105
109 int getNumFacets() const { return m_numFaces;};
110
114 int getNumEdges() const { return m_numEdges;};
115
119 int getNumNodes() const { return m_numNodes;};
120
124 int getIndex() const { return m_index;};
125
126
127
131 SbVec3f getNodeCoord(int nod) const { return m_nodeCoord[nod]; };
132
136 int getNodeIndex(int nod) const { return m_nodeIndices[nod]; };
137
141 void getNodesIndex(PbArrayOfInt &nodes_index) const;
142
147 virtual void getNodesIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const=0;
148
153 virtual void getNodesIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const=0;
154
160 virtual void getNodesLocalIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const=0;
161
167 virtual void getNodesLocalIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const=0;
168
174 virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const = 0;
175
180 virtual void getWeight(const SbVec3f &pcoord, float *weight) const = 0;
181
189 virtual float getValue(const SbVec3f &pcoord, const float *s) const;
190
198 virtual SbVec3f getValue(const SbVec3f &pcoord, const SbVec3f *v) const;
199
204 float getValue(const float *weight, const float *s) const;
205
210 SbVec3f getValue(const float *weight, const SbVec3f *v) const;
211
212 /*----------------------------------------------------------------------------*/
213 private:
214 virtual void print(FILE *fp) const;
215 // Prints a formatted version of the cell to the given file pointer
216
227 virtual int getOrdering() const { return 1;}
228
236 virtual void getEdgesCrossingPlane(SbPlane &plane,
237 PbArrayOfInt &nodes_crossing,
238 PbArrayOfInt &edges_crossing,
239 PbArrayOfFloat *edges_ratio) const;
240
241 virtual const int* getNodesLocalIndexOfEdge(int edge) const = 0;
242
243 virtual PiMarchingCase* getMCcase(unsigned char mc_case) const;
244 /*----------------------------------------------------------------------------*/
245
246 int addLevelSurfPart(PoMesh3D *mesh, SbBoolVector &nodes_sign, SbBool use_strip_set) const;
247
248 // Defines the topology of a cell, no coord are specified
249 // That allow to speed up the PbCellIterator for which no coord are necessary
250 void setTopology(int index, int *node_indices) {
251 m_nodeIndices = node_indices;
252 m_index = index;
253 }
254
255
256 const int *getNodeIndexPtr() const { return m_nodeIndices; }
257
258 private:
259 virtual unsigned char getIsosurfCaseId(SbBoolVector &nodes_sign) const = 0;
260 int m_numFaces;
261 int m_numEdges;
262 int m_numNodes;
263 int m_index;
264 int *m_nodeIndices;
265 SbVec3f m_nodeCoord[8];
266
267 mutable SbBox3f m_bbox;
268
269 private:
270 void copy(const PbCell &cell) ;
271 void destroy();
272};
273
274
275inline PiMarchingCase*
276PbCell::getMCcase(unsigned char) const
277{
278 return NULL;
279}
280
281/*---------------------------------------------------------------------------*/
282
283#endif /* _PB_CELL_ */
284
285
286
287
288
289
290
DTEXT Dynamic array of int .
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for all b...
Definition PbBase.h:49
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines an abstract cell...
Definition PbCell.h:49
int getNumEdges() const
Gets the number of edges.
Definition PbCell.h:114
virtual float getValue(const SbVec3f &pcoord, const float *s) const
Get the scalar value of a point in the cell.
PbCell & operator=(const PbCell &cell)
Assignment operator.
float getValue(const float *weight, const float *s) const
Gets the scalar value of a point in this cell, given the point's weights.
PbCell()
Constructor.
int getIndex() const
Gets the index of the cell in the mesh.
Definition PbCell.h:124
void getNodesIndex(PbArrayOfInt &nodes_index) const
Gets the array of index mesh's nodes that belongs to this cell.
~PbCell()
Destructor.
virtual void getNodesIndexOfEdge(int edge, PbArrayOfInt &nodes_index) const =0
Gets the array of 2 index mesh's nodes that belongs to a given edge of this cell.
virtual float getVolume() const =0
Gets the volume of the cell.
int getNumFacets() const
Gets the number of facets.
Definition PbCell.h:109
virtual float getLongestEdgeLength() const =0
Gets the length of the longest edge of the cell.
virtual void getNodesLocalIndexOfEdge(int edge, PbArrayOfInt &nodes_index) const =0
Gets the array of 2 nodes index that belongs to a given edge of this cell.
virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const =0
Returns 1 if the point is inside the cell, 0 otherwise.
virtual void getNodesIndexOfFacet(int facet, PbArrayOfInt &nodes_index) const =0
Gets the array of index mesh's nodes that belongs to a given facet of this cell.
virtual void getNodesLocalIndexOfFacet(int facet, PbArrayOfInt &nodes_index) const =0
Gets the array of node index that belongs to a given facet of this cell.
PbCell(const PbCell &cell)
Copy constructor.
virtual SbBox3f getBoundingBox() const
Gets the cell's bounding box.
virtual void getWeight(const SbVec3f &pcoord, float *weight) const =0
Gets the weights of a point defined by its parametric coordinates.
SbVec3f getNodeCoord(int nod) const
Gets the coordinate of the nod (nod must be >=0 and < getNumNodes()).
Definition PbCell.h:131
int getNumNodes() const
Gets the number of nodes.
Definition PbCell.h:119
SbVec3f getValue(const float *weight, const SbVec3f *v) const
Gets the vector value of a point in this cell, given the point's weights.
virtual void getBounds(float &xmin, float &ymin, float &zmin, float &xmax, float &ymax, float &zmax) const
Gets the cell's bounds.
virtual float getArea() const =0
Gets the area of a cell.
int getNodeIndex(int nod) const
Gets the index (in the mesh) of a nod (nod must be >=0 and < getNumNodes()).
Definition PbCell.h:136
virtual SbVec3f getValue(const SbVec3f &pcoord, const SbVec3f *v) const
Get the vector value of a point in the cell.
virtual SbVec3f getCenter() const
Gets the cell's geometric center.
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Base class for all volum...
Definition PoMesh3D.h:53
3D box class.
Definition SbBox.h:649
Oriented plane in 3D.
Definition SbPlane.h:64
3D vector class.
Definition SbVec.h:932
int SbBool
Boolean type.
Definition SbBase.h:87