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 MESHIVIZ_API MiPointProbeIj
00044 {
00045 public:
00046 virtual ~MiPointProbeIj() {}
00047
00049
00052 static MiPointProbeIj* getNewInstance(const MiSurfaceMeshRegular& mesh, bool parallel = true);
00053 static MiPointProbeIj* getNewInstance(const MiSurfaceMeshRectilinear& mesh, bool parallel = true);
00054 static MiPointProbeIj* getNewInstance(const MiSurfaceMeshCurvilinear& mesh, bool parallel = true);
00056
00066 virtual bool setLocation(const MbVec3d& point, const MiCellFilterIj* cellFilter=NULL) = 0;
00067
00090 virtual bool moveLocation(const MbVec3d& point, size_t cellIdI, size_t cellIdJ,
00091 const MiCellFilterIj* cellFilter=NULL) = 0;
00092
00097 virtual bool isFound() const = 0;
00098
00104 template <typename _T>
00105 _T getValue(const MiDataSetIj<_T>& dataset) const;
00106
00113 virtual void getCellId(size_t &i, size_t &j) const = 0;
00114
00115 private: protected:
00120 virtual void getWeight(std::vector<double>& weight) const = 0;
00121 };
00122
00123
00124 template <typename _T>
00125 inline _T MiPointProbeIj::getValue(const MiDataSetIj<_T>& dataset) const
00126 {
00127 _T val(0);
00128 if (isFound())
00129 {
00130 size_t icell,jcell;
00131 getCellId(icell,jcell);
00132 if(dataset.getBinding()==MiDataSetIj<_T>::PER_NODE)
00133 {
00134 std::vector<double> weight(4);
00135 getWeight(weight);
00136 val += weight[0]*dataset.get(icell,jcell);
00137 val += weight[1]*dataset.get(icell+1,jcell);
00138 val += weight[2]*dataset.get(icell+1,jcell+1);
00139 val += weight[3]*dataset.get(icell,jcell+1);
00140 }
00141 else
00142 val = dataset.get(icell,jcell);
00143 }
00144 return val;
00145 }
00146
00147
00148
00149 #endif
00150
00151
00152