00001
00002
00003 #ifndef _angel_comm_include_
00004 #define _angel_comm_include_
00005
00006 #ifdef USE_MPI
00007
00008 #include "angel_types.hpp"
00009 #include "gmpi.hpp"
00010 #include "eliminations.hpp"
00011
00012 namespace angel {
00014 typedef GMPI::buffer_t<int> comm_buffer_t;
00015
00017 enum graph_id_t {c_graph_id, line_graph_id, accu_graph_id};
00018
00019 typedef GMPI::comm_ref_t<int, c_graph_t> c_graph_comm_ref_t;
00020
00021 typedef GMPI::comm_ref_t<int, line_graph_t> line_graph_comm_ref_t;
00022
00023
00024 const int completion_tag= 3377;
00025
00026 }
00027
00028
00029 namespace GMPI {
00030
00031
00033 inline const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer,
00034 angel::c_graph_t::vertex_t& input) {
00035 input= buffer.read (); return buffer; }
00036
00038 inline angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer,
00039 const angel::c_graph_t::vertex_t& output) {
00040 buffer.write (output); return buffer; }
00041
00043 inline const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer,
00044 angel::edge_ij_elim_t& input) {
00045 int tmp; buffer >> input.i >> input.j >> tmp;
00046 input.front= (bool) tmp; return buffer; }
00047
00049 inline angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer,
00050 const angel::edge_ij_elim_t& output) {
00051 buffer << output.i << output.j << (int) output.front; return buffer; }
00052
00054 inline const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer,
00055 angel::triplet_t& input) {
00056 buffer >> input.i >> input.j >> input.k; return buffer; }
00057
00059 inline angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer,
00060 const angel::triplet_t& output) {
00061 buffer << output.i << output.j << output.k; return buffer; }
00062
00064 const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer,
00065 angel::c_graph_t& cg);
00066
00068 angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer, const angel::c_graph_t& cg);
00069
00071 const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer,
00072 angel::line_graph_t& input);
00073
00075 angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer,
00076 const angel::line_graph_t& output);
00077
00079 template <typename Ad_graph_t, typename El_spec_t>
00080 const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer,
00081 angel::elimination_history_t<Ad_graph_t,El_spec_t>& input) {
00082
00083 Ad_graph_t empty; input.cg= empty; input.seq.resize (0);
00084 buffer >> input.ccosts >> input.cg >> input.seq;
00085 return buffer;
00086 }
00087
00089 template <typename Ad_graph_t, typename El_spec_t>
00090 angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer,
00091 const angel::elimination_history_t<Ad_graph_t,El_spec_t>& input) {
00092 buffer << input.ccosts << input.cg << input.seq;
00093 return buffer; }
00094
00095 }
00096
00097
00098 #endif // USE_MPI
00099
00100 #endif // _angel_comm_include_