Open CASCADE Technology  7.1.0.beta
Data Structures

OSD_Parallel Class Reference

Simplifies code parallelization. More...

#include <OSD_Parallel.hxx>

Static Public Member Functions

public methods
static Standard_Integer NbLogicalProcessors ()
 Returns number of logical proccesrs. More...
 
template<typename InputIterator , typename Functor >
static void ForEach (InputIterator theBegin, InputIterator theEnd, const Functor &theFunctor, const Standard_Boolean isForceSingleThreadExecution=Standard_False)
 Simple primitive for parallelization of "foreach" loops. More...
 
template<typename Functor >
static void For (const Standard_Integer theBegin, const Standard_Integer theEnd, const Functor &theFunctor, const Standard_Boolean isForceSingleThreadExecution=Standard_False)
 Simple primitive for parallelization of "for" loops. More...
 

Detailed Description

Simplifies code parallelization.

The Class provides an interface of parallel processing "for" and "foreach" loops. These primitives encapsulates complete logic for creating and managing parallel context of loops. Moreover the primitives may be a wrapper for some primitives from 3rd-party library - TBB. To use it is necessary to implement TBB like interface which is based on functors.

class Functor
{
public:
void operator() ([proccesing instance]) const
{
//...
}
};

In the body of the operator () should be implemented thread-safe logic of computations that can be performed in parallel context. If parallelized loop iterates on the collections with direct access by index (such as Vector, Array), it is more efficient to use the primitive ParallelFor (because it has no critical section).

Member Function Documentation

template<typename Functor >
void OSD_Parallel::For ( const Standard_Integer  theBegin,
const Standard_Integer  theEnd,
const Functor &  theFunctor,
const Standard_Boolean  isForceSingleThreadExecution = Standard_False 
)
static

Simple primitive for parallelization of "for" loops.

template<typename InputIterator , typename Functor >
void OSD_Parallel::ForEach ( InputIterator  theBegin,
InputIterator  theEnd,
const Functor &  theFunctor,
const Standard_Boolean  isForceSingleThreadExecution = Standard_False 
)
static

Simple primitive for parallelization of "foreach" loops.

static Standard_Integer OSD_Parallel::NbLogicalProcessors ( )
static

Returns number of logical proccesrs.


The documentation for this class was generated from the following file: