Adun  0.83
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions
AdConfigurationGenerator Class Reference

#import <AdunConfigurationGenerator.h>

Inheritance diagram for AdConfigurationGenerator:
Inheritance graph

List of all members.

Public Member Functions

(BOOL) - production:
(BOOL) - restartFrom:error:
(void) - endProduction
(void) - clearFloatingPointErrors
(unsigned int) - numberOfSteps
(void) - setNumberOfSteps:
(unsigned int) - currentStep
(AdSystemCollection *) - systems
(AdForceFieldCollection *) - forceFields

Detailed Description

AdConfigurationGenerator is an abstract class representing objects that update the configuration of AdSystem objects. Every simulation application should have one AdConfigurationGenerator subclass which performs the simulation. The different concrete subclasses of AdConfigurationGenerator correspond to different methods for generating new configurations (aka frames, snapshots etc.) of system elements e.g. dynamics, monte carlo, minimisation etc.

The production() method wraps each subclasses configuration generation loop. The number of times this loop is executed is set on initialising the object or through the setNumberOfSteps: (AdConfigurationGenerator) method. On each pass through the the applications AdMainLoopTimer instance is always incremented regardless of the configuration generation method.

If production() is run in a separate thread the endProduction (AdConfigurationGenerator) method provides a way to end the simulation loop from the main thread before the set number of iterations have been completed.

Numerical Stability

AdConfigurationGenerator subclass instances monitor the numerical stability of the production process by checking for IEEE floating point errors. These are

The first three cause an AdFloatingPointException to be raised with information on which error was detected. The production loop will exit and an NSError object created whose error code is AdKernelFloatingPointError.

The last error is common since all irrational and transcendental numbers are inexact and we may be adding many numbers who differ by more than DBL_EPSILON. Hence on detection of this error nothing is done.

Underflow errors lead to a slow loss of precision. However it is possible that tiny forces and energies will be calculated in the course of a simulation. When this error is detected the object logs it and continues normally.

Member Function Documentation

- (void) clearFloatingPointErrors

Clears the floating point status word of all exceptions This is mainly used to clear INEXACT exceptions which are ignored. It is also used to clear exceptions before beginning a production block. This is to ensure all exceptions caught originated in the simulation and not from some operation before. Note: Exception are not cleared unless a new block is defined. This is because if a small number of steps is run at a time (within a block), and the exception detection interval is larger than this number, exceptions will never be caught.

- (unsigned int) currentStep

Returns the current production step.

Implemented in AdMinimiser.

- (void) endProduction

Ends the running production loop.

- (AdForceFieldCollection *) forceFields

Returns the force field collection the generator is currently using

- (unsigned int) numberOfSteps

Returns the number of steps performed when production() is called

Implemented in AdMinimiser.

- (BOOL) production: (NSError**)  error

Performs a number of configuration generation steps on the active systems.

Implemented in AdMinimiser.

- (BOOL) restartFrom: (int)  step
error: (NSError**)  error 

Restarts a production loop from step start. Returns NO if the loop fails to complete for any reason. In this case error will point to an NSError contain information on the reason for the failure.

Implemented in AdMinimiser.

- (void) setNumberOfSteps: (unsigned int)  aNumber

Sets the number of intergraion steps performed when production() is called.

Implemented in AdMinimiser.

- (AdSystemCollection *) systems

Returns the system collection the generator is currently working on