Salome HOME
Update copyrights
[tools/medcoupling.git] / src / ParaMEDMEM / OverlapInterpolationMatrix.hxx
1 // Copyright (C) 2007-2019  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (CEA/DEN)
20
21 #ifndef __OVERLAPINTERPOLATIONMATRIX_HXX__
22 #define __OVERLAPINTERPOLATIONMATRIX_HXX__
23
24 #include "MPIAccessDEC.hxx"
25 #include "OverlapMapping.hxx"
26 #include "InterpolationOptions.hxx"
27 #include "DECOptions.hxx"
28
29 namespace MEDCoupling
30 {
31   class ParaFIELD;
32   class MEDCouplingPointSet;
33
34   /*!
35    * Internal class, not part of the public API.
36    *
37    * Similar to InterpolationMatrix, but for the OverlapDEC instead of the InterpKernelDEC.
38    */
39   class OverlapInterpolationMatrix : public INTERP_KERNEL::InterpolationOptions,
40                                      public DECOptions
41   {
42   public:
43     
44     OverlapInterpolationMatrix(ParaFIELD *source_field,
45                                ParaFIELD *target_field,
46                                const ProcessorGroup& group,
47                                const DECOptions& dec_opt,
48                                const InterpolationOptions& i_opt,
49                                const OverlapElementLocator & loc);
50
51     void keepTracksOfSourceIds(int procId, DataArrayInt *ids);
52
53     void keepTracksOfTargetIds(int procId, DataArrayInt *ids);
54
55     void computeLocalIntersection(const MEDCouplingPointSet *src, const DataArrayInt *srcIds, const std::string& srcMeth, int srcProcId,
56                          const MEDCouplingPointSet *trg, const DataArrayInt *trgIds, const std::string& trgMeth, int trgProcId);
57
58     void prepare(const std::vector< int > & procsToSendField);
59     
60     void computeSurfacesAndDeno();
61
62     void multiply(double default_val);
63
64     void transposeMultiply();
65     
66     virtual ~OverlapInterpolationMatrix();
67   private:
68
69     static void TransposeMatrix(const std::vector<SparseDoubleVec>& matIn, int nbColsMatIn,
70                                 std::vector<SparseDoubleVec>& matOut);
71   private:
72     ParaFIELD           *_source_field;
73     ParaFIELD           *_target_field;
74     MEDCouplingPointSet *_source_support;
75     MEDCouplingPointSet *_target_support;
76     OverlapMapping      _mapping;
77  
78     const ProcessorGroup& _group;
79   };
80 }
81
82 #endif