//============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. // // Copyright 2014 Sandia Corporation. // Copyright 2014 UT-Battelle, LLC. // Copyright 2014 Los Alamos National Security. // // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, // the U.S. Government retains certain rights in this software. // // Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National // Laboratory (LANL), the U.S. Government retains certain rights in // this software. //============================================================================ #include #include #include #include #include #include namespace { template struct TestKernel : public vtkm::exec::FunctorBase { CellSetInType CellSet; VTKM_EXEC void operator()(vtkm::Id) const { if (this->CellSet.GetNumberOfElements() != 2) { this->RaiseError("Got bad number of shapes in exec cellset object."); } if (this->CellSet.GetIndices(0).GetNumberOfComponents() != 3 || this->CellSet.GetIndices(1).GetNumberOfComponents() != 4 ) { this->RaiseError("Got bad number of Indices in exec cellset object."); } if (this->CellSet.GetCellShape(0).Id != 5 || this->CellSet.GetCellShape(1).Id != 9 ) { this->RaiseError("Got bad cell shape in exec cellset object."); } } }; template void TransportWholeCellSetIn(Device) { //build a fake cell set const int nVerts = 5; vtkm::cont::CellSetExplicit<> contObject("cells"); contObject.PrepareToAddCells(2, 7); contObject.AddCell(vtkm::CELL_SHAPE_TRIANGLE, 3, vtkm::make_Vec(0,1,2)); contObject.AddCell(vtkm::CELL_SHAPE_QUAD, 4, vtkm::make_Vec(2,1,3,4)); contObject.CompleteAddingCells(nVerts); typedef vtkm::TopologyElementTagPoint FromType; typedef vtkm::TopologyElementTagCell ToType; typedef typename vtkm::cont::CellSetExplicit<> ::template ExecutionTypes< Device, FromType, ToType > ::ExecObjectType ExecObjectType; vtkm::cont::arg::Transport< vtkm::cont::arg::TransportTagCellSetIn, vtkm::cont::CellSetExplicit<>, Device> transport; TestKernel kernel; kernel.CellSet = transport(contObject, nullptr, 1, 1); vtkm::cont::DeviceAdapterAlgorithm::Schedule(kernel, 1); } void UnitTestCellSetIn() { std::cout << "Trying CellSetIn transport with serial device." << std::endl; TransportWholeCellSetIn(vtkm::cont::DeviceAdapterTagSerial()); } } // Anonymous namespace int UnitTestTransportCellSetIn(int, char *[]) { return vtkm::cont::testing::Testing::Run(UnitTestCellSetIn); }