16#ifndef vtkSMPToolsAPI_h
17#define vtkSMPToolsAPI_h
19#include "vtkCommonCoreModule.h"
27#if VTK_SMP_ENABLE_SEQUENTIAL
28#include "SMP/Sequential/vtkSMPToolsImpl.txx"
30#if VTK_SMP_ENABLE_STDTHREAD
31#include "SMP/STDThread/vtkSMPToolsImpl.txx"
34#include "SMP/TBB/vtkSMPToolsImpl.txx"
36#if VTK_SMP_ENABLE_OPENMP
37#include "SMP/OpenMP/vtkSMPToolsImpl.txx"
83 template <
typename Config,
typename T>
86 const Config oldConfig(*
this);
101 template <
typename FunctorInternal>
104 switch (this->ActivatedBackend)
107 this->SequentialBackend->For(first, last, grain, fi);
110 this->STDThreadBackend->For(first, last, grain, fi);
113 this->TBBBackend->For(first, last, grain, fi);
116 this->OpenMPBackend->For(first, last, grain, fi);
122 template <
typename InputIt,
typename OutputIt,
typename Functor>
123 void Transform(InputIt inBegin, InputIt inEnd, OutputIt outBegin, Functor& transform)
125 switch (this->ActivatedBackend)
128 this->SequentialBackend->Transform(inBegin, inEnd, outBegin, transform);
131 this->STDThreadBackend->Transform(inBegin, inEnd, outBegin, transform);
134 this->TBBBackend->Transform(inBegin, inEnd, outBegin, transform);
137 this->OpenMPBackend->Transform(inBegin, inEnd, outBegin, transform);
143 template <
typename InputIt1,
typename InputIt2,
typename OutputIt,
typename Functor>
145 InputIt1 inBegin1, InputIt1 inEnd, InputIt2 inBegin2, OutputIt outBegin, Functor& transform)
147 switch (this->ActivatedBackend)
150 this->SequentialBackend->Transform(inBegin1, inEnd, inBegin2, outBegin, transform);
153 this->STDThreadBackend->Transform(inBegin1, inEnd, inBegin2, outBegin, transform);
156 this->TBBBackend->Transform(inBegin1, inEnd, inBegin2, outBegin, transform);
159 this->OpenMPBackend->Transform(inBegin1, inEnd, inBegin2, outBegin, transform);
165 template <
typename Iterator,
typename T>
168 switch (this->ActivatedBackend)
171 this->SequentialBackend->Fill(begin, end,
value);
174 this->STDThreadBackend->Fill(begin, end,
value);
177 this->TBBBackend->Fill(begin, end,
value);
180 this->OpenMPBackend->Fill(begin, end,
value);
186 template <
typename RandomAccessIterator>
187 void Sort(RandomAccessIterator begin, RandomAccessIterator end)
189 switch (this->ActivatedBackend)
192 this->SequentialBackend->Sort(begin, end);
195 this->STDThreadBackend->Sort(begin, end);
198 this->TBBBackend->Sort(begin, end);
201 this->OpenMPBackend->Sort(begin, end);
207 template <
typename RandomAccessIterator,
typename Compare>
208 void Sort(RandomAccessIterator begin, RandomAccessIterator end, Compare comp)
210 switch (this->ActivatedBackend)
213 this->SequentialBackend->Sort(begin, end, comp);
216 this->STDThreadBackend->Sort(begin, end, comp);
219 this->TBBBackend->Sort(begin, end, comp);
222 this->OpenMPBackend->Sort(begin, end, comp);
236 void RefreshNumberOfThread();
241 template <
typename Config>
244 this->Initialize(config.MaxNumberOfThreads);
245 this->SetBackend(config.Backend.c_str());
246 this->SetNestedParallelism(config.NestedParallelism);
258 int DesiredNumberOfThread = 0;
263#if VTK_SMP_ENABLE_SEQUENTIAL
264 std::unique_ptr<vtkSMPToolsImpl<BackendType::Sequential>> SequentialBackend;
266 std::unique_ptr<vtkSMPToolsDefaultImpl> SequentialBackend;
272#if VTK_SMP_ENABLE_STDTHREAD
273 std::unique_ptr<vtkSMPToolsImpl<BackendType::STDThread>> STDThreadBackend;
275 std::unique_ptr<vtkSMPToolsDefaultImpl> STDThreadBackend;
281#if VTK_SMP_ENABLE_TBB
282 std::unique_ptr<vtkSMPToolsImpl<BackendType::TBB>> TBBBackend;
284 std::unique_ptr<vtkSMPToolsDefaultImpl> TBBBackend;
290#if VTK_SMP_ENABLE_OPENMP
291 std::unique_ptr<vtkSMPToolsImpl<BackendType::OpenMP>> OpenMPBackend;
293 std::unique_ptr<vtkSMPToolsDefaultImpl> OpenMPBackend;
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)