<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Feb 5, 2013 at 3:21 PM, David van der Spoel <span dir="ltr"><<a href="mailto:spoel@xray.bmc.uu.se" target="_blank">spoel@xray.bmc.uu.se</a>></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 class="im">On 2013-02-05 20:59, Roland Schulz wrote:<br>
><br>
><br>
><br>
> On Tue, Feb 5, 2013 at 2:33 PM, Teemu Murtola <<a href="mailto:teemu.murtola@iki.fi">teemu.murtola@iki.fi</a><br>
</div><div class="im">> <mailto:<a href="mailto:teemu.murtola@iki.fi">teemu.murtola@iki.fi</a>>> wrote:<br>
><br>
><br>
><br>
> Actually that suggestion is very non-std like. It combines<br>
> access to the<br>
> complete range of coordinates ,with the algorithm (copy),<br>
> and thus is<br>
> less flexible because these two things can't be combined<br>
> differently.<br>
> So it might be better to provide: "iterator xBegin()" and<br>
> "iterator<br>
> xEnd()". That would allow to copy using:<br>
</div>> "std::copy(sel.xBegin(),sel.__xEnd(),out)".<br>
<div><div class="h5">><br>
> I think the best way is to provide a method like ConstArrayRef<rvec><br>
> positionArray() const, which automatically gives those iterators as<br>
> well. Haven't tried this, but this should compile.<br>
><br>
> That is indeed better. And much simpler. I didn't realize that the<br>
> positions are stored in gmx_ana_pos_t::x and that it is contiguous. I<br>
> had assumed that the storage is a structs of positions (x,v,f,x,v,f,<br>
> ..... ) and thus thought it would be more difficult.<br>
><br>
> But using std::copy() on a container of rvecs doesn't work, because<br>
> rvec is not copyable or assignable. This part still needs work, but<br>
> is a more general problem than just in the analysis framework.<br>
><br>
> You're right. One of the reasons why we need to decide ASAP on a rvec<br>
> replacement/extension.<br>
><br>
><br>
> But I'm not sure we discussed how much we want to make use<br>
> of iterators.<br>
> Our modified version changes that mpp uses iterators and we<br>
> think it got<br>
> better/more flexible by doing that. I think Teemu tried to<br>
> avoid them.<br>
><br>
><br>
> You are probably referring to <a href="http://redmine.gromacs.org/issues/856" target="_blank">http://redmine.gromacs.org/issues/856</a>.<br>
><br>
> Actually I had forgotten about that. I was commenting on the fact that<br>
> you haven't implemented many custom iterators.<br>
><br>
> Overall, iterators are nice (and several classes in the code provide<br>
> iterator access or take iterators as parameters), but for that<br>
> particular case would have been tricky to implement (and would still<br>
> not have strictly fulfilled the strict requirements for an<br>
> iterator). Also, I'm using iterators extensively for loopring over<br>
> containers.<br>
><br>
><br>
> Iterators are not mentioned at all on<br>
</div></div>> <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.__php?title=Developer_Zone/__Programming_Guide/Allowed_C%__2B%2B_Features</a><br>
<div class="im">> <<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.php?title=Developer_Zone/Programming_Guide/Allowed_C%2B%2B_Features</a>><br>
><br>
><br>
> It does mention that "do use STL". ;) And STL uses iterators<br>
> extensively. I see no reason to limit using iterators defined in<br>
> STL, nor implementing simple iterators for our custom classes. But<br>
> creating very complex iterators may not classify as "simple C++".<br>
><br>
><br>
> I agree.<br>
<br>
</div>Looking at <a href="http://www.cplusplus.com/reference/stl/" target="_blank">http://www.cplusplus.com/reference/stl/</a><br>
<br>
To be on the safe side we can/should probably limit ourselves to C++98?<br></blockquote><div style>Yes. Unless can also be made available to C++03/98 (same thing), like shared_ptr and gmx_unique_ptr and is approved.</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">
But is this the same as the example I mentioned using<br>
<br>
std::vector<MyClass>::iterator ?<br></blockquote><div style>Not sure what you mean. <span style="color:rgb(80,0,80)">ConstArrayRef (</span><font color="#500050"><a href="http://jenkins.gromacs.org/job/Doxygen_Gerrit_master/javadoc/html-full/classgmx_1_1ConstArrayRef.html">http://jenkins.gromacs.org/job/Doxygen_Gerrit_master/javadoc/html-full/classgmx_1_1ConstArrayRef.html</a>) is written by Teemu and gives a C++ interface (including iterators) to a standard c array. So it isn't part of the stl but behaves mostly like a readonly std::vector.</font></div>
<div style><font color="#500050"><br></font></div><div style><font color="#500050">Roland</font></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">
<br>
<br>
><br>
> Roland<br>
><br>
><br>
<span class=""><font color="#888888">><br>
> --<br>
> ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov" target="_blank">cmb.ornl.gov</a> <<a href="http://cmb.ornl.gov" target="_blank">http://cmb.ornl.gov</a>><br>
> <a href="tel:865-241-1537" value="+18652411537">865-241-1537</a> <tel:<a href="tel:865-241-1537" value="+18652411537">865-241-1537</a>>, ORNL PO BOX 2008 MS6309<br>
</font></span><div class="im">><br>
><br>
<br>
<br>
--<br>
David van der Spoel, Ph.D., Professor of Biology<br>
Dept. of Cell & Molec. Biol., Uppsala University.<br>
Box 596, 75124 Uppsala, Sweden. Phone: <a href="tel:%2B46184714205" value="+46184714205">+46184714205</a>.<br>
<a href="mailto:spoel@xray.bmc.uu.se">spoel@xray.bmc.uu.se</a> <a href="http://folding.bmc.uu.se" target="_blank">http://folding.bmc.uu.se</a><br>
</div><div class=""><div class="h5">--<br>
gmx-developers mailing list<br>
<a href="mailto:gmx-developers@gromacs.org">gmx-developers@gromacs.org</a><br>
<a href="http://lists.gromacs.org/mailman/listinfo/gmx-developers" target="_blank">http://lists.gromacs.org/mailman/listinfo/gmx-developers</a><br>
Please don't post (un)subscribe requests to the list. Use the<br>
www interface or send it to <a href="mailto:gmx-developers-request@gromacs.org">gmx-developers-request@gromacs.org</a>.<br>
<br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov">cmb.ornl.gov</a><br>865-241-1537, ORNL PO BOX 2008 MS6309
</div></div>