1 //============================================================================
2 //  Copyright (c) Kitware, Inc.
3 //  All rights reserved.
4 //  See LICENSE.txt for details.
5 //  This software is distributed WITHOUT ANY WARRANTY; without even
6 //  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7 //  PURPOSE.  See the above copyright notice for more information.
8 //
9 //  Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
10 //  Copyright 2014 UT-Battelle, LLC.
11 //  Copyright 2014 Los Alamos National Security.
12 //
13 //  Under the terms of Contract DE-NA0003525 with NTESS,
14 //  the U.S. Government retains certain rights in this software.
15 //
16 //  Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
17 //  Laboratory (LANL), the U.S. Government retains certain rights in
18 //  this software.
19 //============================================================================
20 
21 #include <vtkm/io/writer/VTKDataSetWriter.h>
22 
23 #include <vtkm/cont/testing/MakeTestDataSet.h>
24 #include <vtkm/cont/testing/Testing.h>
25 
26 namespace
27 {
28 
TestVTKExplicitWrite()29 void TestVTKExplicitWrite()
30 {
31   vtkm::cont::testing::MakeTestDataSet tds;
32 
33   vtkm::io::writer::VTKDataSetWriter writer1("fileA1.vtk");
34   writer1.WriteDataSet(tds.Make3DExplicitDataSet0());
35 
36   // force it to output an explicit grid as points
37   vtkm::io::writer::VTKDataSetWriter writer2("fileA2.vtk");
38   writer2.WriteDataSet(tds.Make3DExplicitDataSet0(), -1);
39 
40   vtkm::io::writer::VTKDataSetWriter writer3("fileA3.vtk");
41   writer3.WriteDataSet(tds.Make3DExplicitDataSet0());
42 
43   vtkm::io::writer::VTKDataSetWriter writer4("fileA4.vtk");
44   writer4.WriteDataSet(tds.Make3DExplicitDataSetCowNose());
45 }
46 
TestVTKUniformWrite()47 void TestVTKUniformWrite()
48 {
49   vtkm::cont::testing::MakeTestDataSet tds;
50 
51   vtkm::io::writer::VTKDataSetWriter writer1("fileB1.vtk");
52   writer1.WriteDataSet(tds.Make2DUniformDataSet0());
53 
54   vtkm::io::writer::VTKDataSetWriter writer2("fileB2.vtk");
55   writer2.WriteDataSet(tds.Make3DUniformDataSet0());
56 
57   // force it to output an explicit grid as points
58   vtkm::io::writer::VTKDataSetWriter writer3("fileB3.vtk");
59   writer3.WriteDataSet(tds.Make3DUniformDataSet0(), -1);
60 }
61 
TestVTKWrite()62 void TestVTKWrite()
63 {
64   TestVTKExplicitWrite();
65   TestVTKUniformWrite();
66 }
67 
68 } //Anonymous namespace
69 
UnitTestVTKDataSetWriter(int,char * [])70 int UnitTestVTKDataSetWriter(int, char* [])
71 {
72   return vtkm::cont::testing::Testing::Run(TestVTKWrite);
73 }
74