00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D 00002 // 00003 // This library is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU Lesser General Public 00005 // License as published by the Free Software Foundation; either 00006 // version 2.1 of the License. 00007 // 00008 // This library is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 // Lesser General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU Lesser General Public 00014 // License along with this library; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 // 00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00018 // 00019 00020 #ifndef __MXN_MAPPING_HXX__ 00021 #define __MXN_MAPPING_HXX__ 00022 00023 #include "MEDCouplingFieldDouble.hxx" 00024 #include "MPIAccessDEC.hxx" 00025 #include "DECOptions.hxx" 00026 00027 #include <vector> 00028 00029 namespace ParaMEDMEM 00030 { 00031 00032 class ProcessorGroup; 00033 00034 class MxN_Mapping : public DECOptions 00035 { 00036 public: 00037 MxN_Mapping(); 00038 MxN_Mapping(const ProcessorGroup& source_group, const ProcessorGroup& target_group, const DECOptions& dec_options); 00039 virtual ~MxN_Mapping(); 00040 void addElementFromSource(int distant_proc, int distant_elem); 00041 void prepareSendRecv(); 00042 void sendRecv(MEDCouplingFieldDouble& field); 00043 void sendRecv(double* sendfield, MEDCouplingFieldDouble& field) const ; 00044 void reverseSendRecv(double* recvfield, MEDCouplingFieldDouble& field) const ; 00045 00046 // 00047 const std::vector<std::pair<int,int> >& getSendingIds() const { return _sending_ids; } 00048 const std::vector<int>& getSendProcsOffsets() const { return _send_proc_offsets; } 00049 void initialize(); 00050 00051 MPIAccessDEC* getAccessDEC(){ return _access_DEC; } 00052 private : 00053 ProcessorGroup* _union_group; 00054 MPIAccessDEC * _access_DEC; 00055 int _nb_comps; 00056 std::vector<std::pair<int,int> > _sending_ids; 00057 std::vector<int> _recv_ids; 00058 std::vector<int> _send_proc_offsets; 00059 std::vector<int> _recv_proc_offsets; 00060 }; 00061 00062 std::ostream & operator<< (std::ostream &,const AllToAllMethod &); 00063 00064 } 00065 00066 #endif