Salome HOME
Get relevant changes from V7_dev branch (copyright update, adm files etc)
[tools/medcoupling.git] / src / ParaMEDMEM / OverlapDEC.hxx
1 // Copyright (C) 2007-2016  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 __OVERLAPDEC_HXX__
22 #define __OVERLAPDEC_HXX__
23
24 #include "DEC.hxx"
25 #include "InterpolationOptions.hxx"
26
27 #include <mpi.h>
28 #include <string>
29
30 namespace MEDCoupling
31 {
32   class OverlapInterpolationMatrix;
33   class OverlapElementLocator;
34   class ProcessorGroup;
35   class ParaFIELD;
36
37   class OverlapDEC : public DEC, public INTERP_KERNEL::InterpolationOptions
38   {
39   public:
40     OverlapDEC(const std::set<int>& procIds,const MPI_Comm& world_comm=MPI_COMM_WORLD);
41     virtual ~OverlapDEC();
42     void sendRecvData(bool way=true);
43     void sendData();
44     void recvData();
45     void synchronize();
46     void attachSourceLocalField(ParaFIELD *field, bool ownPt=false);
47     void attachTargetLocalField(ParaFIELD *field, bool ownPt=false);
48     void attachSourceLocalField(MEDCouplingFieldDouble *field);
49     void attachTargetLocalField(MEDCouplingFieldDouble *field);
50     ProcessorGroup *getGroup() { return _group; }
51     bool isInGroup() const;
52
53     void setDefaultValue(double val) {_default_field_value = val;}
54     //! 0 means initial algo from Antho, 1 or 2 means Adrien's algo (2 should be better). Make your choice :-))
55     void setWorkSharingAlgo(int method)  { _load_balancing_algo = method; }
56
57     void debugPrintWorkSharing(std::ostream & ostr) const;
58   private:
59     int _load_balancing_algo;
60
61     bool _own_group;
62     OverlapInterpolationMatrix* _interpolation_matrix;
63     OverlapElementLocator* _locator;
64     ProcessorGroup *_group;
65
66     double _default_field_value;
67
68     ParaFIELD *_source_field;
69     bool _own_source_field;
70     ParaFIELD *_target_field;
71     bool _own_target_field;
72     MPI_Comm _comm;
73   };
74 }
75
76 #endif