<div dir="ltr">Oh, I just realized that I forgot the "this" pointer parameter for my function get_item... Shame on me. Whatever, I can now handle a range of dimensions and even several data types!<div>I will now focuse on the unit test (before sending a git patch) and a draft for my proposal.</div><div><br></div><div>Best,</div><div>Michaël</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-16 3:25 GMT-04:00 Michaël Sghaïer <span dir="ltr"><<a href="mailto:sghaier.michael@gmail.com" target="_blank">sghaier.michael@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I have been working on the junior job related to the Python bindings for two days and I have some questions:</div><div><br></div><div>2016-03-15 14:51 GMT-04:00 Andreas Dedner:<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 text="#000000" bgcolor="#FFFFFF">Note that FieldVector derives from DenseVector and many methods that need to be wrapped are implemented there.</div></blockquote><div><br></div><div>Do we have to wrap the methods of DenseVector too or just the methods of FieldVector?</div><div><br></div><div>Until this junior job, I never used Boost.Python. Though I found it very interesting and funny to play with, it's a little tricky to use. Can you confirm me that we can't wrap the following constructors, due to the fact that templates have to be instanciated at compile time:</div><div><br></div><div><br></div><div>template<class C></div><div>FieldVector (const DenseVector<C> &x, ...)</div><div><br></div><div>and</div><div><br></div><div>template<class K1, int SIZE1></div><div>explicit FieldVector(const FieldVector<K1, SIZE1> & x)</div><div><br></div><div>?</div><div><br></div><div>(same for Base::operator= I guess)</div><div><br></div><div>Last question, the junior job says that the wrapper should work with a range of dimensions. I assume that means it should be easy for a user to add a wrapper for a particular dimension (because templates can't be specialized at runtime, through the Python interpreter, right?).</div><div><br></div><div>I tried to define a template<int SIZE> struct registerFieldVector which defines a static function pointer get_item to wrap operator[] but it doesn't work. I have been debugging for hours now and I don't find a solution.</div><div><br></div><div>For example, </div><div><br></div><div><pre style="color:rgb(0,0,0)">static double& (*get_item) (Dune::FieldVector<double, SIZE>::size_type);
<br></pre><pre style="color:rgb(0,0,0)">...</pre><pre style="color:rgb(0,0,0)">template<>
double& (*RegisterFieldVector<7>::get_item) (Dune::FieldVector<double, 7>::size_type = &Dune::FieldVector<double, 7>::operator[];</pre><pre style="color:rgb(0,0,0)">raises the error: "<span style="font-family:arial,sans-serif">error: cannot declare pointer to ‘double&’ in </span><span style="font-family:arial,sans-serif">static double& (*get_item) (Dune::FieldVector<double, SIZE>::size_type);</span><span style="font-family:arial,sans-serif">"</span></pre><pre style="color:rgb(0,0,0)"><br></pre><pre style="color:rgb(0,0,0)">Could you give me any lead?</pre></div><div>Best,</div></div><div>Michaël</div></div>
</blockquote></div><br></div>