Salome HOME
OverlapDEC: adding attach*LocalField(MEDCouplingFieldDouble *) methods
[modules/med.git] / src / ParaMEDMEM / OverlapDEC.hxx
1 // Copyright (C) 2007-2015  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
29 namespace ParaMEDMEM
30 {
31   class OverlapInterpolationMatrix;
32   class OverlapElementLocator;
33   class ProcessorGroup;
34   class ParaFIELD;
35
36   class OverlapDEC : public DEC, public INTERP_KERNEL::InterpolationOptions
37   {
38   public:
39     OverlapDEC(const std::set<int>& procIds,const MPI_Comm& world_comm=MPI_COMM_WORLD);
40     virtual ~OverlapDEC();
41     void sendRecvData(bool way=true);
42     void sendData();
43     void recvData();
44     void synchronize();
45     void attachSourceLocalField(ParaFIELD *field, bool ownPt=false);
46     void attachTargetLocalField(ParaFIELD *field, bool ownPt=false);
47     void attachSourceLocalField(MEDCouplingFieldDouble *field);
48     void attachTargetLocalField(MEDCouplingFieldDouble *field);
49     ProcessorGroup *getGroup() { return _group; }
50     bool isInGroup() const;
51
52     void setDefaultValue(double val) {_default_field_value = val;}
53   private:
54     bool _own_group;
55     OverlapInterpolationMatrix* _interpolation_matrix;
56     OverlapElementLocator* _locator;
57     ProcessorGroup *_group;
58
59     double _default_field_value;
60
61     ParaFIELD *_source_field;
62     bool _own_source_field;
63     ParaFIELD *_target_field;
64     bool _own_target_field;
65     MPI_Comm _comm;
66   };
67 }
68
69 #endif