Salome HOME
Merge from V6_main 15/03/2013
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingRemapper.hxx
index b09539ec405af3653dedee3f876729613d9028ab..114a3f4e34a4747db136bd1a28c59de8394c4ce5 100644 (file)
@@ -16,6 +16,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
 
 #ifndef __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__
 #define __PARAMEDMEM_MEDCOUPLINGREMAPPER_HXX__
@@ -24,6 +25,8 @@
 #include "MEDCouplingTimeLabel.hxx"
 #include "InterpolationOptions.hxx"
 #include "MEDCouplingNatureOfField.hxx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+
 #include "InterpKernelException.hxx"
 
 #include <map>
 namespace ParaMEDMEM
 {
   class MEDCouplingMesh;
-  class MEDCouplingUMesh;
   class MEDCouplingFieldDouble;
   class MEDCouplingFieldTemplate;
 }
 
 namespace ParaMEDMEM
 {
+  typedef enum
+    {
+      IK_ONLY_PREFERED = 0,
+      NOT_IK_ONLY_PREFERED = 1,
+      IK_ONLY_FORCED = 2,
+      NOT_IK_ONLY_FORCED =3
+    } InterpolationMatrixPolicy;
+
   class MEDCouplingRemapper : public TimeLabel, public INTERP_KERNEL::InterpolationOptions
   {
   public:
@@ -54,13 +64,32 @@ namespace ParaMEDMEM
     MEDCOUPLINGREMAPPER_EXPORT bool setOptionInt(const std::string& key, int value);
     MEDCOUPLINGREMAPPER_EXPORT bool setOptionDouble(const std::string& key, double value);
     MEDCOUPLINGREMAPPER_EXPORT bool setOptionString(const std::string& key, const std::string& value);
+    MEDCOUPLINGREMAPPER_EXPORT int getInterpolationMatrixPolicy() const;
+    MEDCOUPLINGREMAPPER_EXPORT void setInterpolationMatrixPolicy(int newInterpMatPol) throw(INTERP_KERNEL::Exception);
+    //
+    MEDCOUPLINGREMAPPER_EXPORT int nullifiedTinyCoeffInCrudeMatrixAbs(double maxValAbs) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLINGREMAPPER_EXPORT int nullifiedTinyCoeffInCrudeMatrix(double scaleFactor) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLINGREMAPPER_EXPORT double getMaxValueInCrudeMatrix() const throw(INTERP_KERNEL::Exception);
   public:
     MEDCOUPLINGREMAPPER_EXPORT const std::vector<std::map<int,double> >& getCrudeMatrix() const;
     MEDCOUPLINGREMAPPER_EXPORT static void PrintMatrix(const std::vector<std::map<int,double> >& m);
   private:
-    int prepareUU(const char *method) throw(INTERP_KERNEL::Exception);
-    int prepareEE(const char *method) throw(INTERP_KERNEL::Exception);
+    int prepareInterpKernelOnly() throw(INTERP_KERNEL::Exception);
+    int prepareInterpKernelOnlyUU() throw(INTERP_KERNEL::Exception);
+    int prepareInterpKernelOnlyEE() throw(INTERP_KERNEL::Exception);
+    int prepareInterpKernelOnlyUC() throw(INTERP_KERNEL::Exception);
+    int prepareInterpKernelOnlyCU() throw(INTERP_KERNEL::Exception);
+    int prepareInterpKernelOnlyCC() throw(INTERP_KERNEL::Exception);
+    //
+    int prepareNotInterpKernelOnly() throw(INTERP_KERNEL::Exception);
+    int prepareNotInterpKernelOnlyGaussGauss() throw(INTERP_KERNEL::Exception);
+    //
+    static int CheckInterpolationMethodManageableByNotOnlyInterpKernel(const std::string& method) throw(INTERP_KERNEL::Exception);
+    //
+    bool isInterpKernelOnlyOrNotOnly() const throw(INTERP_KERNEL::Exception);
     void updateTime() const;
+    void checkPrepare() const throw(INTERP_KERNEL::Exception);
+    std::string checkAndGiveInterpolationMethodStr(std::string& srcMeth, std::string& trgMeth) const throw(INTERP_KERNEL::Exception);
     void releaseData(bool matrixSuppression);
     void transferUnderground(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, bool isDftVal, double dftValue) throw(INTERP_KERNEL::Exception);
     void computeDeno(NatureOfField nat, const MEDCouplingFieldDouble *srcField, const MEDCouplingFieldDouble *trgField);
@@ -71,17 +100,16 @@ namespace ParaMEDMEM
                                                     const std::vector< std::map<int,double> >& m2D,
                                                     const int *corrCellIdSrc, int nbOf2DCellsSrc, int nbOf1DCellsSrc,
                                                     const int *corrCellIdTrg);
-    static void reverseMatrix(const std::vector<std::map<int,double> >& matIn, int nbColsMatIn,
+    static void ReverseMatrix(const std::vector<std::map<int,double> >& matIn, int nbColsMatIn,
                               std::vector<std::map<int,double> >& matOut);
-    static void computeRowSumAndColSum(const std::vector<std::map<int,double> >& matrixDeno,
+    static void ComputeRowSumAndColSum(const std::vector<std::map<int,double> >& matrixDeno,
                                        std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse);
-    static void computeColSumAndRowSum(const std::vector<std::map<int,double> >& matrixDeno,
+    static void ComputeColSumAndRowSum(const std::vector<std::map<int,double> >& matrixDeno,
                                        std::vector<std::map<int,double> >& deno, std::vector<std::map<int,double> >& denoReverse);
   private:
-    MEDCouplingMesh *_src_mesh;
-    MEDCouplingMesh *_target_mesh;
-    std::string _src_method;
-    std::string _target_method;
+    MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> _src_ft;
+    MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> _target_ft;
+    InterpolationMatrixPolicy _interp_matrix_pol;
     NatureOfField _nature_of_deno;
     unsigned int _time_deno_update;
     std::vector<std::map<int,double> > _matrix;