Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::ParticleProcess Class Reference

Abstract parallel particle tracing process. More...

#include <mitsuba/render/particleproc.h>

+ Inheritance diagram for mitsuba::ParticleProcess:

Public Types

enum  EMode { ETrace = 0, EGather }
 The particle tracer supports two principal modes of operation. More...
 
- Public Types inherited from mitsuba::ParallelProcess
enum  EStatus { EUnknown, EPause, ESuccess, EFailure }
 Return codes used by generateWork() and getReturnStatus() More...
 
typedef std::map< std::string,
int > 
ResourceBindings
 Binding from local resource names to global resource IDs. More...
 

Public Member Functions

virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
Implementation of the ParallelProcess interface
virtual EStatus generateWork (WorkUnit *unit, int worker)
 Generate a piece of work. More...
 
- Public Member Functions inherited from mitsuba::ParallelProcess
virtual void processResult (const WorkResult *result, bool cancelled)=0
 Called whenever a work unit has been completed. More...
 
virtual void handleCancellation ()
 Called when the parallel process is canceled by Scheduler::cancel(). More...
 
EStatus getReturnStatus () const
 Query the return status of a process after its execution has finished. More...
 
virtual ref< WorkProcessorcreateWorkProcessor () const =0
 Create an instance of the algorithm responsible for executing the work units of this parallel process. More...
 
virtual void bindResource (const std::string &name, int id)
 Bind a resource to this parallel process. More...
 
virtual bool isLocal () const
 Is this process strictly local? More...
 
ELogLevel getLogLevel () const
 Return the log level for events associated with this process. More...
 
const ResourceBindingsgetResourceBindings () const
 Return a list of all bound resources. More...
 
virtual std::vector< std::string > getRequiredPlugins ()
 Return a list of plugins required by this parallel process. More...
 
- Public Member Functions inherited from Object
 Object ()
 Construct a new object. More...
 
int getRefCount () const
 Return the current reference count. More...
 
void incRef () const
 Increase the reference count of the object by one. More...
 
void decRef (bool autoDeallocate=true) const
 Decrease the reference count of the object and possibly deallocate it. More...
 
virtual std::string toString () const
 Return a human-readable string representation of the object's contents. More...
 

Static Public Attributes

static Classm_theClass
 
- Static Public Attributes inherited from mitsuba::ParallelProcess
static Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_theClass
 Pointer to the object's class descriptor. More...
 

Protected Member Functions

 ParticleProcess (EMode mode, size_t workCount, size_t granularity, const std::string &progressText, const void *progressReporterPayload)
 
void increaseResultCount (size_t resultCount)
 
virtual ~ParticleProcess ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from mitsuba::ParallelProcess
 ParallelProcess ()
 Protected constructor. More...
 
virtual ~ParallelProcess ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from Object
virtual ~Object ()
 Virtual private deconstructor. (Will only be called by ref) More...
 

Protected Attributes

EMode m_mode
 
ProgressReporterm_progress
 
size_t m_workCount
 
size_t m_numGenerated
 
size_t m_granularity
 
ref< Mutexm_resultMutex
 
size_t m_receivedResultCount
 
- Protected Attributes inherited from mitsuba::ParallelProcess
ResourceBindings m_bindings
 
EStatus m_returnStatus
 
ELogLevel m_logLevel
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static void staticInitialization ()
 Initializes the built-in reference count debugger (if enabled) More...
 
static void staticShutdown ()
 Free the memory taken by staticInitialization() More...
 

Detailed Description

Abstract parallel particle tracing process.

This class implements a particle tracer similar to what is described in appendix 4.A of Eric Veach's PhD thesis. Particles are emitted from the light source and subsequently perform a random walk that includes both surface and medium scattering events. The work is spread out over multiple cores/machines. For every such event,a custom routine is invoked.

To actually use this class, you must extend it and implement the function createWorkProcessor(), which should return a subclass of ParticleTracer with overridden functions ParticleTracer::handleSurfaceInteraction and ParticleTracer::handleMediumInteraction.

Member Enumeration Documentation

The particle tracer supports two principal modes of operation.

Enumerator
ETrace 

Trace a fixed number of particles.

In this mode, a specified number of particles will be emitted, and a customizable action is performed for every scattering event. Note that the number of resulting events will generally be different from the number of traced particles.

This mode is used for instance by the ptracer plugin.

EGather 

`Gather' a fixed number of scattering events

In this mode, the number of particles to be emitted is unknown ahead of time. Instead, the implementation traces particles until a a certain number of scattering events have been recorded.

This mode is used to create photon maps. See GatherPhotonProcess for an implementation.

Constructor & Destructor Documentation

mitsuba::ParticleProcess::ParticleProcess ( EMode  mode,
size_t  workCount,
size_t  granularity,
const std::string &  progressText,
const void *  progressReporterPayload 
)
protected

Create a new particle process

Parameters
modeParticle tracing mode - see above
workCountTotal # of particles to trace / # events to record
granularityNumber of particles in each work unit. When set to zero, a suitable number will be automatically chosen.
progressTextTitle of the progress bar
progressReporterPayloadCustom pointer payload to be delivered with progress messages
virtual mitsuba::ParticleProcess::~ParticleProcess ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

virtual EStatus mitsuba::ParticleProcess::generateWork ( WorkUnit unit,
int  worker 
)
virtual

Generate a piece of work.

Takes a pre-allocated WorkUnit instance of the appropriate sub-type and size (as specified by ParallelProcess::getWorkUnitName()) and fills it with the appropriate content. Returns ESuccess on success and EFailure or EPause when no more work is left – in that case, the work unit will be ignored and the process completed (EFailure) or temporarily paused (EPause). When EPause was used, resubmission via Scheduler::schedule() will be required once more work is available. In some cases, it is useful to distribute 'nearby' pieces of work to the same processor – the worker parameter can be used to implement this. This function should run as quickly as possible, since it will be executed while the scheduler mutex is held. A thrown exception will lead to the termination of the parallel process.

Parameters
unitWork unit data structure to be filled
workerID of the worker executing this function

Implements mitsuba::ParallelProcess.

Reimplemented in mitsuba::GatherPhotonProcess.

virtual const Class* mitsuba::ParticleProcess::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from mitsuba::ParallelProcess.

Reimplemented in mitsuba::GatherPhotonProcess.

void mitsuba::ParticleProcess::increaseResultCount ( size_t  resultCount)
protected

Member Data Documentation

size_t mitsuba::ParticleProcess::m_granularity
protected
EMode mitsuba::ParticleProcess::m_mode
protected
size_t mitsuba::ParticleProcess::m_numGenerated
protected
ProgressReporter* mitsuba::ParticleProcess::m_progress
protected
size_t mitsuba::ParticleProcess::m_receivedResultCount
protected
ref<Mutex> mitsuba::ParticleProcess::m_resultMutex
protected
Class* mitsuba::ParticleProcess::m_theClass
static
size_t mitsuba::ParticleProcess::m_workCount
protected

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