Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
PbMesh.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_MESH_
25#define _PB_MESH_
26
27#include <Inventor/SbBox.h>
28#include <Inventor/SbLinear.h>
29#include <Inventor/SbString.h>
30#include <Inventor/STL/set>
31
32#include <MeshViz/nodes/PoMeshProperty.h>
33#include <MeshViz/graph/PbBase.h>
34#include <MeshViz/misc/PbArrayOfInt.h>
35
36class PbCell;
37template <class _T> class PiSetOfDataSet;
38
39
84class PbMesh : public PbBase {
85
86
87 public:
88
100
101
107 PbMesh(SbBool is_data_duplicated=TRUE) ;
108
112 PbMesh(const PbMesh &mesh);
113
118
122 PbMesh& operator=(const PbMesh &mesh) ;
123
127 int getNumNodes() const;
128
132 int getNumCells() const;
133
137 virtual SbVec3f getNodeCoord(int nod_index) const=0;
138
142 SbBox3f getBoundingBox() const;
143
151 SbBool isDataDuplicated() const { return isDataDuplicate; }
152
164 virtual void addValuesSet(int set_index, const float *val, const SbString &set_name = "");
165
187 void addValuesSet(int set_index, const float *val, DataBinding binding, const SbString &set_name = "");
188
195 DataBinding getValuesBinding(int set_index) const;
196
203 virtual void addStringsSet(int set_index, const SbString *val, const SbString &set_name = "");
204
211 virtual void addVecsSet(int set_index, const SbVec3f *val, const SbString &set_name = "");
212
218 virtual const SbString* getValuesSetName(int set_index) const ;
219
225 virtual const SbString* getStringsSetName(int set_index) const ;
226
232 virtual const SbString* getVecsSetName(int set_index) const ;
233
239 virtual const float* getValuesSet(int set_index) const;
240
246 virtual const SbString* getStringsSet(int set_index) const;
247
253 virtual const SbVec3f* getVecsSet(int set_index) const;
254
260 virtual SbBool removeValuesSet(int set_index);
261
267 virtual SbBool removeStringsSet(int set_index);
268
274 virtual SbBool removeVecsSet(int set_index);
275
279 virtual void removeAllValuesSet();
280
284 virtual void removeAllStringsSet();
285
289 virtual void removeAllVecsSet();
290
294 virtual int getNumValuesSet() const;
295
299 virtual int getNumStringsSet() const;
300
304 virtual int getNumVecsSet() const;
305
312 virtual SbBool getMinValuesSet(int set_index, float &min) const;
313
320 virtual SbBool getMinVecsSet(int set_index, float &min) const;
321
328 virtual SbBool getMaxValuesSet(int set_index, float &max) const;
329
336 virtual SbBool getMaxVecsSet(int set_index, float &max) const;
337
341 virtual void getNodeOwnerCellsInd(int nod_index, PbArrayOfInt &owner_cells) const=0;
342
349 virtual void getNodesOwnerCellsInd(const PbArrayOfInt &nod_indices, PbArrayOfInt &owner_cells) const;
350
355 virtual void getAdjacentCellsIndByNode(int cell_index, PbArrayOfInt &adjacent_cells) const;
356
361 virtual void getAdjacentCellsIndByFacet(int cell_index, PbArrayOfInt &adjacent_cells) const;
362
368 virtual const PbCell *getCell(int cell_index) const=0;
369
375 virtual SbBox3f getSmallestCellBox(int &cell_index) const;
376
382 virtual SbBox3f getBiggestCellBox(int &cell_index) const;
383
387 virtual float getVolume() const=0;
388
392 virtual float getArea() const=0;
393
398 virtual const PbCell* findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord, const PbCell *adjacent_cell) const;
399
414 virtual const PbCell* findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord) const;
415
421 virtual void setCoordinates(const float *x_nod, const float *y_nod, const float *z_nod);
422
434 virtual void getCoordinates(const float* &xnod, const float* &ynod, const float* &znod,
435 int &size_xnod, int &size_ynod, int &size_znod) const;
436
437 /*----------------------------------------------------------------------------*/
438 private:
439 // internal use it only for Amira. PER_CELL binding for vec set is never taken into account in
440 // MeshViz representation
441 void addVecsSet(int set_index, const SbVec3f *val, DataBinding binding, const SbString &set_name = "");
442 DataBinding getVecsBinding(int set_index) const;
443
444 // Gets the length of the longest edge of the mesh
445 virtual float getLongestEdgeLength();
446 virtual void print(FILE *fp) const;
447 void printInfo() const {print(stdout);};
448 virtual SbBool isEmpty() const;
449
450 virtual const PbCell *getTopoCell(int cell_index) const;
451
452 uint32_t getGeometryId() const { return m_geometryId; }
453 uint32_t getTopologyId() const { return m_topologyId; }
454 uint32_t getFltDataSetId(int index) const;
455 uint32_t getVecDataSetId(int index) const;
456 uint32_t getStrDataSetId(int index) const;
457
458 /*----------------------------------------------------------------------------*/
459 private:
460 virtual void updateBoundingBox()const=0;
461 virtual void updateCellBoundingBox() const;
462 virtual const PbCell* findContainingCellProtected(const SbVec3f &point, float tolerance, SbVec3f &pcoord, PbArrayOfInt &test_cell) const=0;
463
464 void updateGeometryId();
465 void updateTopologyId();
466 void updateFltDataId(uint32_t &id);
467 void updateVecDataId(uint32_t &id);
468 void updateStrDataId(uint32_t &id);
469
470 SbBool isDataDuplicate;
471 int numMeshNodes;
472 int m_numMeshCells;
473
474
475 SbBool m_longestEdgeLengthIsUpdated;
476 float m_longestEdgeLength;
477
478 mutable SbBox3f m_meshBoundingBox;
479
480 PiSetOfDataSet<float> *m_meshValuesSet;
481 PiSetOfDataSet<SbString> *m_meshStringsSet;
482 PiSetOfDataSet<SbVec3f> *m_meshVecsSet;
483
484 mutable SbBool m_meshBoundingBoxIsUpdated;
485 mutable SbBool m_cellBoundingBoxIsUpdated;
486 mutable SbBox3f m_smallestCellBoundingBox;
487 mutable SbBox3f m_biggestCellBoundingBox;
488 mutable int m_smallestCellInd;
489 mutable int m_biggestCellInd;
490
491 /*----------------------------------------------------------------------------*/
492 private:
493 // State of the mesh
494 uint32_t m_geometryId; // defines the state of this mesh geometry
495 uint32_t m_topologyId; // defines the state of this mesh topology
496
497 // static state id level
498 static uint32_t sm_nextGeometryId;
499 static uint32_t sm_nextTopologyId;
500 static uint32_t sm_nextFltDataId;
501 static uint32_t sm_nextVecDataId;
502 static uint32_t sm_nextStrDataId;
503
504 mutable PbArrayOfInt m_CellsAlreadyTested;
505
506 void copy(const PbMesh &mesh) ;
507 void destroy();
508};
509
510/*---------------------------------------------------------------------------*/
511
512inline int
514{ return numMeshNodes; }
515
516inline int
518{ return m_numMeshCells; }
519
520inline SbBox3f
522{
523 updateBoundingBox();
524 return m_meshBoundingBox;
525}
526
527inline void
528PbMesh::setCoordinates(const float *, const float *, const float *)
529{}
530
531inline void
532PbMesh::getCoordinates(const float* &, const float* &, const float* &, int &, int &, int &) const
533{}
534
535inline const PbCell *
536PbMesh::getTopoCell(int) const
537{ return NULL; }
538
539
540#endif /* _PB_MESH_ */
541
542
543
544
545
546
547
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
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines an abstract mesh...
Definition PbMesh.h:84
virtual const SbVec3f * getVecsSet(int set_index) const
Gets a set of vector values.
virtual SbBox3f getSmallestCellBox(int &cell_index) const
Gets the smallest cell's bounding box, returns also the index of this cell.
virtual SbBool removeStringsSet(int set_index)
Remove a set of string values.
virtual void getAdjacentCellsIndByNode(int cell_index, PbArrayOfInt &adjacent_cells) const
Gets the list of indices of cells that are adjacent (by a node) to cell_index.
void addValuesSet(int set_index, const float *val, DataBinding binding, const SbString &set_name="")
Adds a set of scalar values that can be located either at nodes or at cells.
virtual const SbString * getValuesSetName(int set_index) const
Gets the name associated to a scalar values set.
virtual SbBool getMinValuesSet(int set_index, float &min) const
Gets the min of a set of scalars.
virtual const SbString * getStringsSet(int set_index) const
Gets a set of string values.
int getNumNodes() const
Gets the number of nodes in the mesh.
Definition PbMesh.h:513
virtual float getArea() const =0
Gets the area of the mesh.
DataBinding
Data binding.
Definition PbMesh.h:94
@ PER_CELL
The data set contains one data value per cell.
Definition PbMesh.h:96
@ PER_NODE
The data set contains one data value per node.
Definition PbMesh.h:98
virtual void addVecsSet(int set_index, const SbVec3f *val, const SbString &set_name="")
Adds a set of vector values .
int getNumCells() const
Gets the number of cells in the mesh.
Definition PbMesh.h:517
virtual SbBool getMaxValuesSet(int set_index, float &max) const
Gets the max of a set of scalars.
virtual SbBool getMaxVecsSet(int set_index, float &max) const
Gets the max module of a set of vectors.
virtual const PbCell * findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord, const PbCell *adjacent_cell) const
PbMesh(SbBool is_data_duplicated=TRUE)
Constructor.
virtual int getNumValuesSet() const
Gets the number of set of scalar values.
SbBool isDataDuplicated() const
Returns TRUE if mesh's data are duplicated, FALSE otherwise.
Definition PbMesh.h:151
virtual const PbCell * getCell(int cell_index) const =0
Gets the cell with index cell_index.
virtual const PbCell * findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord) const
Find the cell that contains the point.
virtual void removeAllValuesSet()
Remove all sets of scalar values.
virtual void getAdjacentCellsIndByFacet(int cell_index, PbArrayOfInt &adjacent_cells) const
Gets the list of indices of cells that are adjacent (by a facet) to cell_index.
PbMesh(const PbMesh &mesh)
Copy constructor.
virtual void getCoordinates(const float *&xnod, const float *&ynod, const float *&znod, int &size_xnod, int &size_ynod, int &size_znod) const
Get the current coordinates of the nodes of this mesh.
Definition PbMesh.h:532
~PbMesh()
Destructor.
DataBinding getValuesBinding(int set_index) const
Gets the binding of the scalar value set.
PbMesh & operator=(const PbMesh &mesh)
Assignment operator.
virtual SbBox3f getBiggestCellBox(int &cell_index) const
Gets the biggest cell's bounding box, returns also the index of this cell.
SbBox3f getBoundingBox() const
Gets the bounding box of the mesh.
Definition PbMesh.h:521
virtual const SbString * getVecsSetName(int set_index) const
Gets the name associated to a vec values set.
virtual SbVec3f getNodeCoord(int nod_index) const =0
Gets the coordinates of a node.
virtual void addValuesSet(int set_index, const float *val, const SbString &set_name="")
Adds a set of scalar values.
virtual int getNumStringsSet() const
Gets the number of set of string values.
virtual void removeAllVecsSet()
Remove all sets of vector values.
virtual void removeAllStringsSet()
Remove all sets of strings values.
virtual const float * getValuesSet(int set_index) const
Gets a set of scalar values.
virtual void setCoordinates(const float *x_nod, const float *y_nod, const float *z_nod)
Set new node coordinates without modifying the mesh topology.
Definition PbMesh.h:528
virtual void getNodeOwnerCellsInd(int nod_index, PbArrayOfInt &owner_cells) const =0
Gets the list of indices of cells that own the node "nod_index".
virtual SbBool removeVecsSet(int set_index)
Remove a set of vector values.
virtual void addStringsSet(int set_index, const SbString *val, const SbString &set_name="")
Adds a set of string values .
virtual float getVolume() const =0
Gets the volume of the mesh.
virtual int getNumVecsSet() const
Gets the number of set of vector values.
virtual const SbString * getStringsSetName(int set_index) const
Gets the name associated to a string values set.
virtual void getNodesOwnerCellsInd(const PbArrayOfInt &nod_indices, PbArrayOfInt &owner_cells) const
Gets the list of indices of cells that own the list of nodes "nod_indices".
virtual SbBool removeValuesSet(int set_index)
Remove a set of scalar values.
virtual SbBool getMinVecsSet(int set_index, float &min) const
Gets the min module of a set of vectors.
@ PER_NODE
The data set contains one data value per node.
@ PER_CELL
The data set contains one data value per cell.
3D box class.
Definition SbBox.h:649
Class for smart character strings.
Definition SbString.h:202
3D vector class.
Definition SbVec.h:932
int SbBool
Boolean type.
Definition SbBase.h:87