00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 #ifndef _MiPointProbeVolumeUnstructuredIjk_h 00024 #define _MiPointProbeVolumeUnstructuredIjk_h 00025 00026 #include <MeshVizXLM/extractors/MiPointProbeIjk.h> 00027 #include <MeshVizXLM/mesh/MiVolumeMeshUnstructuredIjk.h> 00028 #include <MeshVizXLM/mesh/MiVolumeMeshHexahedronIjk.h> 00029 #include <MeshVizXLM/mesh/cell/MiVolumeCell.h> 00030 00031 00032 #include<Inventor/STL/cassert> 00033 00044 class MESHIVIZ_API MiPointProbeUnstructuredIjk : virtual public MiPointProbeIjk 00045 { 00046 public: 00047 00051 static MiPointProbeUnstructuredIjk* getNewInstance(const MiVolumeMeshHexahedronIjk& mesh, bool parallel = true); 00052 00058 template <typename _T> 00059 _T getValue(const MiDataSetI<_T>& dataset) const; 00060 00066 template <typename _T> 00067 _T getValue(const MiDataSetIjk<_T>& dataset) const; 00068 00069 #if 1 SoDEPRECATED 00075 static MiPointProbeUnstructuredIjk* getNewInstance(const MiVolumeMeshUnstructuredIjk& mesh, bool parallel = true); 00076 00077 #endif 00079 private:protected: 00080 00087 virtual const MiVolumeCell* getCell() const = 0; 00088 00089 }; 00090 00091 //----------------------------------------------------------------------------- 00092 template <typename _T> 00093 inline _T MiPointProbeUnstructuredIjk::getValue(const MiDataSetI<_T>& dataset) const 00094 { 00095 _T val(0); 00096 if (isFound()) 00097 { 00098 assert(dataset.getBinding()==MiDataSetI<_T>::PER_NODE); 00099 const MiCell *cell = getCell(); 00100 std::vector<double> weight(cell->getNumNodes()); 00101 getWeight(weight); 00102 for (size_t i=0; i<cell->getNumNodes(); ++i) 00103 val += weight[i]*dataset.get(cell->getNodeIndex(i)); 00104 } 00105 return val; 00106 } 00107 00108 //----------------------------------------------------------------------------- 00109 template <typename _T> 00110 inline _T MiPointProbeUnstructuredIjk::getValue(const MiDataSetIjk<_T>& dataset) const 00111 { 00112 _T val(0); 00113 if (isFound()) 00114 { 00115 assert(dataset.getBinding()==MiDataSetIjk<_T>::PER_CELL); 00116 size_t icell,jcell,kcell; 00117 getCellId(icell,jcell,kcell); 00118 val = dataset.get(icell,jcell,kcell); 00119 } 00120 return val; 00121 } 00122 00123 #endif 00124 00125 00126