<div dir='auto'><div>Hi Will<br><div><div class="elided-text"><br type="attribution"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'verdana' , sans-serif">I think what you proposes has a lot of merit. However I start getting twitchy when I think what this means in terms of wrapping code, potential API changes, documentation changes, etc. although maybe it has little impact. </div></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">As far as wrapper code is concerned, I expect no problems, as I'm not suggesting moving away from a single inheritance model (in fact that would be disastrous) and Python, Java & c# support the <i>interface</i> concept.</div><div dir="auto"><br></div><div dir="auto"><div><div class="elided-text"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div style="font-family:'verdana' , sans-serif">(FYI we actually did try multiple inheritance in the 1993-94 time frame when we first started implementing in C++ - a very bad experience due to the awful compilers at that time.) I think for something like this to move forward a proof of concept is required to better understand what the impact on VTK would be.</div></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">The plan would be to add only<i> abstract</i> classes, so that the implementation code would appear on vtkObject descendant classes which are already in the inheritance tree. So documentation should also not be an issue. You can see an example of this in the previously mentioned MR with the GetNumberOfPointsOnFace() method which is implemented in vtkCell3D and the relevant non-linear cell types via the introduction of the<i> </i>vtkCellWithFaces interface/class.</div><div dir="auto"><br></div><div dir="auto">In fact vtkCell3D would also benefit from similar refactoring, as it is already polluted by methods like GetFacePoints() and GetEdgePoints().</div><div dir="auto"><br></div><div dir="auto">Todd</div><div dir="auto"><br></div><div dir="auto">vtkn Tue, Jul 3, 2018 at 11:08 PM Todd Martin via vtk-developers <<a href="mailto:vtk-developers@public.kitware.com">vtk-developers@public.kitware.com</a>> wrote:</div><div dir="auto"><div><div class="elided-text"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="elided-text"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:'helvetica neue' , 'helvetica' , 'arial' , sans-serif;font-size:16px"><div style="font-family:'helvetica neue' , 'helvetica' , 'arial' , sans-serif;font-size:16px"><div><div>Hi Bill<br><div><br>I'm familiar with generics, but it doesn't address the issue here. Defining a base class with knowledge of the behaviour or attributes of its descendant classes is a violation of the Polymorphism principle.<br></div></div><div><br></div><div><div style="font-size:16px;font-family:'helvetica' , 'arial' , sans-serif"><div>Todd Martin, PhD.<br></div><div><i>Freelance Engineer/Software Architect.</i></div><br></div></div></div>
<div><br></div><div><br></div>
</div><div>
<div style="font-family:'helvetica neue' , 'helvetica' , 'arial' , sans-serif;font-size:13px;color:#26282a">
<div>
On Tuesday, July 3, 2018, 3:06:56 PM GMT+12, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com">bill.lorensen@gmail.com</a>> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div><div><div dir="ltr">You may want to look at generic programming to solve your problem.<div><a shape="rect" href="http://www.cs.rpi.edu/~musser/gp/GPtutorial/GPtutorial-print.pdf">http://www.cs.rpi.edu/~musser/gp/GPtutorial/GPtutorial-print.pdf</a><br clear="none"></div></div><div><br clear="none"><div>On Mon, Jul 2, 2018 at 4:31 PM, Todd via vtk-developers <span dir="ltr"><<a shape="rect" href="mailto:vtk-developers@public.kitware.com">vtk-developers@public.kitware.com</a>></span> wrote:<br clear="none"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div><br clear="none"><div><br clear="none"><div>On 3 Jul 2018 9:07 a.m., Paul Douglas Hahn <<a shape="rect" href="mailto:pdhahn@compintensehpc.com">pdhahn@compintensehpc.com</a>> wrote:<br clear="none"><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
revise "base classes" -> "interface classes"<br clear="none">
<br clear="none">
<div>On 07/02/2018 04:04 PM, Paul Douglas
Hahn wrote:<br clear="none">
</div>
<blockquote>
Just one caveat (you probably already know and agree with this).
In my experience using C++ multiple inheritance, I think you
should try to avoid situations where you have common base classes
in the inheritance pathways. Virtual base classes are the usual
recommendation to resolve certain problems that arise in such
cases, but IMHO having experience with that, I generally recommend
against it.<br clear="none">
<br clear="none">
So I recommend your base classes should be of the "<u>mix-in</u>"
interface category, not relaying on any common base class. The
approach works fine for me in almost every situation.<br clear="none">
</blockquote></div></blockquote></div></div></div><div><br clear="none"></div><div>Thanks Paul. That sounds exactly like what I have done with the vtkCellWithEdges and vtkCellWithFaces classes introduced in the aforementioned merge request.</div><div><div><div><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div><blockquote><br clear="none">
- Paul<br clear="none">
<br clear="none">
<div>On 07/02/2018 12:44 AM, Todd Martin
via vtk-developers wrote:<br clear="none">
</div>
<blockquote>
<div style="font-family:'helvetica neue' , 'helvetica' , 'arial' , sans-serif;font-size:16px">
<div style="font-family:'helvetica neue' , 'helvetica' , 'arial' , sans-serif;font-size:16px">
<div>
<div>Single inheritance languages like Java and C# utilize
<i>interfaces</i> extensively. Python 2.7+ handles the
same concept with abstract base classes, ABCs.<br clear="none">
<div><br clear="none">
<div>
<div>
<div>Is there any interest in supporting<i>
interfaces</i> in VTK via multiple inheritance
from abstract classes (which do not inherit from
vtkObject) while retaining the single
inheritance model?<br clear="none">
<div><br clear="none">
In my view there are good reasons to do so.
For example vtkCell has methods like
GetNumberOfEdges(), GetEdge(),
GetNumberOfFaces(), GetFace() etc. which
really only apply to multi-dimensional cells
(both linear and non-linear); i.e. not points
and lines. These methods are forced on the
base class design by a single inheritance
structure and the linear/non-linear cell
sub-types. In my view it would be better if
they were distributed across the sub-classes
via the concept of interfaces. So I'm
suggesting a limited use of multiple
inheritance here, not a free-for-all approach.
What do others think about this?<br clear="none">
<div>
<div>
<div>
<div><br clear="none">
</div>
For an example please see this merge
request <a shape="rect" href="https://gitlab.kitware.com/vtk/vtk/merge_requests/4372">Add missing
size hints and bug fix point arrays
for non-linear cells (!4372) · Merge
Requests · VTK / VTK</a></div>
</div>
</div>
</div>
</div>
</div>
<div><br clear="none">
</div>
<div style="max-width:400px;font-family:'neue' 'segoe ui arial' , sans-serif"><a shape="rect" href="https://gitlab.kitware.com/vtk/vtk/merge_requests/4372" style="text-decoration:none !important;color:#000 !important">
<table style="max-width:400px" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td colspan="1" rowspan="1" width="400">
<table style="max-width:400px;border-width:1px;border-style:solid;border-color:rgb( 224 , 228 , 233 );border-radius:2px" width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td colspan="1" rowspan="1" style="background-color:rgb( 0 , 0 , 0 );background-repeat:no-repeat;border-radius:2px 2px 0px 0px;min-height:175px" valign="top" height="175" bgcolor="#000000">
<table style="width:100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td colspan="1" rowspan="1" style="background-color:transparent;border-radius:2px 2px 0px 0px;min-height:175px" valign="top" bgcolor="transparent">
<table style="width:100%;min-height:175px" border="0"><tbody><tr><td colspan="1" rowspan="1" style="text-align:left;padding:15px 0 0 15px;vertical-align:top"><br clear="none">
</td><td colspan="1" rowspan="1" style="text-align:right;padding:15px 15px 0 0;vertical-align:top"><br clear="none">
</td></tr></tbody></table>
</td></tr></tbody></table>
</td></tr><tr><td colspan="1" rowspan="1">
<table style="background-color:rgb( 255 , 255 , 255 );background-image:none;background-repeat:repeat;width:100%;max-width:400px;border-radius:0px 0px 2px 2px;border-top:1px solid rgb( 224 , 228 , 233 )" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td colspan="1" rowspan="1" style="background-color:#ffffff;padding:16px 0 16px 12px;vertical-align:top;border-radius:0 0 0 2px"><br clear="none">
</td><td colspan="1" rowspan="1" style="vertical-align:middle;padding:12px 24px 16px 12px;width:99%;font-family:'neue' 'segoe ui arial' , sans-serif;border-radius:0 0 2px 0">
<h2 style="font-size:14px;line-height:19px;margin:0 0 6px 0;font-family:'neue' 'segoe ui' , 'helvetica' , 'arial' , sans-serif;color:#26282a">Add
missing size hints and
bug fix point arrays
for non-linear cells
(!4...</h2>
<p style="font-size:12px;line-height:16px;margin:0px;color:#979ba7">I've
added size hints for
concrete public
methods
GetParametricCoords(),
GetEdgePoints() and
GetFacePoints() in ...</p>
</td></tr></tbody></table>
</td></tr></tbody></table>
</td></tr></tbody></table>
</a></div>
<div><br clear="none">
</div>
<div><br clear="none">
</div>
</div>
</div>
</div>
<div><br clear="none">
</div>
<div>
<div style="font-size:16px;font-family:'helvetica' , 'arial' , sans-serif">
<div>Todd Martin, PhD.<br clear="none">
</div>
<div><i>Freelance Engineer/Software Architect.</i></div>
<br clear="none">
</div>
</div>
</div>
</div>
</div>
<br clear="none">
<fieldset></fieldset>
<br clear="none">
<pre>______________________________ _________________
Powered by <a shape="rect" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a shape="rect" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/ opensource/opensource.html</a>
Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtk-developers">http://markmail.org/search/?q= vtk-developers</a>
Follow this link to subscribe/unsubscribe:
<a shape="rect" href="https://public.kitware.com/mailman/listinfo/vtk-developers">https://public.kitware.com/ mailman/listinfo/vtk- developers</a>
</pre>
</blockquote>
<br clear="none">
<br clear="none">
<pre>--
Paul D. Hahn
CompIntense HPC, LLC
</pre>
</blockquote>
<br clear="none">
<br clear="none">
<pre>--
Paul D. Hahn
CompIntense HPC, LLC
</pre>
</div>
</blockquote></div><br clear="none"></div></div></div></div><br clear="none">______________________________ _________________<br clear="none">
Powered by <a shape="rect" href="http://www.kitware.com">www.kitware.com</a><br clear="none">
<br clear="none">
Visit other Kitware open-source projects at <a shape="rect" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/ opensource/opensource.html</a><br clear="none">
<br clear="none">
Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtk-developers">http://markmail.org/search/?q= vtk-developers</a><br clear="none">
<br clear="none">
Follow this link to subscribe/unsubscribe:<br clear="none">
<a shape="rect" href="https://public.kitware.com/mailman/listinfo/vtk-developers">https://public.kitware.com/ mailman/listinfo/vtk- developers</a><br clear="none">
<br clear="none">
<br clear="none"></blockquote></div><br clear="none"><br clear="all"><div><br clear="none"></div>-- <br clear="none"><div>Unpaid intern in BillsParadise at noware dot com</div>
</div></div></div></div>
</div>
</div></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers">http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/vtk-developers">https://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" data-smartmail="gmail_signature"><div dir="ltr"><div>William J. Schroeder, PhD<br>Kitware, Inc. - Building the World's Technical Computing Software<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com">will.schroeder@kitware.com</a><br><a href="http://www.kitware.com">http://www.kitware.com</a><br>(518) 881-4902</div></div></div>
</blockquote></div><br></div></div></div>