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 _MiPointProbeUnstructured_h 00024 #define _MiPointProbeUnstructured_h 00025 00026 #include <MeshVizXLM/mesh/data/MiDataSetI.h> 00027 #include <MeshVizXLM/mesh/cell/MiCell.h> 00028 #include <MeshVizXLM/mesh/data/MiDataSet.h> 00029 00030 class MiCellFilterI; 00031 class MiVolumeMeshUnstructured; 00032 class MiSurfaceMeshUnstructured; 00033 00034 00059 class MESHIVIZ_API MiPointProbeUnstructured 00060 { 00061 public: 00062 virtual ~MiPointProbeUnstructured() {} 00063 00065 00068 static MiPointProbeUnstructured* getNewInstance(const MiVolumeMeshUnstructured& mesh, bool parallel = true); 00069 static MiPointProbeUnstructured* getNewInstance(const MiSurfaceMeshUnstructured& mesh, bool parallel = true); 00071 00075 virtual bool setLocation(const MbVec3d& point, const MiCellFilterI* cellFilter=NULL) = 0; 00076 00097 virtual bool moveLocation(const MbVec3d& point, size_t cellId, const MiCellFilterI* cellFilter=NULL) = 0; 00098 00102 virtual bool isFound() const = 0; 00103 00107 template <typename _T> 00108 _T getValue(const MiDataSetI<_T>& dataset) const; 00109 00114 virtual size_t getCellId() const = 0; 00115 00119 virtual const MbVec3d& getCoord() const = 0; 00120 00121 private:protected: 00126 virtual void getWeight(std::vector<double>& weight) const = 0; 00127 00135 virtual const MiCell* getCell() const = 0; 00136 00137 00138 }; 00139 00140 00141 //----------------------------------------------------------------------------- 00142 template <typename _T> 00143 inline _T MiPointProbeUnstructured::getValue(const MiDataSetI<_T>& dataset) const 00144 { 00145 _T val(0); 00146 if (isFound()) 00147 { 00148 if(dataset.getBinding()==MiDataSetI<_T>::PER_NODE) 00149 { 00150 const MiCell *cell = getCell(); 00151 std::vector<double> weight(cell->getNumNodes()); 00152 getWeight(weight); 00153 for (size_t i=0; i<cell->getNumNodes(); ++i) 00154 val += weight[i]*dataset.get(cell->getNodeIndex(i)); 00155 } 00156 else 00157 val = dataset.get(getCellId()); 00158 } 00159 return val; 00160 } 00161 00162 00163 #endif 00164 00165 00166