[vtk-developers] VTK Hackathon this Thursday

Andy Bauer andy.bauer at kitware.com
Thu Apr 27 12:03:51 EDT 2017


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_
> ZhQo2LJm0CBN78LM91yg7oaKgOZ8/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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170427/7dd124a0/attachment.html>


More information about the vtk-developers mailing list