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

Process for parallel photon map construction. More...

#include <mitsuba/render/gatherproc.h>

+ Inheritance diagram for mitsuba::GatherPhotonProcess:

Public Types

enum  EGatherType { ESurfacePhotons, ECausticPhotons, EAllSurfacePhotons, EVolumePhotons }
 
- Public Types inherited from mitsuba::ParticleProcess
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

 GatherPhotonProcess (EGatherType type, size_t photonCount, size_t granularity, int maxDepth, int rrDepth, bool isLocal, bool autoCancel, const void *progressReporterPayload)
 
PhotonMapgetPhotonMap ()
 
size_t getExcessPhotons () const
 Return the number of discarded photons. More...
 
size_t getShotParticles () const
 Lists the nuber of particles that had to be shot in order to fill the photon map. More...
 
virtual const ClassgetClass () const
 Retrieve this object's class. More...
 
ParallelProcess implementation
bool isLocal () const
 Is this process strictly local? More...
 
ref< WorkProcessorcreateWorkProcessor () const
 Create an instance of the algorithm responsible for executing the work units of this parallel process. More...
 
void processResult (const WorkResult *wr, bool cancelled)
 Called whenever a work unit has been completed. More...
 
EStatus generateWork (WorkUnit *unit, int worker)
 Generate a piece of work. More...
 
Implementation of the ParallelProcess interface
- Public Member Functions inherited from mitsuba::ParallelProcess
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 void bindResource (const std::string &name, int id)
 Bind a resource to this parallel process. 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::ParticleProcess
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

virtual ~GatherPhotonProcess ()
 Virtual destructor. More...
 
bool unsuccessful (size_t needed, size_t gen, size_t shot)
 Checks if the configuration of needed, generated and shot photons indicates an unsuccessful progress of the gathering. This check is taken from PBRT. More...
 
- Protected Member Functions inherited from mitsuba::ParticleProcess
 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

EGatherType m_type
 
ref< PhotonMapm_photonMap
 
size_t m_photonCount
 
int m_maxDepth
 
int m_rrDepth
 
bool m_isLocal
 
bool m_autoCancel
 
size_t m_excess
 
size_t m_numShot
 
- Protected Attributes inherited from mitsuba::ParticleProcess
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

Process for parallel photon map construction.

Given a number and type (surface/caustic/volume) of photons, this class distributes the work over an arbitrary number of machines.

Member Enumeration Documentation

Enumerator
ESurfacePhotons 

Surface photons (indirect on diffuse surfaces, last bounce was not through a delta BSDF)

ECausticPhotons 

Caustic photons (indirect on diffuse surfaces, last bounce was through a delta BSDF)

EAllSurfacePhotons 

Surface photons (all of them, even direct illumination)

EVolumePhotons 

Volumetric photons.

Constructor & Destructor Documentation

mitsuba::GatherPhotonProcess::GatherPhotonProcess ( EGatherType  type,
size_t  photonCount,
size_t  granularity,
int  maxDepth,
int  rrDepth,
bool  isLocal,
bool  autoCancel,
const void *  progressReporterPayload 
)

Create a new process for parallel photon gathering

Parameters
typeSpecifies the type of requested photons (surface/caustic/volume)
photonCountSpecifies the number of requested photons
granularitySize of the internally used work units (in photons)
isLocalShould the parallel process only be executed locally? (sending photons over the network may be unnecessary and wasteful)
autoCancelIndicates if the gathering process should be canceled if there are not enough photons generated
progressReporterPayloadCustom pointer payload to be delivered with progress messages
virtual mitsuba::GatherPhotonProcess::~GatherPhotonProcess ( )
inlineprotectedvirtual

Virtual destructor.

Member Function Documentation

ref<WorkProcessor> mitsuba::GatherPhotonProcess::createWorkProcessor ( ) const
virtual

Create an instance of the algorithm responsible for executing the work units of this parallel process.

Implements mitsuba::ParallelProcess.

EStatus mitsuba::GatherPhotonProcess::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

Reimplemented from mitsuba::ParticleProcess.

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

Retrieve this object's class.

Reimplemented from mitsuba::ParticleProcess.

size_t mitsuba::GatherPhotonProcess::getExcessPhotons ( ) const
inline

Return the number of discarded photons.

Due to asynchronous processing, some excess photons will generally be produced. This function returns the number of excess photons that had to be discarded. If this is too high, the granularity should be decreased.

PhotonMap* mitsuba::GatherPhotonProcess::getPhotonMap ( )
inline

Once the process has finished, this returns a reference to the (still unbalanced) photon map

size_t mitsuba::GatherPhotonProcess::getShotParticles ( ) const
inline

Lists the nuber of particles that had to be shot in order to fill the photon map.

bool mitsuba::GatherPhotonProcess::isLocal ( ) const
virtual

Is this process strictly local?

If a process is marked as local, it shouldn't be distributed to remote processing nodes. The default implementation returns false.

Reimplemented from mitsuba::ParallelProcess.

void mitsuba::GatherPhotonProcess::processResult ( const WorkResult result,
bool  cancelled 
)
virtual

Called whenever a work unit has been completed.

Note that this function may concurrently be executed by multiple threads. Also, processing of work results will generally be out of order with respect to the creation in generateWork().

When a work unit is only partially completed due to a call to Scheduler::cancel(), the second parameter is set to true. A thrown exception will lead to the termination of the parallel process.

Parameters
resultWork result to be processed
cancelledWas the associated work unit not fully completed

Implements mitsuba::ParallelProcess.

bool mitsuba::GatherPhotonProcess::unsuccessful ( size_t  needed,
size_t  gen,
size_t  shot 
)
inlineprotected

Checks if the configuration of needed, generated and shot photons indicates an unsuccessful progress of the gathering. This check is taken from PBRT.

Member Data Documentation

bool mitsuba::GatherPhotonProcess::m_autoCancel
protected
size_t mitsuba::GatherPhotonProcess::m_excess
protected
bool mitsuba::GatherPhotonProcess::m_isLocal
protected
int mitsuba::GatherPhotonProcess::m_maxDepth
protected
size_t mitsuba::GatherPhotonProcess::m_numShot
protected
size_t mitsuba::GatherPhotonProcess::m_photonCount
protected
ref<PhotonMap> mitsuba::GatherPhotonProcess::m_photonMap
protected
int mitsuba::GatherPhotonProcess::m_rrDepth
protected
Class* mitsuba::GatherPhotonProcess::m_theClass
static
EGatherType mitsuba::GatherPhotonProcess::m_type
protected

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