<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 5, 2013 at 2:33 PM, Teemu Murtola <span dir="ltr">&lt;<a href="mailto:teemu.murtola@iki.fi" target="_blank">teemu.murtola@iki.fi</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<div>
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><br>
<br>
Actually that suggestion is very non-std like. It combines access to the<br>
complete range of coordinates ,with the algorithm (copy), and thus is<br>
less flexible because these two things can&#39;t be combined differently.<br>
So it might be better to provide: &quot;iterator xBegin()&quot; and &quot;iterator<br>
xEnd()&quot;. That would allow to copy using:<br>
&quot;std::copy(sel.xBegin(),sel.<u></u>xEnd(),out)&quot;.<br>
</div>
</div>
</blockquote>
</blockquote>
<div> </div>
</div><div>I think the best way is to provide a method like ConstArrayRef&lt;rvec&gt; positionArray() const, which automatically gives those iterators as well. Haven&#39;t tried this, but this should compile. </div></div>

</div></div></div></blockquote><div style>That is indeed better. And much simpler. I didn&#39;t realize that the positions are stored in gmx_ana_pos_t::x  and that it is contiguous. I had assumed that the storage is a structs of positions (x,v,f,x,v,f, ..... ) and thus thought it would be more difficult.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"><div class="gmail_extra">
<div class="gmail_quote">
<div>But using std::copy() on a container of rvecs doesn&#39;t work,
 because rvec is not copyable or assignable. This part still needs work, but is a more general problem than just in the analysis framework.</div></div></div></div></div></blockquote><div style>You&#39;re right. One of the reasons why we need to decide ASAP on a rvec replacement/extension.</div>

<div style><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"><div class="gmail_extra">

<div class="gmail_quote"><div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>
<div>But I&#39;m not sure we discussed how much we want to make use of iterators.<br>
Our modified version changes that mpp uses iterators and we think it got<br>
better/more flexible by doing that. I think Teemu tried to avoid them.<br>
</div>
</div>
</blockquote>
</blockquote>
<div><br>
</div>
</div><div>You are probably referring to <a href="http://redmine.gromacs.org/issues/856" target="_blank">
http://redmine.gromacs.org/issues/856</a>.</div></div></div></div></div></blockquote><div style>Actually I had forgotten about that. I was commenting on the fact that you haven&#39;t implemented many custom iterators.</div>

<div style> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div dir="ltr"><div class="gmail_extra">

<div class="gmail_quote"><div> Overall, iterators are nice (and several classes in the code provide iterator access or take iterators as parameters), but for that particular case would have been tricky to implement (and would still not have strictly
 fulfilled the strict requirements for an iterator). Also, I&#39;m using iterators extensively for loopring over containers.</div><div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Iterators are not mentioned at all on <a href="http://www.gromacs.org/index.php?title=Developer_Zone/Programming_Guide/Allowed_C%2B%2B_Features" target="_blank">
http://www.gromacs.org/index.<u></u>php?title=Developer_Zone/<u></u>Programming_Guide/Allowed_C%<u></u>2B%2B_Features</a></blockquote>
<div><br>
</div>
</div><div>It does mention that &quot;do use STL&quot;. ;) And STL uses iterators extensively. I see no reason to limit using iterators defined in STL, nor implementing simple iterators for our custom classes. But creating very complex iterators may not classify as
 &quot;simple C++&quot;.</div></div></div></div></div></blockquote><div><br></div><div style>I agree. <br></div><div style><br></div><div style>Roland</div></div><br><br clear="all"><div><br></div>-- <br>ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov" target="_blank">cmb.ornl.gov</a><br>

<a href="tel:865-241-1537" value="+18652411537" target="_blank">865-241-1537</a>, ORNL PO BOX 2008 MS6309
</div></div>