VTK
vtkSMPToolsInternal.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSMPToolsInternal.h.in
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 namespace vtk
16 {
17 namespace detail
18 {
19 namespace smp
20 {
21 template <typename FunctorInternal>
23  vtkIdType first, vtkIdType last, vtkIdType grain,
24  FunctorInternal& fi)
25 {
26  vtkIdType n = last - first;
27  if (!n)
28  {
29  return;
30  }
31 
32  if (grain == 0 || grain >= n)
33  {
34  fi.Execute(first, last);
35  }
36  else
37  {
38  vtkIdType b = first;
39  while (b < last)
40  {
41  vtkIdType e = b + grain;
42  if (e > last)
43  {
44  e = last;
45  }
46  fi.Execute(b, e);
47  b = e;
48  }
49  }
50 }
51 }
52 }
53 }
int vtkIdType
Definition: vtkType.h:275
static void vtkSMPTools_Impl_For(vtkIdType first, vtkIdType last, vtkIdType grain, FunctorInternal &fi)