00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__
00021 #define __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__
00022
00023 #include "MEDCoupling.hxx"
00024 #include "MEDCouplingTimeLabel.hxx"
00025 #include "InterpolationOptions.hxx"
00026 #include "MEDCouplingNatureOfField.hxx"
00027 #include "InterpKernelException.hxx"
00028
00029 #include <map>
00030 #include <vector>
00031
00032 namespace ParaMEDMEM
00033 {
00034 class MEDCouplingMesh;
00035 class MEDCouplingUMesh;
00036 class MEDCouplingFieldDouble;
00037 class MEDCouplingFieldTemplate;
00038 }
00039
00040 namespace ParaMEDMEM
00041 {
00042 class MEDCouplingRemapper : public TimeLabel, public INTERP_KERNEL::InterpolationOptions
00043 {
00044 public:
00045 MEDCOUPLINGREMAPPER_EXPORT MEDCouplingRemapper();
00046 MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper();
00047 MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception);
00048 MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception);
00049 MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
00050 MEDCOUPLINGREMAPPER_EXPORT void reverseTransfer(MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
00051 MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *transferField(const MEDCouplingFieldDouble *srcField, double dftValue) throw(INTERP_KERNEL::Exception);
00052 MEDCOUPLINGREMAPPER_EXPORT MEDCouplingFieldDouble *reverseTransferField(const MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
00053 MEDCOUPLINGREMAPPER_EXPORT bool setOptionInt(const std::string& key, int value);
00054 MEDCOUPLINGREMAPPER_EXPORT bool setOptionDouble(const std::string& key, double value);
00055 MEDCOUPLINGREMAPPER_EXPORT bool setOptionString(const std::string& key, const std::string& value);
00056 public:
00057 MEDCOUPLINGREMAPPER_EXPORT static void printMatrix(const std::vector<std::map<int,double> >& m);
00058 private:
00059 int prepareUU(const char *method) throw(INTERP_KERNEL::Exception);
00060 int prepareEE(const char *method) throw(INTERP_KERNEL::Exception);
00061 void updateTime() const;
00062 void releaseData(bool matrixSuppression);
00063 void computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField);
00064 void computeDenoFromScratch(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField) throw(INTERP_KERNEL::Exception);
00065 void computeProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer);
00066 void computeReverseProduct(const double *inputPointer, int inputNbOfCompo, double dftValue, double *resPointer);
00067 void buildFinalInterpolationMatrixByConvolution(const std::vector< std::map<int,double> >& m1D,
00068 const std::vector< std::map<int,double> >& m2D,
00069 const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc,
00070 const int *corrCellIdTrg);
00071 static void reverseMatrix(const std::vector<std::map<int,double> >& matIn, int nbColsMatIn,
00072 std::vector<std::map<int,double> >& matOut);
00073 static void computeRowSumAndColSum(const std::vector<std::map<int,double> >& matrixDeno,
00074 std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse);
00075 static void computeColSumAndRowSum(const std::vector<std::map<int,double> >& matrixDeno,
00076 std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse);
00077 private:
00078 MEDCouplingMesh *_src_mesh;
00079 MEDCouplingMesh *_target_mesh;
00080 std::string _src_method;
00081 std::string _target_method;
00082 NatureOfField _nature_of_deno;
00083 unsigned int _time_deno_update;
00084 std::vector<std::map<int,double> > _matrix;
00085 std::vector<std::map<int,double> > _deno_multiply;
00086 std::vector<std::map<int,double> > _deno_reverse_multiply;
00087 };
00088 }
00089
00090 #endif