[vtk-developers] VTK Hackathon this Thursday
Jon Haitz Legarreta
jhlegarreta at vicomtech.org
Thu Apr 27 12:40:21 EDT 2017
Hi,
although the example in this case does not seem too long to me, reaching a
consensus in terms of what results in a too long code or an overly
complicated example may be hard.
There is already some sort of regression/baseline testing if the test
produces an output in terms of an image/file, right?
Without harm to the idea of steadily adding more tests to/improving the
existing ones, if the examples are the entry-point for newcomers, I
wouldn't add explicit regression in their code.
I'd favor the idea of making clear in the examples what is essential for a
VTK class to be used. Otherwise, if a given class requires a couple or a
few examples to show all of its potential or essential features, I'd add
them as needed.
JON HAITZ
--
On 27 April 2017 at 18:03, Andy Bauer <andy.bauer at kitware.com> wrote:
> Hi,
>
> A thought on these tests -- I'd like to add minimal testing to some of
> them. The thought here being that we both show good coding practice as well
> as verify that the examples work as expected. The concern though is that
> this could make the examples too long and obfuscate what we're trying to
> demonstrate in an example.
>
> Below is what I was thinking for the XMLPUnstructuredGridWriter example (
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/XMLPUnstructuredGridWriter).
> It roughly doubles the amount of lines in the example file.
>
> Thoughts on this? At the VTK hackathon it seems to generally be thought of
> as a good idea but I thought I'd put it out to the full dev list.
>
> Thanks,
> Andy
>
> ================
> #include <vtkDelaunay3D.h>
> #include <vtkSmartPointer.h>
> #include <vtkSphereSource.h>
> #include <vtkUnstructuredGrid.h>
> #include <vtkXMLPUnstructuredGridReader.h>
> #include <vtkXMLPUnstructuredGridWriter.h>
> #include <vtkXMLUnstructuredGridReader.h>
>
> int main(int, char *[])
> {
> vtkSmartPointer<vtkSphereSource> sphereSource =
> vtkSmartPointer<vtkSphereSource>::New();
> sphereSource->Update();
>
> vtkSmartPointer<vtkDelaunay3D> delaunay =
> vtkSmartPointer<vtkDelaunay3D>::New();
> delaunay->SetInputConnection(sphereSource->GetOutputPort());
> delaunay->Update();
>
> vtkSmartPointer<vtkXMLPUnstructuredGridWriter> writer =
> vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New();
> writer->SetInputConnection(delaunay->GetOutputPort());
> writer->SetFileName("Test.pvtu");
> writer->SetNumberOfPieces(4);
> writer->SetStartPiece(0);
> writer->SetEndPiece(3);
> writer->Update();
>
> // We should have created a Test.pvtu and Test_[0-3].vtu.
> // Check that the files exist and have the expected number of cells.
> vtkSmartPointer<vtkXMLPUnstructuredGridReader> preader =
> vtkSmartPointer<vtkXMLPUnstructuredGridReader>::New();
> preader->SetFileName("Test.pvtu");
> preader->Update();
> if (preader->GetOutput()->GetNumberOfCells() != 152)
> {
> cout << "Should have written out 152 cells but got "
> << preader->GetOutput()->GetNumberOfCells() << endl;
> return EXIT_FAILURE;
> }
> for (int i=0;i<4;i++)
> {
> vtkSmartPointer<vtkXMLUnstructuredGridReader> reader =
> vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
> std::string fileName = "Test_" + std::to_string(i) + ".vtu";
> reader->SetFileName(fileName.c_str());
> reader->Update();
> if (reader->GetOutput()->GetNumberOfCells() != 38)
> {
> cout << "Should have written out 38 cells but got "
> << reader->GetOutput()->GetNumberOfCells() << endl;
> return EXIT_FAILURE;
> }
> }
> return EXIT_SUCCESS;
> }
> =====================
>
> On Mon, Apr 24, 2017 at 4:24 PM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>
>> Dave,
>>
>> For those attending the hackathon I suggest they fork the VTK wiki
>> examples repo at https://github.com/lorensen/VTKWikiExamples and build
>> them.
>>
>> Also, I'd like to give a short talk at the beginning of the hackathon
>> to describe the current wiki example background and mechanisms.
>>
>> Thanks,
>>
>> Bill
>>
>>
>> On Mon, Apr 24, 2017 at 10:11 AM, David E DeMarle
>> <dave.demarle at kitware.com> wrote:
>> > I've started a shared doc with some suggestions of things we might work
>> on.
>> > Please improve the list as you see fit.
>> >
>> > https://docs.google.com/document/d/1U6NTAXWkdebcZp_ZhQo2LJm0
>> CBN78LM91yg7oaKgOZ8/edit?usp=sharing
>> >
>> >
>> > David E DeMarle
>> > Kitware, Inc.
>> > R&D Engineer
>> > 21 Corporate Drive
>> > Clifton Park, NY 12065-8662
>> > Phone: 518-881-4909
>> >
>> > On Mon, Apr 24, 2017 at 9:43 AM, David E DeMarle <
>> dave.demarle at kitware.com>
>> > wrote:
>> >>
>> >> Hello,
>> >>
>> >> Just a quick reminder about the upcoming VTK hackathon.
>> >>
>> >> The focus area will be VTK examples. Two different sets of which can be
>> >> found
>> >> here:
>> >> https://gitlab.kitware.com/vtk/vtk/tree/master/Examples
>> >> and here:
>> >> http://www.vtk.org/Wiki/VTK/Examples
>> >>
>> >> We'll start at 9:30 EST time. If you happen to be near Clifton Park,
>> NY,
>> >> USA, drop me a line asap and I'll get you in to the building.
>> >>
>> >> Otherwise you can meet up with everyone online here:
>> >> https://hangouts.google.com/hangouts/_/kitware.com/dave-demarle
>> >>
>> >> David E DeMarle
>> >> Kitware, Inc.
>> >> R&D Engineer
>> >> 21 Corporate Drive
>> >> Clifton Park, NY 12065-8662
>> >> Phone: 518-881-4909
>> >
>> >
>> >
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Search the list archives at: http://markmail.org/search/?q=
>> vtk-developers
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://public.kitware.com/mailman/listinfo/vtk-developers
>> >
>> >
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170427/ff195fbf/attachment-0001.html>
More information about the vtk-developers
mailing list