Salome HOME
Indices are stored as mcIdType type instead of int to support switch to 64bits indexing
[tools/medcoupling.git] / src / ParaMEDMEM / InterpolationMatrix.hxx
index 2d577bcb28c391cf74273804ae27c2652e7c0d74..3543875d42b10f0a63dec3a7e65ad7f33e8a9261 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #include "InterpolationOptions.hxx"
 #include "DECOptions.hxx"
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
   class ElementLocator;
 
+  /*!
+   Internal class, not part of the public API.
+
+   This class enables the storage of an interpolation matrix Wij mapping
+   a source field Sj to a target field Ti via Ti=Vi^(-1).Wij.Sj.
+   The matrix is built and stored on the processors belonging to the source
+   group.
+   */
   class InterpolationMatrix : public INTERP_KERNEL::InterpolationOptions,
                               public DECOptions
   {
   public:
     
-    InterpolationMatrix(const ParaMEDMEM::ParaFIELD *source_field, 
+    InterpolationMatrix(const MEDCoupling::ParaFIELD *source_field, 
                         const ProcessorGroup& source_group,
                         const ProcessorGroup& target_group,
                         const DECOptions& dec_opt,
@@ -43,13 +51,13 @@ namespace ParaMEDMEM
     
     virtual ~InterpolationMatrix();
     void addContribution(MEDCouplingPointSet& distant_support, int iproc_distant,
-                         const int* distant_elems, const std::string& srcMeth, const std::string& targetMeth);
+                         const mcIdType* distant_elems, const std::string& srcMeth, const std::string& targetMeth);
     void finishContributionW(ElementLocator& elementLocator);
     void finishContributionL(ElementLocator& elementLocator);
     void multiply(MEDCouplingFieldDouble& field) const;
     void transposeMultiply(MEDCouplingFieldDouble& field)const;
     void prepare();
-    int getNbRows() const { return _row_offsets.size(); }
+    mcIdType getNbRows() const { return ToIdType(_row_offsets.size()); }
     MPIAccessDEC* getAccessDEC() { return _mapping.getAccessDEC(); }
   private:
     void computeConservVolDenoW(ElementLocator& elementLocator);
@@ -61,33 +69,33 @@ namespace ParaMEDMEM
     void computeRevIntegralDenoL(ElementLocator& elementLocator);
     
     void computeLocalColSum(std::vector<double>& res) const;
-    void computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<int> >& resPerProcI,
+    void computeLocalRowSum(const std::vector<int>& distantProcs, std::vector<std::vector<mcIdType> >& resPerProcI,
                             std::vector<std::vector<double> >& resPerProcD) const;
     void computeGlobalRowSum(ElementLocator& elementLocator, std::vector<std::vector<double> >& denoStrorage, std::vector<std::vector<double> >& denoStrorageInv);
     void computeGlobalColSum(std::vector<std::vector<double> >& denoStrorage);
     void resizeGlobalColSum(std::vector<std::vector<double> >& denoStrorage);
-    void fillDSFromVM(int iproc_distant, const int* distant_elems, const std::vector< std::map<int,double> >& values, MEDCouplingFieldDouble *surf);
-    void serializeMe(std::vector< std::vector< std::map<int,double> > >& data1, std::vector<int>& data2) const;
+    void fillDSFromVM(int iproc_distant, const mcIdType* distant_elems, const std::vector< std::map<mcIdType,double> >& values, MEDCouplingFieldDouble *surf);
+    void serializeMe(std::vector< std::vector< std::map<mcIdType,double> > >& data1, std::vector<int>& data2) const;
     void initialize();
-    void findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<int> >& elementsToAdd,
-                                 const std::vector<std::vector<int> >& resPerProcI, const std::vector<std::vector<int> >& globalIdsPartial);
-    void addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& elementsToAdd);
+    void findAdditionnalElements(ElementLocator& elementLocator, std::vector<std::vector<mcIdType> >& elementsToAdd,
+                                 const std::vector<std::vector<mcIdType> >& resPerProcI, const std::vector<std::vector<mcIdType> >& globalIdsPartial);
+    void addGhostElements(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& elementsToAdd);
     int mergePolicies(const std::vector<int>& policyPartial);
-    void mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<int> >& globalIdsPartial,
-                     std::vector<int>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding);
-    void mergeRowSum2(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
-                      const std::vector<int>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding);
-    void mergeRowSum3(const std::vector< std::vector<int> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD);
-    void mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<int> >& rowsPartialSumI,
-                     const std::vector<std::vector<int> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv);
-    void divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<int> >& resPerProcI,
+    void mergeRowSum(const std::vector< std::vector<double> >& rowsPartialSumD, const std::vector< std::vector<mcIdType> >& globalIdsPartial,
+                     std::vector<mcIdType>& globalIdsLazySideInteraction, std::vector<double>& sumCorresponding);
+    void mergeRowSum2(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD,
+                      const std::vector<mcIdType>& globalIdsLazySideInteraction, const std::vector<double>& sumCorresponding);
+    void mergeRowSum3(const std::vector< std::vector<mcIdType> >& globalIdsPartial, std::vector< std::vector<double> >& rowsPartialSumD);
+    void mergeCoeffs(const std::vector<int>& procsInInteraction, const std::vector< std::vector<mcIdType> >& rowsPartialSumI,
+                     const std::vector<std::vector<mcIdType> >& globalIdsPartial, std::vector<std::vector<double> >& denoStrorageInv);
+    void divideByGlobalRowSum(const std::vector<int>& distantProcs, const std::vector<std::vector<mcIdType> >& resPerProcI,
                               const std::vector<std::vector<double> >& resPerProcD, std::vector<std::vector<double> >& deno);
   private:
     bool isSurfaceComputationNeeded(const std::string& method) const;
   private:
-    const ParaMEDMEM::ParaFIELD *_source_field;
-    std::vector<int> _row_offsets;
-    std::map<std::pair<int,int>, int > _col_offsets;
+    const MEDCoupling::ParaFIELD *_source_field;
+    std::vector<mcIdType> _row_offsets;
+    std::map<std::pair<int,mcIdType>, mcIdType > _col_offsets;
     MEDCouplingPointSet *_source_support;
     MxN_Mapping _mapping;