//============================================================================ // 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. //============================================================================ #ifndef vtk_m_filter_CellMeasures_hxx #define vtk_m_filter_CellMeasures_hxx #include #include namespace vtkm { namespace filter { //----------------------------------------------------------------------------- template inline VTKM_CONT CellMeasures::CellMeasures() : vtkm::filter::FilterField>() { this->SetUseCoordinateSystemAsField(true); this->SetCellMeasureName("measure"); } //----------------------------------------------------------------------------- template template inline VTKM_CONT vtkm::cont::DataSet CellMeasures::DoExecute( const vtkm::cont::DataSet& input, const vtkm::cont::ArrayHandle, StorageType>& points, const vtkm::filter::FieldMetadata& fieldMeta, const vtkm::filter::PolicyBase& policy) { if (fieldMeta.IsPointField() == false) { throw vtkm::cont::ErrorFilterExecution("CellMeasures expects point field input."); } const auto& cellset = input.GetCellSet(); vtkm::cont::ArrayHandle outArray; this->Invoke(vtkm::worklet::CellMeasure{}, vtkm::filter::ApplyPolicyCellSet(cellset, policy, *this), points, outArray); std::string outputName = this->GetCellMeasureName(); if (outputName.empty()) { // Default name is name of input. outputName = "measure"; } return CreateResultFieldCell(input, outArray, outputName); } } } // namespace vtkm::filter #endif