<div dir="ltr">Hi Max,<div><br></div><div>From your description, it sounds like this change would be very labour-intensive to maintain, since all future uses of floating-point numbers in VTK would have to follow new rules.  But I can definitely understand the benefit of "plug-in" floating point types (I've even used some VTK algorithms with custom fixed-point types in the past).</div><div><br></div><div>Can you host your changes somewhere so that interested parties can try them out and provide feedback?</div><div><br></div><div> - David</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 11, 2015 at 2:22 AM, Max Sagebaum <span dir="ltr"><<a href="mailto:max.sagebaum@scicomp.uni-kl.de" target="_blank">max.sagebaum@scicomp.uni-kl.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear developers,<br>
<br>
we had asked for your opinions about a typedef for the floating point<br>
types in vtk and if we make this change if it would be accepted. Until<br>
now we have received no answer. We would appreciate it, if we could get<br>
some insights about the acceptance of the changes we want to make.<br>
<br>
Best regards,<br>
<br>
Max Sagebaum<br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, 2015-04-20 at 09:04 +0200, Max Sagebaum wrote:<br>
> Dear developers,<br>
> we are currently using parts of the VTK Version 5.10 for our CFD<br>
> Postprocessing Tool. We have successfully modified theses parts to<br>
> facilitate an AD-Tool (Algorithmic Differentiation) to differentiate<br>
> these code parts (intention is to not just get absolute values for our<br>
> CFD-results, but also evaluate sensitivities/gradients). Caused by<br>
> further developments in our tool we would like to go with newer<br>
> VTK-Versions, which means repeating the changes in the code parts<br>
> facilitating AD. We would like to implement these changes into the<br>
> VTK-trunk, to avoid reprogramming and to offer the possibility of using<br>
> AD to everyone. We would like to explain the changes in short and ask<br>
> you to judge if such changes are likely to be accepted or if there is an<br>
> interest in making VTK “AD-able”. If not, we would avoid the presumably<br>
> laborious implementation and would not put it into the Git/Develop loop.<br>
><br>
> There are two main changes we had to make. To get the gradients of a<br>
> program, the AD-Tool defines new AD floating point types which take care<br>
> of the derivative computation. In order to use these AD types in VTK we<br>
> needed to create two typedefs for float and double. Then every usage of<br>
> float and double in VTK was replaced by the new typedefs. With this<br>
> change, it is also possible to other types in VTK. E.g. complex values.<br>
><br>
> The second change we made, was to rename every 'static_cast' call to a<br>
> new function 'perform_cast'. Basically 'perfom_cast' just calls<br>
> 'static_cast'. If you use other types than float or double 'static_cast'<br>
> will complain that the conversion from eg. 'MyFloatType' to 'int' does<br>
> not exist. 'perfom_cast' was specialized for the AD types and therefore<br>
> the casts could be done. During this process we checked most of the<br>
> occurrences of 'static_cast' and validated that the usage will not break<br>
> the differentiation.<br>
> There are two other solutions to our approach. We could implement<br>
> conversion operators for the AD types, which enables 'static_cast' to do<br>
> the conversion. But this is mostly discouraged by the tool developers.<br>
> If the conversion operators are implemented, the compiler starts to<br>
> implicit convert the AD types and very weird things can happen.<br>
> The second approach would define these operators as explicit which would<br>
> prevent the compiler from implicitly converting them. But then VTK would<br>
> need to be compiled with C++11 enabled or if the user changes these<br>
> types he also has to enable C++11 if necessary.<br>
><br>
> Is the any interest on the developers or users side to use VTK with AD<br>
> or other floating point types?<br>
> Thanks for your opinions and judgment!<br>
><br>
> Max Sagebaum<br>
><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Max Sagebaum<br>
<br>
Chair for Scientific Computing,<br>
TU Kaiserslautern,<br>
Bldg/Geb 34, Paul-Ehrlich-Strasse,<br>
67663 Kaiserslautern, Germany<br>
<br>
Phone: <a href="tel:%2B49%20%280%29631%20205%205638" value="+496312055638">+49 (0)631 205 5638</a><br>
Fax:   <a href="tel:%2B49%20%280%29631%20205%203056" value="+496312053056">+49 (0)631 205 3056</a><br>
Email: <a href="mailto:max.sagebaum@scicomp.uni-kl.de">max.sagebaum@scicomp.uni-kl.de</a><br>
URL:   <a href="http://www.scicomp.uni-kl.de" target="_blank">www.scicomp.uni-kl.de</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" target="_blank">http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" target="_blank">http://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br></div>