VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Accelerators/Dax/vtkDaxDetailCommon.h
Go to the documentation of this file.
00001 //=============================================================================
00002 //
00003 //  Copyright (c) Kitware, Inc.
00004 //  All rights reserved.
00005 //  See LICENSE.txt for details.
00006 //
00007 //  This software is distributed WITHOUT ANY WARRANTY; without even
00008 //  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00009 //  PURPOSE.  See the above copyright notice for more information.
00010 //
00011 //  Copyright 2012 Sandia Corporation.
00012 //  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00013 //  the U.S. Government retains certain rights in this software.
00014 //
00015 //=============================================================================
00016 
00017 #ifndef vtkDaxDetailCommon_h
00018 #define vtkDaxDetailCommon_h
00019 
00020 #include "vtkCellTypes.h"
00021 #include "vtkDataSet.h"
00022 #include "vtkGenericCell.h"
00023 #include "vtkNew.h"
00024 
00025 namespace vtkDax {
00026 namespace detail {
00027   struct CellTypeInDataSet
00028     {
00029     explicit CellTypeInDataSet(int cellType):
00030       Cell(vtkGenericCell::InstantiateCell(cellType)){}
00031     ~CellTypeInDataSet(){this->Cell->Delete();}
00032     vtkCell* Cell;
00033     };
00034 
00035   //returns if a dataset can be used from within Dax
00036   inline CellTypeInDataSet cellType(vtkDataSet* input)
00037   {
00038     //determine the cell types that the dataset has
00039     vtkNew<vtkCellTypes> cellTypes;
00040     input->GetCellTypes(cellTypes.GetPointer());
00041 
00042     if(cellTypes->GetNumberOfTypes() > 1)
00043       {
00044       //we currently only support a single cell type
00045       return CellTypeInDataSet(VTK_EMPTY_CELL);
00046       }
00047 
00048     return CellTypeInDataSet(cellTypes->GetCellType(0));
00049   }
00050 }}
00051 #endif // DaxDetailCommon_h
00052 // VTK-HeaderTest-Exclude: vtkDaxDetailCommon.h