//============================================================================ // 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 National Technology & Engineering Solutions of Sandia, LLC (NTESS). // Copyright 2014 UT-Battelle, LLC. // Copyright 2014 Los Alamos National Security. // // Under the terms of Contract DE-NA0003525 with NTESS, // 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. //============================================================================ #ifndef vtk_m_filter_PolicyBase_h #define vtk_m_filter_PolicyBase_h #include #include #include #include #include #include #include #include #include namespace vtkm { namespace filter { template struct PolicyBase { using FieldTypeList = VTKM_DEFAULT_TYPE_LIST_TAG; using FieldStorageList = VTKM_DEFAULT_STORAGE_LIST_TAG; using StructuredCellSetList = vtkm::cont::CellSetListTagStructured; using UnstructuredCellSetList = vtkm::cont::CellSetListTagUnstructured; using AllCellSetList = VTKM_DEFAULT_CELL_SET_LIST_TAG; }; //----------------------------------------------------------------------------- template VTKM_CONT vtkm::cont::DynamicArrayHandleBase ApplyPolicy(const vtkm::cont::Field& field, const vtkm::filter::PolicyBase&) { using TypeList = typename DerivedPolicy::FieldTypeList; using StorageList = typename DerivedPolicy::FieldStorageList; return field.GetData().ResetTypeAndStorageLists(TypeList(), StorageList()); } //----------------------------------------------------------------------------- template VTKM_CONT vtkm::cont::DynamicArrayHandleBase< typename vtkm::filter::DeduceFilterFieldTypes::TypeList, typename DerivedPolicy::FieldStorageList> ApplyPolicy(const vtkm::cont::Field& field, const vtkm::filter::PolicyBase&, const vtkm::filter::FilterTraits&) { using TypeList = typename vtkm::filter::DeduceFilterFieldTypes::TypeList; using StorageList = typename DerivedPolicy::FieldStorageList; return field.GetData().ResetTypeAndStorageLists(TypeList(), StorageList()); } //----------------------------------------------------------------------------- template VTKM_CONT vtkm::cont::DynamicCellSetBase ApplyPolicy( const vtkm::cont::DynamicCellSet& cellset, const vtkm::filter::PolicyBase&) { using CellSetList = typename DerivedPolicy::AllCellSetList; return cellset.ResetCellSetList(CellSetList()); } //----------------------------------------------------------------------------- template VTKM_CONT vtkm::cont::DynamicCellSetBase ApplyPolicyStructured(const vtkm::cont::DynamicCellSet& cellset, const vtkm::filter::PolicyBase&) { using CellSetList = typename DerivedPolicy::StructuredCellSetList; return cellset.ResetCellSetList(CellSetList()); } //----------------------------------------------------------------------------- template VTKM_CONT vtkm::cont::DynamicCellSetBase ApplyPolicyUnstructured(const vtkm::cont::DynamicCellSet& cellset, const vtkm::filter::PolicyBase&) { using CellSetList = typename DerivedPolicy::UnstructuredCellSetList; return cellset.ResetCellSetList(CellSetList()); } //----------------------------------------------------------------------------- template VTKM_CONT vtkm::cont::SerializableField MakeSerializableField(const vtkm::filter::PolicyBase&) { return {}; } template VTKM_CONT vtkm::cont::SerializableField MakeSerializableField(const vtkm::cont::Field& field, const vtkm::filter::PolicyBase&) { return vtkm::cont::SerializableField{ field }; } template VTKM_CONT vtkm::cont::SerializableDataSet MakeSerializableDataSet(const vtkm::filter::PolicyBase&) { return {}; } template VTKM_CONT vtkm::cont::SerializableDataSet MakeSerializableDataSet(const vtkm::cont::DataSet& dataset, const vtkm::filter::PolicyBase&) { return vtkm::cont::SerializableDataSet{ dataset }; } } } // vtkm::filter #endif //vtk_m_filter_PolicyBase_h