Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
MiCell.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-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#ifndef _MiCell_H
24#define _MiCell_H
25
26#include <MeshVizXLM/mesh/geometry/MiGeometryI.h>
27#include <MeshVizXLM/MxMeshVizXLM.h>
28#include <MeshVizXLM/MiAbstractMethodError.h>
29
30#include <MeshVizXLM/MbVec3.h>
31#include <Inventor/STL/vector>
32#include <Inventor/STL/ostream>
33
73class MESHVIZXLM_EXTR_API MiCell
74{
75public:
76
80 virtual ~MiCell() {}
81
87 virtual size_t getNumNodes() const = 0;
88
93 virtual size_t getNodeIndex(size_t node) const = 0;
94
117 virtual double getRelativeSize(const MiGeometryI* SO_UNUSED_PARAM(meshGeometry)) const
118 {
119 return 1;
120 }
121
153 virtual void getWeight(const MbVec3d& SO_UNUSED_PARAM(ipcoord), std::vector<double>& SO_UNUSED_PARAM(weight)) const
154 {
155 throw MiAbstractMethodError("MiCell::getWeight(const MbVec3d &, std::vector<double>&)");
156 }
157
184 virtual MbVec3d getIsoParametricCoord(size_t SO_UNUSED_PARAM(nodeIndex)) const
185 {
186 throw MiAbstractMethodError("MiCell::getIsoParametricCoord(size_t nodeIndex)");
187 }
188
199 virtual MbVec3d getCenter(const MiGeometryI& geometry) const;
200
201
225 virtual bool isPointInsideCell(const MiGeometryI& SO_UNUSED_PARAM(meshGeometry),
226 const MbVec3d& SO_UNUSED_PARAM(point),
227 std::vector<double>& SO_UNUSED_PARAM(weights)) const
228 {
229 throw MiAbstractMethodError("MiCell::isPointInsideCell(const MbVec3d &point)");
230 }
231
235 friend std::ostream& operator<< (std::ostream& s, const MiCell& cell);
236
237private: protected:
241 virtual std::ostream& toStream(std::ostream& s) const;
242
243};
244
245//-----------------------------------------------------------------------------
246inline MbVec3d
247MiCell::getCenter(const MiGeometryI& geometry) const
248{
249 MbVec3d center(0);
250 for (size_t i=0; i<getNumNodes(); ++i)
251 center += geometry.getCoord(getNodeIndex(i));
252 return ( center / (double) getNumNodes() );
253}
254
255//-----------------------------------------------------------------------------
256inline std::ostream&
257MiCell::toStream(std::ostream& s) const
258{
259 s << "# num cell's nodes" << std::endl;
260 s << getNumNodes() << std::endl;
261 s << "[";
262 for (size_t i=0; i<getNumNodes(); ++i)
263 s << getNodeIndex(i) << " ";
264 s << "]";
265
266 return s;
267}
268
269//-----------------------------------------------------------------------------
270inline std::ostream&
271operator << (std::ostream& s, const MiCell& cell)
272{
273 return cell.toStream(s);
274}
275
276
277#endif
278
279
280
281
282
283
284
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Exception handler for Me...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines an abstract cell...
Definition MiCell.h:74
virtual MbVec3d getIsoParametricCoord(size_t nodeIndex) const
Gets the iso parametric coordinates of a cell's node.
Definition MiCell.h:184
virtual size_t getNodeIndex(size_t node) const =0
Gets the index (in the mesh) of a node.
virtual void getWeight(const MbVec3d &ipcoord, std::vector< double > &weight) const
Gets the weights of a point defined by its iso parametric coordinates.
Definition MiCell.h:153
virtual ~MiCell()
Virtual destructor.
Definition MiCell.h:80
virtual size_t getNumNodes() const =0
Gets the number of nodes.
virtual double getRelativeSize(const MiGeometryI *meshGeometry) const
Gets the relative size of the cell.
Definition MiCell.h:117
virtual bool isPointInsideCell(const MiGeometryI &meshGeometry, const MbVec3d &point, std::vector< double > &weights) const
Checks if a point is inside or outside a cell.
Definition MiCell.h:225
virtual MbVec3d getCenter(const MiGeometryI &geometry) const
Gets the center of the cell.
Definition MiCell.h:247
virtual std::ostream & toStream(std::ostream &s) const
Performs an output operation on a stream which is returned afterward.
Definition MiCell.h:257
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Generic geometry interfa...
Definition MiGeometryI.h:39