<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Dune team,<div><br></div><div>Recently, I have had a problem with the communication of variables with type DynamicVector. I have the following communicator inside a code, which is written in accordance with the Dune guide notes:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(119, 88, 67); "><span style="color: #911c67">template</span><span style="color: #000000"><</span><span style="color: #911c67">class</span><span style="color: #000000"> </span>ElementMapper<span style="color: #000000">, </span><span style="color: #911c67">class</span><span style="color: #000000"> </span>Vector<span style="color: #000000">></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(1, 97, 66); "><span style="color: #000000"> </span><span style="color: #911c67">class</span><span style="color: #000000"> </span>DataHandle<span style="color: #000000"> : </span><span style="color: #911c67">public</span><span style="color: #000000"> Dune::</span>CommDataHandleIF<span style="color: #000000"><</span>DataHandle<span style="color: #000000"><</span><span style="color: #775843">ElementMapper</span><span style="color: #000000">,</span><span style="color: #775843">Vector</span><span style="color: #000000">>, </span><span style="color: #911c67">typename</span><span style="color: #000000"> </span><span style="color: #775843">Vector</span><span style="color: #000000">::</span>value_type<span style="color: #000000">></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(145, 28, 103); "><span style="color: #000000"> </span>public<span style="color: #000000">:</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><span class="Apple-style-span" style="color: rgb(80, 143, 115); "><span style="color: #000000"> </span><span class="Apple-style-span" style="color: rgb(1, 97, 66); "><span style="color: #911c67">typedef</span><span style="color: #000000"> </span><span style="color: #911c67">typename</span><span style="color: #000000"> </span><span style="color: #775843">Vector</span><span style="color: #000000">::</span>value_type<span style="color: #000000"> </span>DataType<span style="color: #000000">;</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "> <span style="color: #911c67">bool</span> contains (<span style="color: #911c67">int</span> dim, <span style="color: #911c67">int</span> codim) <span style="color: #911c67">const</span> { <span style="color: #911c67">return</span> (codim==0); }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><span class="Apple-style-span" style="color: rgb(80, 143, 115); "><span style="color: #000000"> </span><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span style="color: #911c67">bool</span> fixedsize (<span style="color: #911c67">int</span> dim, <span style="color: #911c67">int</span> codim) <span style="color: #911c67">const </span></span></span>{<span class="Apple-style-span" style="color: rgb(145, 28, 103); "><span style="color: #000000"> </span>return<span style="color: #000000"> </span>true<span style="color: #000000">; </span></span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "> template<span style="color: rgb(0, 0, 0); "><</span><font class="Apple-style-span" color="#911c67">class</font><span style="color: rgb(0, 0, 0); "> </span><span style="color: rgb(119, 88, 67); ">EntityType</span><span style="color: rgb(0, 0, 0); ">></span> <span style="color: #016142">size_t</span> size (<span style="color: #775843">EntityType</span>& e) <span style="color: #911c67">const</span> { <span style="color: #911c67">return</span>(1); }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(119, 88, 67); "><span style="color: #000000"> </span><span style="color: #911c67">template</span><span style="color: #000000"><</span><span style="color: #911c67">class</span><span style="color: #000000"> </span>MessageBuffer<span style="color: #000000">, </span><span style="color: #911c67">class</span><span style="color: #000000"> </span>EntityType<span style="color: #000000">></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span style="color: #911c67">void</span> gather (<span style="color: #775843">MessageBuffer</span>& buff, <span style="color: #911c67">const</span> <span style="color: #775843">EntityType</span>& e) <span style="color: #911c67">const</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span style="color: #911c67">unsigned</span> <span style="color: #911c67">int</span> globalElementIndex=<span style="color: #192ec9">elementMapper_</span>.map(e);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> buff.write(<span style="color: #192ec9">v_</span>[globalElementIndex]);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(80, 143, 115); "><span style="color: #000000"> </span><span class="Apple-style-span" style="color: rgb(119, 88, 67); "><span style="color: #911c67">template</span><span style="color: #000000"><</span><span style="color: #911c67">class</span><span style="color: #000000"> </span>MessageBuffer<span style="color: #000000">, </span><span style="color: #911c67">class</span><span style="color: #000000"> </span>EntityType<span style="color: #000000">></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span style="color: #911c67">void</span> scatter (<span style="color: #775843">MessageBuffer</span>& buff, <span style="color: #911c67">const</span> <span style="color: #775843">EntityType</span>& e, <span style="color: #016142">size_t</span> n)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span style="color: #016142">DataType</span> x;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> buff.read(x);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span style="color: #911c67">unsigned</span> <span style="color: #911c67">int</span> globalElementIndex=<span style="color: #192ec9">elementMapper_</span>.map(e);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span style="color: #192ec9">v_</span>[globalElementIndex] = x;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> }</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(80, 143, 115); "><span style="color: #000000"> </span><span class="Apple-style-span" style="color: rgb(0, 0, 0); ">DataHandle (<span style="color: #911c67">const</span> <span style="color: #775843">ElementMapper</span>& elementMapper, <span style="color: #775843">Vector</span>& v)</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); "> : e<span style="color: #192ec9">lementMapper_</span>(elementMapper),</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); "><span style="color: #192ec9">v_</span>(v)</span><span class="Apple-style-span" style="color: rgb(0, 0, 0); "> {}</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(145, 28, 103); "><span style="color: #000000"> </span>private<span style="color: #000000">:</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(25, 46, 201); "><span style="color: #000000"> </span><span style="color: #911c67">const</span><span style="color: #000000"> </span><span style="color: #775843">ElementMapper</span><span style="color: #000000">& </span>elementMapper_<span style="color: #000000">;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> <span style="color: #775843">Vector</span>& <span style="color: #192ec9">v_</span>;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "> };</div></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div>This works well when variables with type FieldVector (<span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">Dune::</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><span style="color: #016142">FieldVector</span></span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><</span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><span style="color: #016142">double</span></span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">,6></span>) are going to be communicated. However, when I want to communicate DynamicVector (<span class="Apple-style-span" style="color: rgb(1, 97, 66); font-family: Monaco; font-size: 11px; "><span style="color: #000000">Dune::</span></span><span class="Apple-style-span" style="color: rgb(1, 97, 66); font-family: Monaco; font-size: 11px; ">DynamicVector</span><span class="Apple-style-span" style="color: rgb(1, 97, 66); font-family: Monaco; font-size: 11px; "><span style="color: #000000"><</span></span><span class="Apple-style-span" style="color: rgb(1, 97, 66); font-family: Monaco; font-size: 11px; ">double</span><span class="Apple-style-span" style="color: rgb(1, 97, 66); font-family: Monaco; font-size: 11px; "><span style="color: #000000">></span></span>) data, the code stops and I receive an error message. I believe the problem lies in the communication part, since the code with DynamicVector works well on 1 processor. Do you have any idea why such a thing happens? Have you previously faced with this problem?</div><div><br></div><div>Best regards and thanks,</div><div><br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Arya Fallahi, <div>Dr. sc. techn. ETH, </div><div>Computational Accelerator Scientist </div><div>Paul Scherrer Institute (PSI), </div><div>CH-5232 Villigen, Switzerland, </div><div><a href="mailto:arya.fallahi@psi.ch">arya.fallahi@psi.ch</a>, </div><div>+41(0)56 310 50 17<br><br></div></div>
</div>
<br></div></body></html>