00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MiPointProbeIj_h
00024 #define _MiPointProbeIj_h
00025
00026 #include <MeshVizXLM/mesh/data/MiDataSetIj.h>
00027 #include <MeshVizXLM/mesh/cell/MiCell.h>
00028
00029 class MiCellFilterIj;
00030 class MiSurfaceMeshRegular;
00031 class MiSurfaceMeshRectilinear;
00032 class MiSurfaceMeshCurvilinear;
00033
00043 class MESHVIZXLM_EXTR_API MiPointProbeIj
00044 {
00045 public:
00046 virtual ~MiPointProbeIj() {}
00047
00049
00055 static MiPointProbeIj* getNewInstance(const MiSurfaceMeshRegular& mesh, bool parallel = true);
00056 static MiPointProbeIj* getNewInstance(const MiSurfaceMeshRectilinear& mesh, bool parallel = true);
00057 static MiPointProbeIj* getNewInstance(const MiSurfaceMeshCurvilinear& mesh, bool parallel = true);
00059
00069 virtual bool setLocation(const MbVec3d& point, const MiCellFilterIj* cellFilter=NULL) = 0;
00070
00093 virtual bool moveLocation(const MbVec3d& point, size_t cellIdI, size_t cellIdJ,
00094 const MiCellFilterIj* cellFilter=NULL) = 0;
00095
00100 virtual bool isFound() const = 0;
00101
00107 template <typename _T>
00108 _T getValue(const MiDataSetIj<_T>& dataset) const;
00109
00116 virtual void getCellId(size_t &i, size_t &j) const = 0;
00117
00118 private: protected:
00123 virtual void getWeight(std::vector<double>& weight) const = 0;
00124 };
00125
00126
00127 template <typename _T>
00128 inline _T MiPointProbeIj::getValue(const MiDataSetIj<_T>& dataset) const
00129 {
00130 _T val(0);
00131 if (isFound())
00132 {
00133 size_t icell,jcell;
00134 getCellId(icell,jcell);
00135 if(dataset.getBinding()==MiDataSetIj<_T>::PER_NODE)
00136 {
00137 std::vector<double> weight(4);
00138 getWeight(weight);
00139 val += weight[0]*dataset.get(icell,jcell);
00140 val += weight[1]*dataset.get(icell+1,jcell);
00141 val += weight[2]*dataset.get(icell+1,jcell+1);
00142 val += weight[3]*dataset.get(icell,jcell+1);
00143 }
00144 else
00145 val = dataset.get(icell,jcell);
00146 }
00147 return val;
00148 }
00149
00150
00151
00152 #endif
00153
00154
00155