1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File : MEDSPLITTER_MeshSendReceive.hxx
20 // Created : Tue Jun 30 19:14:51 2009
21 // Author : Edward AGAPOV (eap)
24 #ifndef __MEDSPLITTER_MeshSendReceive_HXX__
25 #define __MEDSPLITTER_MeshSendReceive_HXX__
27 #include "MEDSPLITTER.hxx"
32 typedef int MPI_Request;
45 * \brief Sender-receiver of the mesh.
47 * We also send-receive
48 * 1) global node ids for the sake of fusing domain parts
49 * 2) global cell ids for the sake of detecting cell/cell joints using global graph
50 * 3) global face ids for the sake of not losing face sharing among domains
52 class MEDSPLITTER_EXPORT MeshSendReceive
59 // Sends the mesh of idomain to irank processor asynchronously
60 // WARNING: do NOT delete the mesh until this->isSent()!
61 void send(int irank, int idomain, MEDMEM::MESH* mesh,
62 const std::vector<int>& cell_glob_nums,
63 const std::vector<int>& face_glob_nums,
64 const std::vector<int>& node_glob_nums);
66 // Receives the mesh of idomain from irank processor synchronously
67 MEDMEM::MESH* recv(int irank, int idomain,
68 std::vector<int>& cell_glob_numbers,
69 std::vector<int>& face_glob_numbers,
70 std::vector<int>& node_glob_numbers);
72 //!< Returns the received or sent mesh. The user is resposible for freeing the received mesh.
73 MEDMEM::MESH* getMesh() { return _mesh; }
75 // Returns true if mesh is already sent
78 // Frees buffers waiting until isSent()
83 std::vector< int > _int_buf;
84 std::vector< int > _node_glob_numbers, _cell_glob_numbers, _face_glob_numbers;
85 std::vector< char> _char_buf;
89 MPI_Request _int_request, _coord_request, _char_request;
90 MPI_Request _node_nums_request, _cell_nums_request, _face_nums_request;