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-2019 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 MESHVIZXLM_EXTR_API MiPointProbeUnstructured 00060 { 00061 public: 00062 virtual ~MiPointProbeUnstructured() {} 00063 00065 00071 static MiPointProbeUnstructured* getNewInstance(const MiVolumeMeshUnstructured& mesh, bool parallel = true); 00072 static MiPointProbeUnstructured* getNewInstance(const MiSurfaceMeshUnstructured& mesh, bool parallel = true); 00074 00078 virtual bool setLocation(const MbVec3d& point, const MiCellFilterI* cellFilter=NULL) = 0; 00079 00100 virtual bool moveLocation(const MbVec3d& point, size_t cellId, const MiCellFilterI* cellFilter=NULL) = 0; 00101 00105 virtual bool isFound() const = 0; 00106 00110 template <typename _T> 00111 _T getValue(const MiDataSetI<_T>& dataset) const; 00112 00117 virtual size_t getCellId() const = 0; 00118 00122 virtual const MbVec3d& getCoord() const = 0; 00123 00124 private:protected: 00129 virtual void getWeight(std::vector<double>& weight) const = 0; 00130 00138 virtual const MiCell* getCell() const = 0; 00139 00140 00141 }; 00142 00143 00144 //----------------------------------------------------------------------------- 00145 template <typename _T> 00146 inline _T MiPointProbeUnstructured::getValue(const MiDataSetI<_T>& dataset) const 00147 { 00148 _T val(0); 00149 if (isFound()) 00150 { 00151 if(dataset.getBinding()==MiDataSetI<_T>::PER_NODE) 00152 { 00153 const MiCell *cell = getCell(); 00154 std::vector<double> weight(cell->getNumNodes()); 00155 getWeight(weight); 00156 for (size_t i=0; i<cell->getNumNodes(); ++i) 00157 val += weight[i]*dataset.get(cell->getNodeIndex(i)); 00158 } 00159 else 00160 val = dataset.get(getCellId()); 00161 } 00162 return val; 00163 } 00164 00165 00166 #endif 00167 00168 00169