//============================================================================ // 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_Streamline_hxx #define vtk_m_filter_Streamline_hxx #include #include #include #include #include #include #include #include namespace vtkm { namespace filter { //----------------------------------------------------------------------------- inline VTKM_CONT Streamline::Streamline() : vtkm::filter::FilterDataSetWithField() , UseThreadedAlgorithm(false) { } //----------------------------------------------------------------------------- inline VTKM_CONT void Streamline::SetSeeds(vtkm::cont::ArrayHandle& seeds) { this->Seeds = seeds; } //----------------------------------------------------------------------------- template inline VTKM_CONT vtkm::cont::PartitionedDataSet Streamline::PrepareForExecution( const vtkm::cont::PartitionedDataSet& input, const vtkm::filter::PolicyBase&) { if (this->Seeds.GetNumberOfValues() == 0) throw vtkm::cont::ErrorFilterExecution("No seeds provided."); std::string activeField = this->GetActiveFieldName(); vtkm::filter::particleadvection::BoundsMap boundsMap(input); using DataSetIntegratorType = vtkm::filter::particleadvection::DataSetIntegrator; std::vector dsi; for (vtkm::Id i = 0; i < input.GetNumberOfPartitions(); i++) { vtkm::Id blockId = boundsMap.GetLocalBlockId(i); dsi.push_back(DataSetIntegratorType(input.GetPartition(i), blockId, activeField)); } using AlgorithmType = vtkm::filter::particleadvection::StreamlineAlgorithm; using ThreadedAlgorithmType = vtkm::filter::particleadvection::StreamlineThreadedAlgorithm; if (this->UseThreadedAlgorithm) return vtkm::filter::particleadvection::RunAlgo( boundsMap, dsi, this->NumberOfSteps, this->StepSize, this->Seeds); else return vtkm::filter::particleadvection::RunAlgo( boundsMap, dsi, this->NumberOfSteps, this->StepSize, this->Seeds); } //----------------------------------------------------------------------------- template inline VTKM_CONT bool Streamline::MapFieldOntoOutput(vtkm::cont::DataSet&, const vtkm::cont::Field&, vtkm::filter::PolicyBase) { return false; } } } // namespace vtkm::filter #endif