Salome HOME
Merge from BR_V5_DEV 16Feb09
[tools/medcoupling.git] / src / ParaMEDMEM / MxN_Mapping.hxx
1 //  Copyright (C) 2007-2008  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.
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 #ifndef __MXN_MAPPING_HXX__
20 #define __MXN_MAPPING_HXX__
21
22 #include "MEDCouplingFieldDouble.hxx"
23 #include "MPIAccessDEC.hxx"
24 #include "DECOptions.hxx"
25
26 #include <vector>
27
28 namespace ParaMEDMEM
29 {
30
31   class ProcessorGroup;
32
33   class MxN_Mapping : public DECOptions
34   {
35   public:
36     MxN_Mapping();
37     MxN_Mapping(const ProcessorGroup& source_group, const ProcessorGroup& target_group, const DECOptions& dec_options);
38     virtual ~MxN_Mapping();
39     void addElementFromSource(int distant_proc, int distant_elem);
40     void prepareSendRecv();
41     void sendRecv(MEDCouplingFieldDouble& field);
42     void sendRecv(double* field, MEDCouplingFieldDouble& field) const ;
43     void reverseSendRecv(double* field, MEDCouplingFieldDouble& field) const ;
44  
45     MPIAccessDEC* getAccessDEC(){ return _access_DEC; }
46   private :
47     ProcessorGroup* _union_group;
48     MPIAccessDEC * _access_DEC;
49     int _nb_comps;
50     std::vector<std::pair<int,int> > _sending_ids;
51     std::vector<int> _recv_ids;
52     std::vector<int> _send_proc_offsets;
53     std::vector<int> _recv_proc_offsets;
54   };
55
56   std::ostream & operator<< (std::ostream &,const AllToAllMethod &);
57
58 }
59
60 #endif