1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5<title>Class group</title> 6<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css"> 7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 8<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset"> 9<link rel="up" href="../../mpi/reference.html#header.boost.mpi.group_hpp" title="Header <boost/mpi/group.hpp>"> 10<link rel="prev" href="../graph_trai_1_3_27_7_12_2_1.html" title="Struct graph_traits<mpi::graph_communicator>"> 11<link rel="next" href="operator_1_3_27_7_13_2_1_2.html" title="Function operator=="> 12</head> 13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 14<table cellpadding="2" width="100%"><tr> 15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td> 16<td align="center"><a href="../../../../index.html">Home</a></td> 17<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> 18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 20<td align="center"><a href="../../../../more/index.htm">More</a></td> 21</tr></table> 22<hr> 23<div class="spirit-nav"> 24<a accesskey="p" href="../graph_trai_1_3_27_7_12_2_1.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mpi/reference.html#header.boost.mpi.group_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator_1_3_27_7_13_2_1_2.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 25</div> 26<div class="refentry"> 27<a name="boost.mpi.group"></a><div class="titlepage"></div> 28<div class="refnamediv"> 29<h2><span class="refentrytitle">Class group</span></h2> 30<p>boost::mpi::group — A <code class="computeroutput">group</code> is a representation of a subset of the processes within a <code class="computeroutput">communicator</code>. </p> 31</div> 32<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2> 33<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../mpi/reference.html#header.boost.mpi.group_hpp" title="Header <boost/mpi/group.hpp>">boost/mpi/group.hpp</a>> 34 35</span> 36<span class="keyword">class</span> <a class="link" href="group.html" title="Class group">group</a> <span class="special">{</span> 37<span class="keyword">public</span><span class="special">:</span> 38 <span class="comment">// <a class="link" href="group.html#boost.mpi.groupconstruct-copy-destruct">construct/copy/destruct</a></span> 39 <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_4-bb"><span class="identifier">group</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span> 40 <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_5-bb"><span class="identifier">group</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">MPI_Group</span> <span class="special">&</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">)</span><span class="special">;</span> 41 42 <span class="comment">// <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_3-bb">public member functions</a></span> 43 <span class="identifier">optional</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_3_1-bb"><span class="identifier">rank</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 44 <span class="keyword">int</span> <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_3_2-bb"><span class="identifier">size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 45 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="../../InputIterator.html" title="Concept InputIterator">InputIterator</a><span class="special">,</span> <span class="keyword">typename</span> <a class="link" href="../../OutputIterator.html" title="Concept OutputIterator">OutputIterator</a><span class="special">></span> 46 <span class="identifier">OutputIterator</span> 47 <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_3_3-bb"><span class="identifier">translate_ranks</span></a><span class="special">(</span><span class="identifier">InputIterator</span><span class="special">,</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="group.html" title="Class group">group</a> <span class="special">&</span><span class="special">,</span> 48 <span class="identifier">OutputIterator</span><span class="special">)</span><span class="special">;</span> 49 <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_3_4-bb"><span class="keyword">operator</span> <span class="keyword">bool</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 50 <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_3_5-bb"><span class="keyword">operator</span> <span class="identifier">MPI_Group</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> 51 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="../../InputIterator.html" title="Concept InputIterator">InputIterator</a><span class="special">></span> <a class="link" href="group.html" title="Class group">group</a> <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_3_6-bb"><span class="identifier">include</span></a><span class="special">(</span><span class="identifier">InputIterator</span><span class="special">,</span> <span class="identifier">InputIterator</span><span class="special">)</span><span class="special">;</span> 52 <span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="../../InputIterator.html" title="Concept InputIterator">InputIterator</a><span class="special">></span> <a class="link" href="group.html" title="Class group">group</a> <a class="link" href="group.html#id-1_3_27_7_13_2_1_1_3_7-bb"><span class="identifier">exclude</span></a><span class="special">(</span><span class="identifier">InputIterator</span><span class="special">,</span> <span class="identifier">InputIterator</span><span class="special">)</span><span class="special">;</span> 53<span class="special">}</span><span class="special">;</span></pre></div> 54<div class="refsect1"> 55<a name="id-1.3.27.7.14.4.4"></a><h2>Description</h2> 56<p>The <code class="computeroutput">group</code> class allows one to create arbitrary subsets of the processes within a communicator. One can compute the union, intersection, or difference of two groups, or create new groups by specifically including or excluding certain processes. Given a group, one can create a new communicator containing only the processes in that group. </p> 57<div class="refsect2"> 58<a name="id-1.3.27.7.14.4.4.3"></a><h3> 59<a name="boost.mpi.groupconstruct-copy-destruct"></a><code class="computeroutput">group</code> 60 public 61 construct/copy/destruct</h3> 62<div class="orderedlist"><ol class="orderedlist" type="1"> 63<li class="listitem"> 64<pre class="literallayout"><a name="id-1_3_27_7_13_2_1_1_4-bb"></a><span class="identifier">group</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Constructs an empty group. </li> 65<li class="listitem"> 66<pre class="literallayout"><a name="id-1_3_27_7_13_2_1_1_5-bb"></a><span class="identifier">group</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">MPI_Group</span> <span class="special">&</span> in_group<span class="special">,</span> <span class="keyword">bool</span> adopt<span class="special">)</span><span class="special">;</span></pre>Constructs a group from an <code class="computeroutput">MPI_Group</code>. <p>This routine allows one to construct a Boost.MPI <code class="computeroutput">group</code> from a C <code class="computeroutput">MPI_Group</code>. The <code class="computeroutput">group</code> object can (optionally) adopt the <code class="computeroutput">MPI_Group</code>, after which point the <code class="computeroutput">group</code> object becomes responsible for freeing the <code class="computeroutput">MPI_Group</code> when the last copy of <code class="computeroutput">group</code> disappears.</p> 67<p> 68</p> 69<div class="variablelist"><table border="0" class="variablelist compact"> 70<colgroup> 71<col align="left" valign="top"> 72<col> 73</colgroup> 74<tbody><tr> 75<td><p><span class="term">Parameters:</span></p></td> 76<td><div class="variablelist"><table border="0" class="variablelist compact"> 77<colgroup> 78<col align="left" valign="top"> 79<col> 80</colgroup> 81<tbody> 82<tr> 83<td><p><span class="term"><code class="computeroutput">adopt</code></span></p></td> 84<td><p>Whether the <code class="computeroutput">group</code> should adopt the <code class="computeroutput">MPI_Group</code>. When true, the <code class="computeroutput">group</code> object (or one of its copies) will free the group (via <code class="computeroutput">MPI_Comm_free</code>) when the last copy is destroyed. Otherwise, the user is responsible for calling <code class="computeroutput">MPI_Group_free</code>. </p></td> 85</tr> 86<tr> 87<td><p><span class="term"><code class="computeroutput">in_group</code></span></p></td> 88<td><p>The <code class="computeroutput">MPI_Group</code> used to construct this <code class="computeroutput">group</code>.</p></td> 89</tr> 90</tbody> 91</table></div></td> 92</tr></tbody> 93</table></div> 94</li> 95</ol></div> 96</div> 97<div class="refsect2"> 98<a name="id-1.3.27.7.14.4.4.4"></a><h3> 99<a name="id-1_3_27_7_13_2_1_1_3-bb"></a><code class="computeroutput">group</code> public member functions</h3> 100<div class="orderedlist"><ol class="orderedlist" type="1"> 101<li class="listitem"> 102<pre class="literallayout"><span class="identifier">optional</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <a name="id-1_3_27_7_13_2_1_1_3_1-bb"></a><span class="identifier">rank</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Determine the rank of the calling process in the group. <p>This routine is equivalent to <code class="computeroutput">MPI_Group_rank</code>.</p> 103<p> 104</p> 105<div class="variablelist"><table border="0" class="variablelist compact"> 106<colgroup> 107<col align="left" valign="top"> 108<col> 109</colgroup> 110<tbody><tr> 111<td><p><span class="term">Returns:</span></p></td> 112<td><p>The rank of the calling process in the group, which will be a value in [0, size()). If the calling process is not in the group, returns an empty value. </p></td> 113</tr></tbody> 114</table></div> 115</li> 116<li class="listitem"> 117<pre class="literallayout"><span class="keyword">int</span> <a name="id-1_3_27_7_13_2_1_1_3_2-bb"></a><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Determine the number of processes in the group. <p>This routine is equivalent to <code class="computeroutput">MPI_Group_size</code>.</p> 118<p> 119</p> 120<div class="variablelist"><table border="0" class="variablelist compact"> 121<colgroup> 122<col align="left" valign="top"> 123<col> 124</colgroup> 125<tbody><tr> 126<td><p><span class="term">Returns:</span></p></td> 127<td><p>The number of processes in the group. </p></td> 128</tr></tbody> 129</table></div> 130</li> 131<li class="listitem"> 132<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="../../InputIterator.html" title="Concept InputIterator">InputIterator</a><span class="special">,</span> <span class="keyword">typename</span> <a class="link" href="../../OutputIterator.html" title="Concept OutputIterator">OutputIterator</a><span class="special">></span> 133 <span class="identifier">OutputIterator</span> 134 <a name="id-1_3_27_7_13_2_1_1_3_3-bb"></a><span class="identifier">translate_ranks</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">,</span> 135 <span class="keyword">const</span> <a class="link" href="group.html" title="Class group">group</a> <span class="special">&</span> to_group<span class="special">,</span> <span class="identifier">OutputIterator</span> out<span class="special">)</span><span class="special">;</span></pre>Translates the ranks from one group into the ranks of the same processes in another group. <p>This routine translates each of the integer rank values in the iterator range <code class="computeroutput"></code>[first, last) from the current group into rank values of the corresponding processes in <code class="computeroutput">to_group</code>. The corresponding rank values are written via the output iterator <code class="computeroutput">out</code>. When there is no correspondence between a rank in the current group and a rank in <code class="computeroutput">to_group</code>, the value <code class="computeroutput">MPI_UNDEFINED</code> is written to the output iterator.</p> 136<p> 137 138</p> 139<div class="variablelist"><table border="0" class="variablelist compact"> 140<colgroup> 141<col align="left" valign="top"> 142<col> 143</colgroup> 144<tbody> 145<tr> 146<td><p><span class="term">Parameters:</span></p></td> 147<td><div class="variablelist"><table border="0" class="variablelist compact"> 148<colgroup> 149<col align="left" valign="top"> 150<col> 151</colgroup> 152<tbody> 153<tr> 154<td><p><span class="term"><code class="computeroutput">first</code></span></p></td> 155<td><p>Beginning of the iterator range of ranks in the current group.</p></td> 156</tr> 157<tr> 158<td><p><span class="term"><code class="computeroutput">last</code></span></p></td> 159<td><p>Past the end of the iterator range of ranks in the current group.</p></td> 160</tr> 161<tr> 162<td><p><span class="term"><code class="computeroutput">out</code></span></p></td> 163<td><p>The output iterator to which the translated ranks will be written.</p></td> 164</tr> 165<tr> 166<td><p><span class="term"><code class="computeroutput">to_group</code></span></p></td> 167<td><p>The group that we are translating ranks to.</p></td> 168</tr> 169</tbody> 170</table></div></td> 171</tr> 172<tr> 173<td><p><span class="term">Returns:</span></p></td> 174<td><p>the output iterator, which points one step past the last rank written. </p></td> 175</tr> 176</tbody> 177</table></div> 178</li> 179<li class="listitem"> 180<pre class="literallayout"><a name="id-1_3_27_7_13_2_1_1_3_4-bb"></a><span class="keyword">operator</span> <span class="keyword">bool</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Determines whether the group is non-empty. <p> 181</p> 182<div class="variablelist"><table border="0" class="variablelist compact"> 183<colgroup> 184<col align="left" valign="top"> 185<col> 186</colgroup> 187<tbody><tr> 188<td><p><span class="term">Returns:</span></p></td> 189<td><p>True if the group is not empty, false if it is empty. </p></td> 190</tr></tbody> 191</table></div> 192</li> 193<li class="listitem"> 194<pre class="literallayout"><a name="id-1_3_27_7_13_2_1_1_3_5-bb"></a><span class="keyword">operator</span> <span class="identifier">MPI_Group</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Retrieves the underlying <code class="computeroutput">MPI_Group</code> associated with this group. <p> 195</p> 196<div class="variablelist"><table border="0" class="variablelist compact"> 197<colgroup> 198<col align="left" valign="top"> 199<col> 200</colgroup> 201<tbody><tr> 202<td><p><span class="term">Returns:</span></p></td> 203<td><p>The <code class="computeroutput">MPI_Group</code> handle manipulated by this object. If this object represents the empty group, returns <code class="computeroutput">MPI_GROUP_EMPTY</code>. </p></td> 204</tr></tbody> 205</table></div> 206</li> 207<li class="listitem"> 208<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="../../InputIterator.html" title="Concept InputIterator">InputIterator</a><span class="special">></span> 209 <a class="link" href="group.html" title="Class group">group</a> <a name="id-1_3_27_7_13_2_1_1_3_6-bb"></a><span class="identifier">include</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">)</span><span class="special">;</span></pre>Creates a new group including a subset of the processes in the current group. <p>This routine creates a new <code class="computeroutput">group</code> which includes only those processes in the current group that are listed in the integer iterator range <code class="computeroutput"></code>[first, last). Equivalent to <code class="computeroutput">MPI_Group_incl</code>.</p> 210<p><code class="computeroutput">first</code> The beginning of the iterator range of ranks to include.</p> 211<p><code class="computeroutput">last</code> Past the end of the iterator range of ranks to include.</p> 212<p> 213</p> 214<div class="variablelist"><table border="0" class="variablelist compact"> 215<colgroup> 216<col align="left" valign="top"> 217<col> 218</colgroup> 219<tbody><tr> 220<td><p><span class="term">Returns:</span></p></td> 221<td><p>A new group containing those processes with ranks <code class="computeroutput"></code>[first, last) in the current group. </p></td> 222</tr></tbody> 223</table></div> 224</li> 225<li class="listitem"> 226<pre class="literallayout"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <a class="link" href="../../InputIterator.html" title="Concept InputIterator">InputIterator</a><span class="special">></span> 227 <a class="link" href="group.html" title="Class group">group</a> <a name="id-1_3_27_7_13_2_1_1_3_7-bb"></a><span class="identifier">exclude</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">)</span><span class="special">;</span></pre>Creates a new group from all of the processes in the current group, exluding a specific subset of the processes. <p>This routine creates a new <code class="computeroutput">group</code> which includes all of the processes in the current group except those whose ranks are listed in the integer iterator range <code class="computeroutput"></code>[first, last). Equivalent to <code class="computeroutput">MPI_Group_excl</code>.</p> 228<p><code class="computeroutput">first</code> The beginning of the iterator range of ranks to exclude.</p> 229<p><code class="computeroutput">last</code> Past the end of the iterator range of ranks to exclude.</p> 230<p> 231</p> 232<div class="variablelist"><table border="0" class="variablelist compact"> 233<colgroup> 234<col align="left" valign="top"> 235<col> 236</colgroup> 237<tbody><tr> 238<td><p><span class="term">Returns:</span></p></td> 239<td><p>A new group containing all of the processes in the current group except those processes with ranks <code class="computeroutput"></code>[first, last) in the current group. </p></td> 240</tr></tbody> 241</table></div> 242</li> 243</ol></div> 244</div> 245</div> 246</div> 247<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 248<td align="left"></td> 249<td align="right"><div class="copyright-footer">Copyright © 2005-2007 Douglas Gregor, 250 Matthias Troyer, Trustees of Indiana University<p> 251 Distributed under the Boost Software License, Version 1.0. (See accompanying 252 file LICENSE_1_0.txt or copy at <ulink url="http://www.boost.org/LICENSE_1_0.txt"> 253 http://www.boost.org/LICENSE_1_0.txt </ulink>) 254 </p> 255</div></td> 256</tr></table> 257<hr> 258<div class="spirit-nav"> 259<a accesskey="p" href="../graph_trai_1_3_27_7_12_2_1.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mpi/reference.html#header.boost.mpi.group_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator_1_3_27_7_13_2_1_2.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 260</div> 261</body> 262</html> 263