[cig-commits] commit: Rename .c -> .cxx and make configure automatically use c++

Mercurial hg at geodynamics.org
Thu May 12 11:25:24 PDT 2011


changeset:   229:2c1a490240ef
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Thu May 12 11:23:36 2011 -0700
files:       Base/src/Camera.c Base/src/Camera.cxx Base/src/ColourMap.c Base/src/ColourMap.cxx Base/src/CrossSection.c Base/src/CrossSection.cxx Base/src/DrawingObject.c Base/src/DrawingObject.cxx Base/src/DrawingObject_Register.c Base/src/DrawingObject_Register.cxx Base/src/Finalise.c Base/src/Finalise.cxx Base/src/Init.c Base/src/Init.cxx Base/src/InputFormat.c Base/src/InputFormat.cxx Base/src/InputFormat_Register.c Base/src/InputFormat_Register.cxx Base/src/Light.c Base/src/Light.cxx Base/src/Light_Register.c Base/src/Light_Register.cxx Base/src/OutputFormat.c Base/src/OutputFormat.cxx Base/src/OutputFormat_Register.c Base/src/OutputFormat_Register.cxx Base/src/RenderingEngine.c Base/src/RenderingEngine.cxx Base/src/Viewport.c Base/src/Viewport.cxx Base/src/Window.c Base/src/Window.cxx Base/src/WindowInteraction.c Base/src/WindowInteraction.cxx Base/src/WindowInteraction_Register.c Base/src/WindowInteraction_Register.cxx Base/src/X11Colours.c Base/src/X11Colours.cxx Base/tests/plugins/Others/lucTestColourMaps.c Base/tests/plugins/Others/lucTestColourMaps.cxx Base/tests/plugins/Others/lucTestOutputing.c Base/tests/plugins/Others/lucTestOutputing.cxx Base/tests/plugins/Others/lucTestPlottingObjects.c Base/tests/plugins/Others/lucTestPlottingObjects.cxx Base/tests/plugins/RenderingEngineTest.c Base/tests/plugins/RenderingEngineTest.cxx Base/tests/plugins/lucTestCameras.c Base/tests/plugins/lucTestCameras.cxx Base/tests/plugins/lucTestColourMaps.c Base/tests/plugins/lucTestColourMaps.cxx Base/tests/testlucBase.c Base/tests/testlucBase.cxx DrawingObjects/src/Axis.c DrawingObjects/src/Axis.cxx DrawingObjects/src/ColourBar.c DrawingObjects/src/ColourBar.cxx DrawingObjects/src/Contour.c DrawingObjects/src/Contour.cxx DrawingObjects/src/Eigenvectors.c DrawingObjects/src/Eigenvectors.cxx DrawingObjects/src/EigenvectorsCrossSection.c DrawingObjects/src/EigenvectorsCrossSection.cxx DrawingObjects/src/FeVariableSurface.c DrawingObjects/src/FeVariableSurface.cxx DrawingObjects/src/FieldVariableBorder.c DrawingObjects/src/FieldVariableBorder.cxx DrawingObjects/src/Finalise.c DrawingObjects/src/Finalise.cxx DrawingObjects/src/HistoricalSwarmTrajectory.c DrawingObjects/src/HistoricalSwarmTrajectory.cxx DrawingObjects/src/Init.c DrawingObjects/src/Init.cxx DrawingObjects/src/Isosurface.c DrawingObjects/src/Isosurface.cxx DrawingObjects/src/MeshViewer.c DrawingObjects/src/MeshViewer.cxx DrawingObjects/src/OpenGLDrawingObject.c DrawingObjects/src/OpenGLDrawingObject.cxx DrawingObjects/src/ScalarField.c DrawingObjects/src/ScalarField.cxx DrawingObjects/src/ScalarFieldCrossSection.c DrawingObjects/src/ScalarFieldCrossSection.cxx DrawingObjects/src/ScalarFieldOnMesh.c DrawingObjects/src/ScalarFieldOnMesh.cxx DrawingObjects/src/ScalarFieldOnMeshCrossSection.c DrawingObjects/src/ScalarFieldOnMeshCrossSection.cxx DrawingObjects/src/SwarmRGBColourViewer.c DrawingObjects/src/SwarmRGBColourViewer.cxx DrawingObjects/src/SwarmSquares.c DrawingObjects/src/SwarmSquares.cxx DrawingObjects/src/SwarmVectors.c DrawingObjects/src/SwarmVectors.cxx DrawingObjects/src/SwarmViewer.c DrawingObjects/src/SwarmViewer.cxx DrawingObjects/src/SwarmViewerBase.c DrawingObjects/src/SwarmViewerBase.cxx DrawingObjects/src/TextureMap.c DrawingObjects/src/TextureMap.cxx DrawingObjects/src/TimeStep.c DrawingObjects/src/TimeStep.cxx DrawingObjects/src/Title.c DrawingObjects/src/Title.cxx DrawingObjects/src/VectorArrowCrossSection.c DrawingObjects/src/VectorArrowCrossSection.cxx DrawingObjects/src/VectorArrows.c DrawingObjects/src/VectorArrows.cxx DrawingObjects/tests/DummyFieldVariable/DummyFieldVariable.c DrawingObjects/tests/DummyFieldVariable/DummyFieldVariable.cxx DrawingObjects/tests/DummySwarmVariable/DummySwarmVariable.c DrawingObjects/tests/DummySwarmVariable/DummySwarmVariable.cxx DrawingObjects/tests/testDrawingObject.c DrawingObjects/tests/testDrawingObject.cxx InputFormats/src/Finalise.c InputFormats/src/Finalise.cxx InputFormats/src/Init.c InputFormats/src/Init.cxx InputFormats/src/InputPPM.c InputFormats/src/InputPPM.cxx InputFormats/src/InputTIFF.c InputFormats/src/InputTIFF.cxx InputFormats/tests/plugins/lucTestInputFormat.c InputFormats/tests/plugins/lucTestInputFormat.cxx OutputFormats/src/EncoderLibavcodec.c OutputFormats/src/EncoderLibavcodec.cxx OutputFormats/src/EncoderLibfame.c OutputFormats/src/EncoderLibfame.cxx OutputFormats/src/Finalise.c OutputFormats/src/Finalise.cxx OutputFormats/src/Init.c OutputFormats/src/Init.cxx OutputFormats/src/OutputJPEG.c OutputFormats/src/OutputJPEG.cxx OutputFormats/src/OutputPNG.c OutputFormats/src/OutputPNG.cxx OutputFormats/src/OutputPPM.c OutputFormats/src/OutputPPM.cxx OutputFormats/src/OutputTIFF.c OutputFormats/src/OutputTIFF.cxx OutputFormats/src/OutputVECTOR.c OutputFormats/src/OutputVECTOR.cxx RenderingEngines/src/Finalise.c RenderingEngines/src/Finalise.cxx RenderingEngines/src/Init.c RenderingEngines/src/Init.cxx RenderingEngines/src/OpenGlUtil.c RenderingEngines/src/OpenGlUtil.cxx RenderingEngines/src/RenderingEngineGL.c RenderingEngines/src/RenderingEngineGL.cxx RenderingEngines/tests/DummyOpenGL/DummyOpenGL.c RenderingEngines/tests/DummyOpenGL/DummyOpenGL.cxx RenderingEngines/tests/testRenderingEngineGL.c RenderingEngines/tests/testRenderingEngineGL.cxx SConscript WindowInteractions/src/ColourBarInteraction.c WindowInteractions/src/ColourBarInteraction.cxx WindowInteractions/src/FieldValueInteraction.c WindowInteractions/src/FieldValueInteraction.cxx WindowInteractions/src/Finalise.c WindowInteractions/src/Finalise.cxx WindowInteractions/src/Init.c WindowInteractions/src/Init.cxx WindowInteractions/src/LightInteraction.c WindowInteractions/src/LightInteraction.cxx WindowInteractions/src/MeshViewerInteraction.c WindowInteractions/src/MeshViewerInteraction.cxx WindowInteractions/src/SwarmViewerInteraction.c WindowInteractions/src/SwarmViewerInteraction.cxx Windowing/src/CarbonWindow.c Windowing/src/CarbonWindow.cxx Windowing/src/Finalise.c Windowing/src/Finalise.cxx Windowing/src/Init.c Windowing/src/Init.cxx Windowing/src/OSMesaWindow.c Windowing/src/OSMesaWindow.cxx Windowing/src/SDLWindow.c Windowing/src/SDLWindow.cxx Windowing/src/X11Window.c Windowing/src/X11Window.cxx libglucifer/src/Finalise.c libglucifer/src/Finalise.cxx libglucifer/src/Init.c libglucifer/src/Init.cxx plugins/lucPlugin/lucPlugin.c plugins/lucPlugin/lucPlugin.cxx src/main.c src/main.cxx
description:
Rename .c -> .cxx and make configure automatically use c++


diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Camera.c
--- a/Base/src/Camera.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,539 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Camera.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "types.h"
-#include "Camera.h"
-#include "Init.h"
-
-#include <string.h>
-#include <assert.h>
-
-const Type lucCamera_Type = "lucCamera";
-
-MPI_Datatype lucCamera_MPI_Datatype;
-
-lucCamera* lucCamera_New( 
-		Name                                               name,
-		Coord                                              coord, 
-		Coord                                              focalPoint,
-		Coord                                              rotationCentre,
-		XYZ                                                upDirection,
-		double                                             focalLength,
-		double                                             aperture,
-		double                                             eyeSeparation,
-		lucStereoType                                      stereoType,
-		FieldVariable*                                     centreFieldVariable )
-{
-	lucCamera* self = (lucCamera*) _lucCamera_DefaultNew( name );
-
-	self->isConstructed = True;
-	_lucCamera_Init( self, coord, focalPoint, rotationCentre, upDirection, focalLength, aperture, eyeSeparation, stereoType, centreFieldVariable );
-
-	return self;
-}
-
-void* _lucCamera_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof( lucCamera );
-	Type                                                      type = lucCamera_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucCamera_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucCamera_Print;
-	Stg_Class_CopyFunction*                                  _copy = _lucCamera_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucCamera_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucCamera_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucCamera_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucCamera_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucCamera_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucCamera_Destroy;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucCamera_New(  LUCCAMERA_PASSARGS  );
-}
-
-lucCamera* _lucCamera_New(  LUCCAMERA_DEFARGS  )
-{
-	lucCamera* self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucCamera) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucCamera*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucCamera_Init(		
-	void*				camera,
-	Coord				coord, 
-	Coord				focalPoint,
-	Coord				rotationCentre,
-	XYZ				upDirection,
-	double			focalLength,
-	double			aperture,
-	double			eyeSeparation,
-	lucStereoType	stereoType,
-	FieldVariable*	centreFieldVariable )
-{
-	lucCamera* self = camera;
-
-	memcpy( self->coord, coord, sizeof(Coord) );
-	memcpy( self->focalPoint, focalPoint, sizeof(Coord) );
-	memcpy( self->rotationCentre, rotationCentre, sizeof(Coord) );
-	memcpy( self->upDirection, upDirection, sizeof(XYZ) );
-
-	self->focalLength         = focalLength;
-	self->aperture            = aperture;
-	self->eyeSeparation       = eyeSeparation;
-	self->stereoType          = stereoType;
-	self->centreFieldVariable = centreFieldVariable;
-
-	/* Store Original Values */
-	self->needsToDraw   = True;
-	self->buffer        = lucLeft;
-	self->originalCamera = lucCamera_Copy( self );
-}
-
-void _lucCamera_Delete( void* camera ) {
-	lucCamera* self = camera;
-	
-	_Stg_Component_Delete( self );
-}
-
-void _lucCamera_Print( void* camera, Stream* stream ) {
-	lucCamera* self        = camera;
-	
-	Journal_Printf( stream, "lucCamera: %s\n", self->name );
-
-	Stream_Indent( stream );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	Journal_PrintArray( stream, self->coord, 3 );
-	Journal_PrintArray( stream, self->focalPoint, 3 );
-	Journal_PrintArray( stream, self->rotationCentre, 3 );
-	Journal_PrintArray( stream, self->upDirection, 3 );
-	
-	Journal_PrintValue( stream, self->aperture );
-
-	Journal_Printf( stream, "self->stereoType = ");
-	switch ( self->stereoType ) {
-		case lucMono:
-			Journal_Printf( stream, "lucMono\n" ); break;
-		case lucStereoToeIn:
-			Journal_Printf( stream, "lucStereoToeIn\n" ); break;
-		case lucStereoAsymmetric:
-			Journal_Printf( stream, "lucStereoAsymmetric\n" ); break;
-	}
-	
-	Journal_Printf( stream, "self->buffer = ");
-	switch ( self->buffer ) {
-		case lucLeft:
-			Journal_Printf( stream, "lucLeft\n" ); break;
-		case lucRight:
-			Journal_Printf( stream, "lucRight\n" ); break;
-	}
-	Journal_PrintValue( stream, self->eyeSeparation );
-
-	Stream_UnIndent( stream );
-}
-
-void* _lucCamera_Copy( void* camera, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucCamera* self        = camera;
-	lucCamera* newCamera;
-
-	newCamera = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newCamera->originalCamera      = NULL;
-   newCamera->centreFieldVariable = NULL;
-
-	memcpy( newCamera->coord,          self->coord,          sizeof(Coord) );
-	memcpy( newCamera->focalPoint,     self->focalPoint,     sizeof(Coord) );
-	memcpy( newCamera->rotationCentre, self->rotationCentre, sizeof(Coord) );
-	memcpy( newCamera->upDirection,    self->upDirection,    sizeof(XYZ  ) );
-
-   newCamera->focalLength   = self->focalLength;
-	newCamera->aperture      = self->aperture;
-	newCamera->eyeSeparation = self->eyeSeparation;   
-	newCamera->buffer        = self->buffer;
-	newCamera->stereoType    = self->stereoType;
-	newCamera->needsToDraw   = self->needsToDraw;
-
-	return (void*) newCamera;
-}
-
-void _lucCamera_AssignFromXML( void* camera, Stg_ComponentFactory* cf, void* data ) {
-	lucCamera*             self               = (lucCamera*) camera;
-	Coord                  coord;
-	Coord                  focalPoint;
-	Coord                  rotationCentre;
-	XYZ                    upDirection;
-	FieldVariable*         centreFieldVariable;
-	double                 focalLength;
-	double                 aperture;
-	double                 eyeSeparation;
-	lucStereoType          stereoType;
-	Name                   stereoTypeName;
-
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
-	
-  #define DTOR 0.0174532925
-	focalPoint[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalPointX", 0.0  );
-	focalPoint[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalPointY", 0.0  );
-	focalPoint[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalPointZ", 0.0  );
-
-	rotationCentre[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"rotationCentreX", 0.0  );
-	rotationCentre[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"rotationCentreY", 0.0  );
-	rotationCentre[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"rotationCentreZ", 0.0  );
-
-	upDirection[I_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"upDirectionX", 0.0  );
-	upDirection[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"upDirectionY", 1.0  );
-	upDirection[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"upDirectionZ", 0.0  );
-	
-	focalLength = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalLength", 0.0  );
-
-	coord[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordX", 0.0  );
-	coord[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordY", 0.0  );
-	coord[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordZ", 1.0  );
-
-	aperture = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"aperture", 45.0  );
-
-	/* Get Stereo Type */
-	stereoTypeName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"stereoType", "lucMono"  );
-	if ( strcasecmp( stereoTypeName, "ToeIn" ) == 0 ) 
-		stereoType = lucStereoToeIn;
-	else if ( strcasecmp( stereoTypeName, "Asymmetric" ) == 0 ) 
-		stereoType = lucStereoAsymmetric;
-	else 
-		stereoType = lucMono;
-
-	eyeSeparation  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"eyeSeparation", 0.2  );
-
-	centreFieldVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"CentreFieldVariable", FieldVariable, False, data );
-
-	_lucCamera_Init( self, coord, focalPoint, rotationCentre, upDirection, focalLength, aperture, eyeSeparation, stereoType, centreFieldVariable );
-}
-
-void _lucCamera_Build( void* camera, void* data ) { 
-	lucCamera*     self = (lucCamera*) camera;
-	FieldVariable* fieldVariable = self->centreFieldVariable;
-
-	if ( fieldVariable ) {
-		Stg_Component_Build( fieldVariable, data, False );
-	}
-}
-void _lucCamera_Initialise( void* camera, void* data ) { 
-	lucCamera*     self = (lucCamera*) camera;
-	FieldVariable* fieldVariable = self->centreFieldVariable;
-
-	if ( fieldVariable ) {
-		Stg_Component_Initialise( fieldVariable, data, False );
-		lucCamera_CentreFromFieldVariable( self );
-	}
-}
-
-void _lucCamera_Execute( void* camera, void* data ) { }
-
-void _lucCamera_Destroy( void* camera, void* data ) {
-}
-
-void lucCamera_Zoom( void* camera, double zoomFactor ) {
-	lucCamera* self                = camera;
-	XYZ        vectorFocusToCamera;
-	
-	StGermain_VectorSubtraction( vectorFocusToCamera, self->coord, self->focalPoint, 3 );
-	vectorFocusToCamera[ I_AXIS ] *= zoomFactor;
-	vectorFocusToCamera[ J_AXIS ] *= zoomFactor;
-	vectorFocusToCamera[ K_AXIS ] *= zoomFactor;
-	StGermain_VectorAddition( self->coord, vectorFocusToCamera, self->focalPoint, 3 );
-	
-	self->needsToDraw = True;
-}
-
-void lucCamera_RotateAroundUpDirection( void* camera, double deltaTheta ) {
-	lucCamera* self                = camera;
-	XYZ        vec;
-	XYZ        rotatedVec;
-
-	StGermain_VectorSubtraction( vec, self->coord, self->rotationCentre, 3 );
-	StGermain_RotateVector( rotatedVec, vec, self->upDirection, deltaTheta );
-	StGermain_VectorAddition( self->coord, rotatedVec, self->rotationCentre, 3 );
-	
-	StGermain_VectorSubtraction( vec, self->focalPoint, self->rotationCentre, 3 );
-	StGermain_RotateVector( rotatedVec, vec, self->upDirection, deltaTheta );
-	StGermain_VectorAddition( self->focalPoint, rotatedVec, self->rotationCentre, 3 );
-	
-	self->needsToDraw = True;
-}
-
-void lucCamera_RotateTowardsUpDirection( void* camera, double deltaTheta ) {
-	lucCamera*   self                = camera;
-	XYZ          rotationAxis;
-	XYZ          vec;
-	XYZ          rotatedVec;
-	double       angleBetween;
-	double       predictedAngle;
-	const double minAngle            = M_PI/180.0 * 0.1; /* A tenth of a degree */
-	const double maxAngle            = M_PI - minAngle;
-
-	StGermain_VectorSubtraction( vec, self->coord, self->focalPoint, 3 );
-	StGermain_VectorCrossProduct( rotationAxis, vec, self->upDirection );
-	StGermain_VectorNormalise( rotationAxis, 3 );
-
-	/* Check if angle is too large */
-	angleBetween = StGermain_AngleBetweenVectors( vec, self->upDirection, 3 );
-	predictedAngle = angleBetween - deltaTheta;
-	if ( predictedAngle < minAngle ) 
-		deltaTheta = angleBetween - minAngle;
-	else if ( predictedAngle > maxAngle ) 
-		deltaTheta = angleBetween - maxAngle;
-		
-	StGermain_VectorSubtraction( vec, self->coord, self->rotationCentre, 3 );
-	StGermain_RotateVector( rotatedVec, vec, rotationAxis, deltaTheta );
-	StGermain_VectorAddition( self->coord, rotatedVec, self->rotationCentre, 3 );
-	
-	StGermain_VectorSubtraction( vec, self->focalPoint, self->rotationCentre, 3 );
-	StGermain_RotateVector( rotatedVec, vec, rotationAxis, deltaTheta );
-	StGermain_VectorAddition( self->focalPoint, rotatedVec, self->rotationCentre, 3 );
-
-	self->needsToDraw = True;
-}
-
-void lucCamera_Reset( void* camera ) {
-	lucCamera* self                = camera;
-	lucCamera* originalCamera      = self->originalCamera;
-	
-	Stg_Class_Copy( originalCamera, self, False, NULL, NULL );
-	self->originalCamera = originalCamera;
-	self->needsToDraw = True;
-}
-
-void lucCamera_SetOriginal( void* camera ) {
-	lucCamera* self                = camera;
-	
-	Stg_Class_Copy( self, self->originalCamera, False, NULL, NULL );
-	self->originalCamera->originalCamera = NULL;
-}
-
-void lucCamera_Broadcast( void* camera, int rootRank, MPI_Comm comm ) {
-	lucCamera* self                = camera;
-
-	Journal_DPrintfL( lucDebug, 2, "In %s for %s '%s'.\n", __func__, self->type, self->name );
-
-	MPI_Bcast( self, 1, lucCamera_MPI_Datatype, rootRank, comm );
-}
-
-void lucCamera_GetFocusDirection( void* camera, XYZ focusDirection ) {
-	lucCamera*   self                = camera;
-	
-	StGermain_VectorSubtraction( focusDirection, self->focalPoint, self->coord, 3 );
-	StGermain_VectorNormalise( focusDirection, 3 );
-}
-
-void lucCamera_GetLeftDirection( void* camera, XYZ leftDirection ) {
-	lucCamera*   self                = camera;
-	XYZ          focusDirection;
-	
-	lucCamera_GetFocusDirection( self, focusDirection );
-	StGermain_VectorCrossProduct( leftDirection, self->upDirection, focusDirection );
-	StGermain_VectorNormalise( leftDirection, 3 );
-}
-
-void lucCamera_SwapStereoBuffer( void* camera ) {
-	lucCamera* self                = camera;
-
-	if ( self->buffer == lucLeft )
-		self->buffer = lucRight;
-	else 
-		self->buffer = lucLeft;
-	self->needsToDraw = True;
-}
-
-void lucCamera_CurrentEyePosition( void* camera, Coord currEyePos ) {
-	lucCamera* self                = camera;
-	XYZ        leftDirection;
-	double     factor;
-
-	memcpy( currEyePos, self->coord, sizeof(Coord) );
-	if ( self->stereoType == lucMono )
-		return;
-
-	lucCamera_GetLeftDirection( camera, leftDirection );
-
-	factor = 0.5 * self->eyeSeparation;
-	if ( self->buffer == lucRight )
-		factor *= -1.0; 
-
-	currEyePos[ I_AXIS ] += factor * leftDirection[ I_AXIS ];
-	currEyePos[ J_AXIS ] += factor * leftDirection[ J_AXIS ];
-	currEyePos[ K_AXIS ] += factor * leftDirection[ K_AXIS ];
-}
-
-
-void lucCamera_CentreFromFieldVariable( void* camera ) {
-	lucCamera*     self = (lucCamera*) camera;
-	Coord          min, max;
-	Coord          oldFocalPoint;
-	XYZ            difference = {0.0,0.0,0.0};
-	FieldVariable* fieldVariable = self->centreFieldVariable;
-
-	if ( !fieldVariable )
-		return;
-
-	FieldVariable_GetMinAndMaxGlobalCoords( fieldVariable, min, max );
-  
-		
-	/* Set up focal point */
-	memcpy( oldFocalPoint, self->focalPoint, sizeof(Coord) );
-	self->focalPoint[I_AXIS] = 0.5 * (min[ I_AXIS ] + max[ I_AXIS ]);
-	self->focalPoint[J_AXIS] = 0.5 * (min[ J_AXIS ] + max[ J_AXIS ]);
-	if (fieldVariable->dim == 2) 
-		self->focalPoint[K_AXIS] = 0.0;
-	else 
-		self->focalPoint[K_AXIS] = 0.5 * (min[ K_AXIS ] + max[ K_AXIS ]);
-	
-	/* Set up camera */
-	StGermain_VectorSubtraction( difference, self->focalPoint, oldFocalPoint, fieldVariable->dim );
-	self->coord[ I_AXIS ] += difference[ I_AXIS ] ;
-	self->coord[ J_AXIS ] += difference[ J_AXIS ] ;
-	self->coord[ K_AXIS ] += difference[ K_AXIS ] ;
-
-	/* Adjust the rotation centre */
-	memcpy( self->rotationCentre, self->focalPoint, sizeof( Coord ) );
-
-	/* Adjust Original Camera */
-	self->originalCamera->coord[ I_AXIS ] += difference[ I_AXIS ] ;
-	self->originalCamera->coord[ J_AXIS ] += difference[ J_AXIS ] ;
-	self->originalCamera->coord[ K_AXIS ] += difference[ K_AXIS ] ;
-	memcpy( self->originalCamera->focalPoint, self->focalPoint, sizeof( Coord ) );
-	memcpy( self->originalCamera->rotationCentre, self->rotationCentre, sizeof( Coord ) );
-}
-
-void lucCamera_ChangeFocalPoint( void* camera, Pixel_Index startx, Pixel_Index starty, Pixel_Index xpos, Pixel_Index ypos ){
-	lucCamera*      self = (lucCamera*) camera;
-	XYZ             leftDirection;
-	Dimension_Index dim_I;
-
-	lucCamera_GetLeftDirection( camera, leftDirection );
-	for ( dim_I = 0 ; dim_I < 3 ; dim_I++ ) {
-		self->focalPoint[ dim_I ] += 0.01 * ((double)xpos - (double)startx) * leftDirection[ dim_I ];
-		self->focalPoint[ dim_I ] -= 0.01 * ((double)ypos - (double)starty) * self->upDirection[ dim_I ];
-	}
-
-	self->needsToDraw = True;
-}
-
-void lucCamera_Pickle( void* camera, Stream* stream ) {
-	lucCamera* self                = camera;
-	       
-	Journal_Printf( stream, "<struct name=\"%s\">\n", self->name);
-	Stream_Indent( stream );
-
-	Journal_Printf( stream, "<param name=\"Type\">%s</param>\n", self->type );
-	Journal_Printf( stream, "<param name=\"coordX\">%.5g</param>\n", self->coord[ I_AXIS ] );
-	Journal_Printf( stream, "<param name=\"coordY\">%.5g</param>\n", self->coord[ J_AXIS ] );
-	Journal_Printf( stream, "<param name=\"coordZ\">%.5g</param>\n", self->coord[ K_AXIS ] );
-
-	Journal_Printf( stream, "<param name=\"focalPointX\">%.5g</param>\n", self->focalPoint[ I_AXIS ] );
-	Journal_Printf( stream, "<param name=\"focalPointY\">%.5g</param>\n", self->focalPoint[ J_AXIS ] );
-	Journal_Printf( stream, "<param name=\"focalPointZ\">%.5g</param>\n", self->focalPoint[ K_AXIS ] );
-
-	Journal_Printf( stream, "<param name=\"rotationCentreX\">%.5g</param>\n", self->rotationCentre[ I_AXIS ] );
-	Journal_Printf( stream, "<param name=\"rotationCentreY\">%.5g</param>\n", self->rotationCentre[ J_AXIS ] );
-	Journal_Printf( stream, "<param name=\"rotationCentreZ\">%.5g</param>\n", self->rotationCentre[ K_AXIS ] );
-
-	Journal_Printf( stream, "<param name=\"upDirectionX\">%.5g</param>\n", self->upDirection[ I_AXIS ] );
-	Journal_Printf( stream, "<param name=\"upDirectionY\">%.5g</param>\n", self->upDirection[ J_AXIS ] );
-	Journal_Printf( stream, "<param name=\"upDirectionZ\">%.5g</param>\n", self->upDirection[ K_AXIS ] );
-
-	Journal_Printf( stream, "<param name=\"stereoType\">%s</param>\n", 
-			self->stereoType == lucStereoToeIn      ? "ToeIn" :
-			self->stereoType == lucStereoAsymmetric ? "Asymmetric" : "Mono" );
-	
-	Journal_Printf( stream, "<param name=\"eyeSeparation\">%.5g</param>\n", self->eyeSeparation );
-	Journal_Printf( stream, "<param name=\"focalLength\">%.5g</param>\n", self->focalLength );
-	Stream_UnIndent( stream );
-	Journal_Printf( stream, "</struct>\n");
-}
-void lucCamera_SetNeedsToDraw( void * camera ){
-	lucCamera* self = (lucCamera*) camera;
-	self->needsToDraw = True;
-}
-
-#define lucCamera_TypesCount 10
-void lucCamera_Create_MPI_Datatype() {
-	MPI_Datatype        typeList[lucCamera_TypesCount]     = 
-		{ MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_INT };
-	int                 blocklen[lucCamera_TypesCount]     = {3, 3, 3, 3, 1, 1, 1, 1, 1, 1};
-	MPI_Aint            displacement[lucCamera_TypesCount];
-	lucCamera           camera;
-
-	displacement[0] = GetOffsetOfMember( camera, coord );
-	displacement[1] = GetOffsetOfMember( camera, focalPoint );
-	displacement[2] = GetOffsetOfMember( camera, rotationCentre );
-	displacement[3] = GetOffsetOfMember( camera, upDirection );
-	displacement[4] = GetOffsetOfMember( camera, focalLength );
-	displacement[5] = GetOffsetOfMember( camera, aperture );
-	displacement[6] = GetOffsetOfMember( camera, eyeSeparation );
-	displacement[7] = GetOffsetOfMember( camera, buffer );
-	displacement[8] = GetOffsetOfMember( camera, stereoType );
-	displacement[9] = GetOffsetOfMember( camera, needsToDraw );
-	
-	MPI_Type_struct( lucCamera_TypesCount, blocklen, displacement, typeList, &lucCamera_MPI_Datatype );
-	MPI_Type_commit( & lucCamera_MPI_Datatype );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Camera.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Camera.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,539 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Camera.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "types.h"
+#include "Camera.h"
+#include "Init.h"
+
+#include <string.h>
+#include <assert.h>
+
+const Type lucCamera_Type = "lucCamera";
+
+MPI_Datatype lucCamera_MPI_Datatype;
+
+lucCamera* lucCamera_New( 
+		Name                                               name,
+		Coord                                              coord, 
+		Coord                                              focalPoint,
+		Coord                                              rotationCentre,
+		XYZ                                                upDirection,
+		double                                             focalLength,
+		double                                             aperture,
+		double                                             eyeSeparation,
+		lucStereoType                                      stereoType,
+		FieldVariable*                                     centreFieldVariable )
+{
+	lucCamera* self = (lucCamera*) _lucCamera_DefaultNew( name );
+
+	self->isConstructed = True;
+	_lucCamera_Init( self, coord, focalPoint, rotationCentre, upDirection, focalLength, aperture, eyeSeparation, stereoType, centreFieldVariable );
+
+	return self;
+}
+
+void* _lucCamera_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof( lucCamera );
+	Type                                                      type = lucCamera_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucCamera_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucCamera_Print;
+	Stg_Class_CopyFunction*                                  _copy = _lucCamera_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucCamera_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucCamera_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucCamera_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucCamera_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucCamera_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucCamera_Destroy;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucCamera_New(  LUCCAMERA_PASSARGS  );
+}
+
+lucCamera* _lucCamera_New(  LUCCAMERA_DEFARGS  )
+{
+	lucCamera* self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucCamera) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucCamera*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucCamera_Init(		
+	void*				camera,
+	Coord				coord, 
+	Coord				focalPoint,
+	Coord				rotationCentre,
+	XYZ				upDirection,
+	double			focalLength,
+	double			aperture,
+	double			eyeSeparation,
+	lucStereoType	stereoType,
+	FieldVariable*	centreFieldVariable )
+{
+	lucCamera* self = camera;
+
+	memcpy( self->coord, coord, sizeof(Coord) );
+	memcpy( self->focalPoint, focalPoint, sizeof(Coord) );
+	memcpy( self->rotationCentre, rotationCentre, sizeof(Coord) );
+	memcpy( self->upDirection, upDirection, sizeof(XYZ) );
+
+	self->focalLength         = focalLength;
+	self->aperture            = aperture;
+	self->eyeSeparation       = eyeSeparation;
+	self->stereoType          = stereoType;
+	self->centreFieldVariable = centreFieldVariable;
+
+	/* Store Original Values */
+	self->needsToDraw   = True;
+	self->buffer        = lucLeft;
+	self->originalCamera = lucCamera_Copy( self );
+}
+
+void _lucCamera_Delete( void* camera ) {
+	lucCamera* self = camera;
+	
+	_Stg_Component_Delete( self );
+}
+
+void _lucCamera_Print( void* camera, Stream* stream ) {
+	lucCamera* self        = camera;
+	
+	Journal_Printf( stream, "lucCamera: %s\n", self->name );
+
+	Stream_Indent( stream );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	Journal_PrintArray( stream, self->coord, 3 );
+	Journal_PrintArray( stream, self->focalPoint, 3 );
+	Journal_PrintArray( stream, self->rotationCentre, 3 );
+	Journal_PrintArray( stream, self->upDirection, 3 );
+	
+	Journal_PrintValue( stream, self->aperture );
+
+	Journal_Printf( stream, "self->stereoType = ");
+	switch ( self->stereoType ) {
+		case lucMono:
+			Journal_Printf( stream, "lucMono\n" ); break;
+		case lucStereoToeIn:
+			Journal_Printf( stream, "lucStereoToeIn\n" ); break;
+		case lucStereoAsymmetric:
+			Journal_Printf( stream, "lucStereoAsymmetric\n" ); break;
+	}
+	
+	Journal_Printf( stream, "self->buffer = ");
+	switch ( self->buffer ) {
+		case lucLeft:
+			Journal_Printf( stream, "lucLeft\n" ); break;
+		case lucRight:
+			Journal_Printf( stream, "lucRight\n" ); break;
+	}
+	Journal_PrintValue( stream, self->eyeSeparation );
+
+	Stream_UnIndent( stream );
+}
+
+void* _lucCamera_Copy( void* camera, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucCamera* self        = camera;
+	lucCamera* newCamera;
+
+	newCamera = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newCamera->originalCamera      = NULL;
+   newCamera->centreFieldVariable = NULL;
+
+	memcpy( newCamera->coord,          self->coord,          sizeof(Coord) );
+	memcpy( newCamera->focalPoint,     self->focalPoint,     sizeof(Coord) );
+	memcpy( newCamera->rotationCentre, self->rotationCentre, sizeof(Coord) );
+	memcpy( newCamera->upDirection,    self->upDirection,    sizeof(XYZ  ) );
+
+   newCamera->focalLength   = self->focalLength;
+	newCamera->aperture      = self->aperture;
+	newCamera->eyeSeparation = self->eyeSeparation;   
+	newCamera->buffer        = self->buffer;
+	newCamera->stereoType    = self->stereoType;
+	newCamera->needsToDraw   = self->needsToDraw;
+
+	return (void*) newCamera;
+}
+
+void _lucCamera_AssignFromXML( void* camera, Stg_ComponentFactory* cf, void* data ) {
+	lucCamera*             self               = (lucCamera*) camera;
+	Coord                  coord;
+	Coord                  focalPoint;
+	Coord                  rotationCentre;
+	XYZ                    upDirection;
+	FieldVariable*         centreFieldVariable;
+	double                 focalLength;
+	double                 aperture;
+	double                 eyeSeparation;
+	lucStereoType          stereoType;
+	Name                   stereoTypeName;
+
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
+	
+  #define DTOR 0.0174532925
+	focalPoint[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalPointX", 0.0  );
+	focalPoint[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalPointY", 0.0  );
+	focalPoint[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalPointZ", 0.0  );
+
+	rotationCentre[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"rotationCentreX", 0.0  );
+	rotationCentre[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"rotationCentreY", 0.0  );
+	rotationCentre[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"rotationCentreZ", 0.0  );
+
+	upDirection[I_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"upDirectionX", 0.0  );
+	upDirection[J_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"upDirectionY", 1.0  );
+	upDirection[K_AXIS] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"upDirectionZ", 0.0  );
+	
+	focalLength = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"focalLength", 0.0  );
+
+	coord[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordX", 0.0  );
+	coord[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordY", 0.0  );
+	coord[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"coordZ", 1.0  );
+
+	aperture = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"aperture", 45.0  );
+
+	/* Get Stereo Type */
+	stereoTypeName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"stereoType", "lucMono"  );
+	if ( strcasecmp( stereoTypeName, "ToeIn" ) == 0 ) 
+		stereoType = lucStereoToeIn;
+	else if ( strcasecmp( stereoTypeName, "Asymmetric" ) == 0 ) 
+		stereoType = lucStereoAsymmetric;
+	else 
+		stereoType = lucMono;
+
+	eyeSeparation  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"eyeSeparation", 0.2  );
+
+	centreFieldVariable = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"CentreFieldVariable", FieldVariable, False, data );
+
+	_lucCamera_Init( self, coord, focalPoint, rotationCentre, upDirection, focalLength, aperture, eyeSeparation, stereoType, centreFieldVariable );
+}
+
+void _lucCamera_Build( void* camera, void* data ) { 
+	lucCamera*     self = (lucCamera*) camera;
+	FieldVariable* fieldVariable = self->centreFieldVariable;
+
+	if ( fieldVariable ) {
+		Stg_Component_Build( fieldVariable, data, False );
+	}
+}
+void _lucCamera_Initialise( void* camera, void* data ) { 
+	lucCamera*     self = (lucCamera*) camera;
+	FieldVariable* fieldVariable = self->centreFieldVariable;
+
+	if ( fieldVariable ) {
+		Stg_Component_Initialise( fieldVariable, data, False );
+		lucCamera_CentreFromFieldVariable( self );
+	}
+}
+
+void _lucCamera_Execute( void* camera, void* data ) { }
+
+void _lucCamera_Destroy( void* camera, void* data ) {
+}
+
+void lucCamera_Zoom( void* camera, double zoomFactor ) {
+	lucCamera* self                = camera;
+	XYZ        vectorFocusToCamera;
+	
+	StGermain_VectorSubtraction( vectorFocusToCamera, self->coord, self->focalPoint, 3 );
+	vectorFocusToCamera[ I_AXIS ] *= zoomFactor;
+	vectorFocusToCamera[ J_AXIS ] *= zoomFactor;
+	vectorFocusToCamera[ K_AXIS ] *= zoomFactor;
+	StGermain_VectorAddition( self->coord, vectorFocusToCamera, self->focalPoint, 3 );
+	
+	self->needsToDraw = True;
+}
+
+void lucCamera_RotateAroundUpDirection( void* camera, double deltaTheta ) {
+	lucCamera* self                = camera;
+	XYZ        vec;
+	XYZ        rotatedVec;
+
+	StGermain_VectorSubtraction( vec, self->coord, self->rotationCentre, 3 );
+	StGermain_RotateVector( rotatedVec, vec, self->upDirection, deltaTheta );
+	StGermain_VectorAddition( self->coord, rotatedVec, self->rotationCentre, 3 );
+	
+	StGermain_VectorSubtraction( vec, self->focalPoint, self->rotationCentre, 3 );
+	StGermain_RotateVector( rotatedVec, vec, self->upDirection, deltaTheta );
+	StGermain_VectorAddition( self->focalPoint, rotatedVec, self->rotationCentre, 3 );
+	
+	self->needsToDraw = True;
+}
+
+void lucCamera_RotateTowardsUpDirection( void* camera, double deltaTheta ) {
+	lucCamera*   self                = camera;
+	XYZ          rotationAxis;
+	XYZ          vec;
+	XYZ          rotatedVec;
+	double       angleBetween;
+	double       predictedAngle;
+	const double minAngle            = M_PI/180.0 * 0.1; /* A tenth of a degree */
+	const double maxAngle            = M_PI - minAngle;
+
+	StGermain_VectorSubtraction( vec, self->coord, self->focalPoint, 3 );
+	StGermain_VectorCrossProduct( rotationAxis, vec, self->upDirection );
+	StGermain_VectorNormalise( rotationAxis, 3 );
+
+	/* Check if angle is too large */
+	angleBetween = StGermain_AngleBetweenVectors( vec, self->upDirection, 3 );
+	predictedAngle = angleBetween - deltaTheta;
+	if ( predictedAngle < minAngle ) 
+		deltaTheta = angleBetween - minAngle;
+	else if ( predictedAngle > maxAngle ) 
+		deltaTheta = angleBetween - maxAngle;
+		
+	StGermain_VectorSubtraction( vec, self->coord, self->rotationCentre, 3 );
+	StGermain_RotateVector( rotatedVec, vec, rotationAxis, deltaTheta );
+	StGermain_VectorAddition( self->coord, rotatedVec, self->rotationCentre, 3 );
+	
+	StGermain_VectorSubtraction( vec, self->focalPoint, self->rotationCentre, 3 );
+	StGermain_RotateVector( rotatedVec, vec, rotationAxis, deltaTheta );
+	StGermain_VectorAddition( self->focalPoint, rotatedVec, self->rotationCentre, 3 );
+
+	self->needsToDraw = True;
+}
+
+void lucCamera_Reset( void* camera ) {
+	lucCamera* self                = camera;
+	lucCamera* originalCamera      = self->originalCamera;
+	
+	Stg_Class_Copy( originalCamera, self, False, NULL, NULL );
+	self->originalCamera = originalCamera;
+	self->needsToDraw = True;
+}
+
+void lucCamera_SetOriginal( void* camera ) {
+	lucCamera* self                = camera;
+	
+	Stg_Class_Copy( self, self->originalCamera, False, NULL, NULL );
+	self->originalCamera->originalCamera = NULL;
+}
+
+void lucCamera_Broadcast( void* camera, int rootRank, MPI_Comm comm ) {
+	lucCamera* self                = camera;
+
+	Journal_DPrintfL( lucDebug, 2, "In %s for %s '%s'.\n", __func__, self->type, self->name );
+
+	MPI_Bcast( self, 1, lucCamera_MPI_Datatype, rootRank, comm );
+}
+
+void lucCamera_GetFocusDirection( void* camera, XYZ focusDirection ) {
+	lucCamera*   self                = camera;
+	
+	StGermain_VectorSubtraction( focusDirection, self->focalPoint, self->coord, 3 );
+	StGermain_VectorNormalise( focusDirection, 3 );
+}
+
+void lucCamera_GetLeftDirection( void* camera, XYZ leftDirection ) {
+	lucCamera*   self                = camera;
+	XYZ          focusDirection;
+	
+	lucCamera_GetFocusDirection( self, focusDirection );
+	StGermain_VectorCrossProduct( leftDirection, self->upDirection, focusDirection );
+	StGermain_VectorNormalise( leftDirection, 3 );
+}
+
+void lucCamera_SwapStereoBuffer( void* camera ) {
+	lucCamera* self                = camera;
+
+	if ( self->buffer == lucLeft )
+		self->buffer = lucRight;
+	else 
+		self->buffer = lucLeft;
+	self->needsToDraw = True;
+}
+
+void lucCamera_CurrentEyePosition( void* camera, Coord currEyePos ) {
+	lucCamera* self                = camera;
+	XYZ        leftDirection;
+	double     factor;
+
+	memcpy( currEyePos, self->coord, sizeof(Coord) );
+	if ( self->stereoType == lucMono )
+		return;
+
+	lucCamera_GetLeftDirection( camera, leftDirection );
+
+	factor = 0.5 * self->eyeSeparation;
+	if ( self->buffer == lucRight )
+		factor *= -1.0; 
+
+	currEyePos[ I_AXIS ] += factor * leftDirection[ I_AXIS ];
+	currEyePos[ J_AXIS ] += factor * leftDirection[ J_AXIS ];
+	currEyePos[ K_AXIS ] += factor * leftDirection[ K_AXIS ];
+}
+
+
+void lucCamera_CentreFromFieldVariable( void* camera ) {
+	lucCamera*     self = (lucCamera*) camera;
+	Coord          min, max;
+	Coord          oldFocalPoint;
+	XYZ            difference = {0.0,0.0,0.0};
+	FieldVariable* fieldVariable = self->centreFieldVariable;
+
+	if ( !fieldVariable )
+		return;
+
+	FieldVariable_GetMinAndMaxGlobalCoords( fieldVariable, min, max );
+  
+		
+	/* Set up focal point */
+	memcpy( oldFocalPoint, self->focalPoint, sizeof(Coord) );
+	self->focalPoint[I_AXIS] = 0.5 * (min[ I_AXIS ] + max[ I_AXIS ]);
+	self->focalPoint[J_AXIS] = 0.5 * (min[ J_AXIS ] + max[ J_AXIS ]);
+	if (fieldVariable->dim == 2) 
+		self->focalPoint[K_AXIS] = 0.0;
+	else 
+		self->focalPoint[K_AXIS] = 0.5 * (min[ K_AXIS ] + max[ K_AXIS ]);
+	
+	/* Set up camera */
+	StGermain_VectorSubtraction( difference, self->focalPoint, oldFocalPoint, fieldVariable->dim );
+	self->coord[ I_AXIS ] += difference[ I_AXIS ] ;
+	self->coord[ J_AXIS ] += difference[ J_AXIS ] ;
+	self->coord[ K_AXIS ] += difference[ K_AXIS ] ;
+
+	/* Adjust the rotation centre */
+	memcpy( self->rotationCentre, self->focalPoint, sizeof( Coord ) );
+
+	/* Adjust Original Camera */
+	self->originalCamera->coord[ I_AXIS ] += difference[ I_AXIS ] ;
+	self->originalCamera->coord[ J_AXIS ] += difference[ J_AXIS ] ;
+	self->originalCamera->coord[ K_AXIS ] += difference[ K_AXIS ] ;
+	memcpy( self->originalCamera->focalPoint, self->focalPoint, sizeof( Coord ) );
+	memcpy( self->originalCamera->rotationCentre, self->rotationCentre, sizeof( Coord ) );
+}
+
+void lucCamera_ChangeFocalPoint( void* camera, Pixel_Index startx, Pixel_Index starty, Pixel_Index xpos, Pixel_Index ypos ){
+	lucCamera*      self = (lucCamera*) camera;
+	XYZ             leftDirection;
+	Dimension_Index dim_I;
+
+	lucCamera_GetLeftDirection( camera, leftDirection );
+	for ( dim_I = 0 ; dim_I < 3 ; dim_I++ ) {
+		self->focalPoint[ dim_I ] += 0.01 * ((double)xpos - (double)startx) * leftDirection[ dim_I ];
+		self->focalPoint[ dim_I ] -= 0.01 * ((double)ypos - (double)starty) * self->upDirection[ dim_I ];
+	}
+
+	self->needsToDraw = True;
+}
+
+void lucCamera_Pickle( void* camera, Stream* stream ) {
+	lucCamera* self                = camera;
+	       
+	Journal_Printf( stream, "<struct name=\"%s\">\n", self->name);
+	Stream_Indent( stream );
+
+	Journal_Printf( stream, "<param name=\"Type\">%s</param>\n", self->type );
+	Journal_Printf( stream, "<param name=\"coordX\">%.5g</param>\n", self->coord[ I_AXIS ] );
+	Journal_Printf( stream, "<param name=\"coordY\">%.5g</param>\n", self->coord[ J_AXIS ] );
+	Journal_Printf( stream, "<param name=\"coordZ\">%.5g</param>\n", self->coord[ K_AXIS ] );
+
+	Journal_Printf( stream, "<param name=\"focalPointX\">%.5g</param>\n", self->focalPoint[ I_AXIS ] );
+	Journal_Printf( stream, "<param name=\"focalPointY\">%.5g</param>\n", self->focalPoint[ J_AXIS ] );
+	Journal_Printf( stream, "<param name=\"focalPointZ\">%.5g</param>\n", self->focalPoint[ K_AXIS ] );
+
+	Journal_Printf( stream, "<param name=\"rotationCentreX\">%.5g</param>\n", self->rotationCentre[ I_AXIS ] );
+	Journal_Printf( stream, "<param name=\"rotationCentreY\">%.5g</param>\n", self->rotationCentre[ J_AXIS ] );
+	Journal_Printf( stream, "<param name=\"rotationCentreZ\">%.5g</param>\n", self->rotationCentre[ K_AXIS ] );
+
+	Journal_Printf( stream, "<param name=\"upDirectionX\">%.5g</param>\n", self->upDirection[ I_AXIS ] );
+	Journal_Printf( stream, "<param name=\"upDirectionY\">%.5g</param>\n", self->upDirection[ J_AXIS ] );
+	Journal_Printf( stream, "<param name=\"upDirectionZ\">%.5g</param>\n", self->upDirection[ K_AXIS ] );
+
+	Journal_Printf( stream, "<param name=\"stereoType\">%s</param>\n", 
+			self->stereoType == lucStereoToeIn      ? "ToeIn" :
+			self->stereoType == lucStereoAsymmetric ? "Asymmetric" : "Mono" );
+	
+	Journal_Printf( stream, "<param name=\"eyeSeparation\">%.5g</param>\n", self->eyeSeparation );
+	Journal_Printf( stream, "<param name=\"focalLength\">%.5g</param>\n", self->focalLength );
+	Stream_UnIndent( stream );
+	Journal_Printf( stream, "</struct>\n");
+}
+void lucCamera_SetNeedsToDraw( void * camera ){
+	lucCamera* self = (lucCamera*) camera;
+	self->needsToDraw = True;
+}
+
+#define lucCamera_TypesCount 10
+void lucCamera_Create_MPI_Datatype() {
+	MPI_Datatype        typeList[lucCamera_TypesCount]     = 
+		{ MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_INT };
+	int                 blocklen[lucCamera_TypesCount]     = {3, 3, 3, 3, 1, 1, 1, 1, 1, 1};
+	MPI_Aint            displacement[lucCamera_TypesCount];
+	lucCamera           camera;
+
+	displacement[0] = GetOffsetOfMember( camera, coord );
+	displacement[1] = GetOffsetOfMember( camera, focalPoint );
+	displacement[2] = GetOffsetOfMember( camera, rotationCentre );
+	displacement[3] = GetOffsetOfMember( camera, upDirection );
+	displacement[4] = GetOffsetOfMember( camera, focalLength );
+	displacement[5] = GetOffsetOfMember( camera, aperture );
+	displacement[6] = GetOffsetOfMember( camera, eyeSeparation );
+	displacement[7] = GetOffsetOfMember( camera, buffer );
+	displacement[8] = GetOffsetOfMember( camera, stereoType );
+	displacement[9] = GetOffsetOfMember( camera, needsToDraw );
+	
+	MPI_Type_struct( lucCamera_TypesCount, blocklen, displacement, typeList, &lucCamera_MPI_Datatype );
+	MPI_Type_commit( & lucCamera_MPI_Datatype );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/ColourMap.c
--- a/Base/src/ColourMap.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,578 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: ColourMap.c 784 2008-08-18 13:54:31Z LukeHodkinson $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "types.h"
-#include "ColourMap.h"
-#include "X11Colours.h"
-#include "float.h"
-
-#include <string.h>
-#include <assert.h>
-
-const Type lucColourMap_Type = "lucColourMap";
-
-lucColourMap* lucColourMap_New( 
-		Name                                               name,
-		char*                                              colourMapString, 
-		double                                             minimum,
-		double                                             maximum,
-		Bool                                               logScale,
-		Bool                                               dynamicRange,
-		Bool											   centreOnFixedValue,
-		double											   centringValue	 )
-{
-	lucColourMap* self = (lucColourMap*) _lucColourMap_DefaultNew( name );
-
-	lucColourMap_InitAll( self, colourMapString, minimum, maximum, logScale, dynamicRange, centreOnFixedValue, centringValue );
-
-	return self;
-}
-
-lucColourMap* _lucColourMap_New(  LUCCOLOURMAP_DEFARGS  )
-{
-	lucColourMap*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucColourMap) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucColourMap*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucColourMap_Init( 
-		lucColourMap*                                      self, 
-		char*                                              _colourMapString, 
-		double                                             minimum,
-		double                                             maximum,
-		Bool                                               logScale,
-		Bool                                               dynamicRange,
-		Bool											   centreOnFixedValue,
-		double											   centringValue	 )
-{	
-	char*        colourMapString = StG_Strdup( _colourMapString );
-	Colour_Index colourCount;
-	Colour_Index colour_I;
-	char*        charPointer;
-	lucColour*    colour;
-	char*        breakChars = " \t\n;,"; 
-
-	self->minimum      = minimum;
-	self->maximum      = maximum;
-	self->logScale     = logScale;
-	self->dynamicRange = dynamicRange;
-	self->centreOnFixedValue = centreOnFixedValue;
-
-  if( centringValue == maximum || centringValue == minimum )
-    self->centringValue = 0.5*(maximum-minimum) + minimum;
-  else
-    self->centringValue = centringValue;
-	
-	/* Find number of colours */
-	colourCount = 1;
-	charPointer = strpbrk( colourMapString, breakChars );
-	while ( charPointer != NULL ) {
-		charPointer = strpbrk( charPointer + 1 , breakChars );
-		colourCount++;
-	}
-	self->colourCount = colourCount;
-
-	/* Allocate space for colour map */
-	self->colourList = Memory_Alloc_Array( lucColour , colourCount, "Colour map");
-
-	/* Initialise the space in the colour map */
-	for( colour_I = 0 ; colour_I < colourCount ; colour_I++ ) {
-		self->colourList[colour_I].red = 0;
-		self->colourList[colour_I].green = 0;
-		self->colourList[colour_I].blue = 0;
-		self->colourList[colour_I].opacity = 0;
-	}
-
-	/* Read String to get colour map */
-	charPointer = strtok( colourMapString, breakChars );
-	for ( colour_I = 0 ; colour_I < colourCount ; colour_I++ ) {
-		colour = lucColourMap_GetColourFromList( self, colour_I );
-		lucColour_FromString( colour, charPointer );
-		charPointer = strtok( NULL, breakChars );
-	}
-
-	Memory_Free( colourMapString );
-}
-
-void lucColourMap_InitAll( 
-		void*                                              colourMap, 
-		char*                                              colourMapString, 
-		double                                             minimum,
-		double                                             maximum,
-		Bool                                               logScale,
-		Bool                                               dynamicRange, 
-		Bool											   centreOnFixedValue,
-		double											   centringValue	 )
-{
-	lucColourMap* self        = colourMap;
-
-	_lucColourMap_Init( self, colourMapString, minimum, maximum, logScale, dynamicRange, centreOnFixedValue, centringValue );
-}
-		
-void _lucColourMap_Delete( void* colourMap ) {
-	lucColourMap* self        = colourMap;
-
-	Memory_Free( self->colourList );
-
-	_Stg_Component_Delete( self );
-}
-
-void _lucColourMap_Print( void* colourMap, Stream* stream ) {
-	lucColourMap* self        = colourMap;
-	Colour_Index  colour_I;
-	lucColour*    colour;
-	lucColour     black;
-	lucColour     white;
-	lucColour     colourFromValue;
-	Index         charCount = 100;
-	Index         char_I;
-	
-	black.red = black.green = black.blue = 0.0;
-	white.red = white.green = white.blue = 1.0;
-
-	Journal_Printf( stream, "lucColourMap: %s\n", self->name );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	Journal_PrintValue( stream, self->colourCount );
-	for ( colour_I = 0 ; colour_I < self->colourCount ; colour_I++ ) {
-		colour = lucColourMap_GetColourFromList( self, colour_I );
-		Journal_Printf( stream, "\tColour %u: Red - %6.3g, Green - %6.3g, Blue - %6.3g, Opacity - %6.3g\n", 
-				colour_I, colour->red, colour->green, colour->blue, colour->opacity );
-	}
-	
-	Journal_PrintValue( stream, self->minimum );
-	Journal_PrintValue( stream, self->maximum );
-	Journal_PrintBool( stream, self->logScale );
-	Journal_PrintBool( stream, self->dynamicRange );
-
-	/* Print Colour Map using terminal colours */
-	for ( char_I = 0 ; char_I < charCount ; char_I++ ) {
-		double value = (double) char_I / (double) (charCount - 1);
-		lucColourMap_GetColourFromValue( self, value, &colourFromValue );
-		lucColour_SetTerminalColours( &black, &colourFromValue, stream );
-		Journal_Printf( stream, " " );
-	}
-	lucColour_SetTerminalColours( &white, &black, stream );
-	Journal_Printf( stream, "\n" );
-
-	/* Print Scale For Colour Map */
-	Journal_Printf( stream, "%.4g", self->minimum );
-	for ( char_I = 0 ; char_I < charCount ; char_I++ ) 
-		Journal_Printf( stream, " " );
-	Journal_Printf( stream, "%.4g\n", self->maximum );
-
-}
-
-void* _lucColourMap_Copy( void* colourMap, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucColourMap* self        = colourMap;
-	lucColourMap* newColourMap;
-
-	newColourMap = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newColourMap->colourCount         = self->colourCount;
-	newColourMap->minimum             = self->minimum;
-	newColourMap->maximum             = self->maximum;
-	newColourMap->logScale            = self->logScale;
-	newColourMap->dynamicRange        = self->dynamicRange;
-	newColourMap->centreOnFixedValue  = self->centreOnFixedValue;
-	newColourMap->centringValue       = self->centringValue;
-
-	if (deep)
-		memcpy( newColourMap->colourList, self->colourList, self->colourCount * sizeof(lucColour) );
-	else 
-		newColourMap->colourList = self->colourList;
-
-	return (void*) newColourMap;
-}
-
-
-void* _lucColourMap_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof( lucColourMap );
-	Type                                                      type = lucColourMap_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucColourMap_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucColourMap_Print;
-	Stg_Class_CopyFunction*                                  _copy = _lucColourMap_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucColourMap_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucColourMap_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucColourMap_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucColourMap_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucColourMap_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucColourMap_Destroy;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucColourMap_New(  LUCCOLOURMAP_PASSARGS  );
-}
-
-void _lucColourMap_AssignFromXML( void* colourMap, Stg_ComponentFactory* cf, void* data ) {
-	lucColourMap* self             = (lucColourMap*) colourMap;
-
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
-
-	_lucColourMap_Init( 
-			self, 
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colours", "Blue;White;Red" ), 
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minimum", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maximum", 1.0  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"logScale", False  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"dynamicRange", False  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"centreOnFixedValue", False  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"centringValue", 0.0 )
-	 );
-
-    self->discrete = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"discrete", False  );
-}
-
-void _lucColourMap_Build( void* colourMap, void* data ) { }
-void _lucColourMap_Initialise( void* colourMap, void* data ) { }
-void _lucColourMap_Execute( void* colourMap, void* data ) { }
-void _lucColourMap_Destroy( void* colourMap, void* data ) { }
-
-void lucColourMap_GetColourFromValue( void* colourMap, double value, lucColour* colour ) {
-	lucColourMap* self;
-
-	self = colourMap;
-
-	/* Scale value to range [0,1] */
-	float scaledValue = lucColourMap_ScaleValue(colourMap, value);
-
-	/* Convert scaled value to colour */
-	lucColourMap_GetColourFromScaledValue(colourMap, scaledValue, colour );
-}
-
-float lucColourMap_ScaleValue( void* colourMap, double value ) {
-	lucColourMap* self        = colourMap;
-	double 	      scaledValue, max, min, centre, sampleValue;
-
-    if (value == self->minimum) return 0.0;
-    if (value == self->maximum) return 1.0;
-
-    /* To get a log scale, transform each value to log10(value) */
-	if (self->logScale == True) {
-		max 	    = log10(self->maximum);
-		min  	    = log10(self->minimum);
-		sampleValue = log10(value);
-	}
-	else {
-		max 	    = self->maximum;
-		min  	    = self->minimum;
-		centre 	    = self->centringValue;
-		sampleValue = value;
-	}
-	
-    /* Scale value so that it is between 0 and 1 */
-	if (self->logScale || !self->centreOnFixedValue) {
-        scaledValue = (sampleValue - min) / (max - min);
-    }
-    else
-    {
-    	/* Scale value so that it is between 0 and 1, taking into account
-    		the fact that centringValue should be at a scaled value 0.5 */
-    	if (sampleValue > centre)
-    		scaledValue = 0.5 + 0.5 * (sampleValue - centre)/(max - centre);
-    	else
-    		scaledValue = 0.5 * (sampleValue - min) / (centre - min); 
-    }
-
-    return scaledValue;
-}
-
-void lucColourMap_GetColourFromScaledValue( void* colourMap, float scaledValue, lucColour* colour ) 
-{
-	lucColourMap* self        = colourMap;
-	Colour_Index  colourBelow_I;
-	lucColour*    colourBelow;
-	lucColour*    colourAbove;
-	float         remainder;
-	Colour_Index  colourCount = self->colourCount;
-
-    /* Check within range */
-    if (scaledValue <= 0.0 || colourCount == 1) {
-		memcpy( colour, lucColourMap_GetColourFromList( self, 0 ), sizeof(lucColour) );
-		return;
-	}
-	if (scaledValue >= 1.0) {
-		memcpy( colour, lucColourMap_GetColourFromList( self, colourCount - 1 ), sizeof(lucColour) );
-		return;
-	}
-
-	/* Discrete colourmap option does not interpolate between colours */
-    if( !self->discrete ) {
-       colourBelow_I = (Colour_Index) ( ( colourCount - 1 ) * scaledValue );
-       colourBelow   = lucColourMap_GetColourFromList( self, colourBelow_I );
-       colourAbove   = lucColourMap_GetColourFromList( self, colourBelow_I + 1 );
-
-       remainder = (float)( colourCount - 1 ) * scaledValue - (float) colourBelow_I;
-
-       /* Do linear interpolation between colours */
-       colour->red     = ( colourAbove->red     - colourBelow->red     ) * remainder + colourBelow->red;
-       colour->green   = ( colourAbove->green   - colourBelow->green   ) * remainder + colourBelow->green;
-       colour->blue    = ( colourAbove->blue    - colourBelow->blue    ) * remainder + colourBelow->blue;
-       colour->opacity = ( colourAbove->opacity - colourBelow->opacity ) * remainder + colourBelow->opacity;
-    }
-    else {
-       colourBelow_I = (Colour_Index) ( (float)colourCount * scaledValue );
-       colourBelow = lucColourMap_GetColourFromList( self, colourBelow_I );
-       colour->red = colourBelow->red;
-       colour->green = colourBelow->green;
-       colour->blue = colourBelow->blue;
-       colour->opacity = colourBelow->opacity;
-    }
-}
-
-void lucColourMap_SetMinMax( void* colourMap, double min, double max ) {
-	lucColourMap* self       = colourMap;
-	double        tolerance  = 1e-10;
-    Stream*       stream     = Journal_Register( InfoStream_Type, (Name)self->type );
-	/* Shift max and min if they are too close */
-	if (fabs(min - max) < tolerance) {	
-		max += tolerance;
-		min -= tolerance;
-	}
-
-	/* Copy to colour map */
-	self->minimum = min;
-	self->maximum = max;
-	if(self->logScale){
-	   if(self->minimum <= FLT_MIN  ) {
-	      self->minimum =  FLT_MIN;
-	      Journal_DPrintf( stream, "\n WARNING: Field used for logscale colourmap possibly contains non-positive values. \n" );
-	   }
-	   if(self->maximum <= FLT_MIN ) {
-	      self->maximum =  FLT_MIN;
-	      Journal_DPrintf( stream, "\n WARNING: Field used for logscale colourmap possibly contains non-positive values. \n" );
-	   }
-	}
-	
-    /* If a centringValue has been imposed on a dynamic problem it should
-        force the max / min to contain it correctly */
-            
-    if (Num_Approx(self->centringValue, 0.0)) self->centringValue = 0.5 * (max - min) + min;
-
-    if (self->centringValue < min)
-        min = self->centringValue - tolerance;
-    
-    if (self->centringValue > max)	
-        max = self->centringValue + tolerance;
-		
-}
-
-void lucColourMap_CalibrateFromVariable( void* colourMap, void* _variable ) {
-	lucColourMap* self        = colourMap;
-	Variable*     variable    = (Variable*)_variable;
-	Index         array_I;
-	Index         arrayCount  = *variable->arraySizePtr;
-	double        value;
-	double        localMin    = 1.0e99;
-	double        localMax    = -1.0e99;
-	double        globalMax;
-	double        globalMin;
-
-	if ( !self->dynamicRange ) return;
-
-	for ( array_I = 0 ; array_I < arrayCount ; array_I++ ){
-		/* Get scalar value from particle */
-		value = Variable_GetValueDouble( variable, array_I ) ;
-
-		if ( value < localMin ) 
-			localMin = value;
-		else if ( value > localMax ) 
-			localMax = value;
-	}
-	
-	MPI_Allreduce( &localMin, &globalMin, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD );
-	MPI_Allreduce( &localMax, &globalMax, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
-
-	lucColourMap_SetMinMax( self, globalMin, globalMax );
-}
-
-void lucColourMap_CalibrateFromFieldVariable( void* colourMap, void* _fieldVariable ) {
-	lucColourMap*   self          = colourMap;
-	FieldVariable*  fieldVariable = (FieldVariable*)_fieldVariable;
-
-	if ( !self->dynamicRange ) return;
-
-	lucColourMap_SetMinMax( 
-			self, 
-			FieldVariable_GetMinGlobalFieldMagnitude( fieldVariable ), 
-			FieldVariable_GetMaxGlobalFieldMagnitude( fieldVariable ) );
-}
-
-void lucColourMap_CalibrateFromSwarmVariable( void* colourMap, void* swarmVariable ) {
-	lucColourMap*   self          = colourMap;
-
-	if ( !self->dynamicRange ) return;
-
-	lucColourMap_SetMinMax( 
-			self, 
-			SwarmVariable_GetMinGlobalMagnitude( swarmVariable ), 
-			SwarmVariable_GetMaxGlobalMagnitude( swarmVariable ) );
-}
-
-void lucColour_FromHSV( lucColour* self, float hue, float saturation, float value, float opacity ) {
-	int   Hi     = (int) ( hue/60.0 );
-	float f      = hue/60.0 - (float) Hi;
-	float p      = value * ( 1.0 - saturation );
-	float q      = value * ( 1.0 - saturation * f );
-	float t      = value * ( 1.0 - saturation * ( 1.0 - f ));
-
-	switch ( Hi ){
-		case 0:
-			self->red = value;   self->green = t;       self->blue = p;     break;
-		case 1:
-			self->red = q;       self->green = value;   self->blue = p;     break;
-		case 2:
-			self->red = p;       self->green = value;   self->blue = t;     break;
-		case 3:
-			self->red = p;       self->green = q;       self->blue = value; break;
-		case 4:
-			self->red = t;       self->green = p;       self->blue = value; break;
-		case 5:
-			self->red = value;   self->green = p;       self->blue = q;     break;
-	}
-
-	self->opacity = opacity;
-}
-	
-	
-
-void lucColour_FromString( lucColour* self, char* string ) {
-	char* charPointer;
-	float opacity;
-
-	lucColour_FromX11ColourName( self, string );
-
-	/* Get Opacity From String */
-	/* Opacity must be read in after the ":" of the name of the colour */
-	charPointer = strchr( string, ':' );
-
-	if (charPointer != NULL) {
-		/* Return full opactity (non-transparent) if no opacity is set */
-		if (sscanf( charPointer + 1, "%f", &opacity )	!= 1) 
-			opacity = 1.0;
-	}
-	else 
-		opacity = 1.0;
-	self->opacity = opacity;
-}
-
-typedef enum {
-	Terminal_Black,
-	Terminal_Red,
-	Terminal_Green,
-	Terminal_Yellow,
-	Terminal_Blue,
-	Terminal_Magenta,
-	Terminal_Cyan,
-	Terminal_Grey,
-	Terminal_White 
-} Terminal_Colour;
-
-Terminal_Colour lucColour_GetClosestTerminalColour( lucColour* self ) {
-	Bool hasRed   = ( self->red   > 0.5 );
-	Bool hasGreen = ( self->green > 0.5 );
-	Bool hasBlue  = ( self->blue  > 0.5 );
-	
-	/* Shades */
-	if ( ! hasRed && ! hasGreen && ! hasBlue ) 
-		return Terminal_Black;
-
-	if ( hasRed && hasGreen && hasBlue ) 
-		return Terminal_White;
-	
-	/* Primary Colours */
-	if ( hasRed && ! hasGreen && ! hasBlue ) 
-		return Terminal_Red;
-
-	if ( ! hasRed && hasGreen && ! hasBlue ) 
-		return Terminal_Green;
-	
-	if ( ! hasRed && ! hasGreen && hasBlue ) 
-		return Terminal_Blue;
-
-	/* Secondary Colours */
-	if ( hasRed && ! hasGreen && hasBlue ) 
-		return Terminal_Magenta;
-
-	if ( ! hasRed && hasGreen && hasBlue ) 
-		return Terminal_Cyan;
-	
-	if ( hasRed && hasGreen && ! hasBlue ) 
-		return Terminal_Yellow;
-
-	abort();
-	return Terminal_Black;
-}
-
-void lucColour_SetTerminalColours( lucColour* textColour, lucColour* backgroundColour, Stream* stream ) {
-	int reset = 0;
-	
-	/* Command is the control command to the terminal */
-	Journal_Printf( stream, "%c[%d;%d;%dm", 
-			0x1B, 
-			reset, 
-			lucColour_GetClosestTerminalColour( textColour ) + 30, 
-			lucColour_GetClosestTerminalColour( backgroundColour ) + 40 );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/ColourMap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/ColourMap.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,578 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: ColourMap.c 784 2008-08-18 13:54:31Z LukeHodkinson $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "types.h"
+#include "ColourMap.h"
+#include "X11Colours.h"
+#include "float.h"
+
+#include <string.h>
+#include <assert.h>
+
+const Type lucColourMap_Type = "lucColourMap";
+
+lucColourMap* lucColourMap_New( 
+		Name                                               name,
+		char*                                              colourMapString, 
+		double                                             minimum,
+		double                                             maximum,
+		Bool                                               logScale,
+		Bool                                               dynamicRange,
+		Bool											   centreOnFixedValue,
+		double											   centringValue	 )
+{
+	lucColourMap* self = (lucColourMap*) _lucColourMap_DefaultNew( name );
+
+	lucColourMap_InitAll( self, colourMapString, minimum, maximum, logScale, dynamicRange, centreOnFixedValue, centringValue );
+
+	return self;
+}
+
+lucColourMap* _lucColourMap_New(  LUCCOLOURMAP_DEFARGS  )
+{
+	lucColourMap*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucColourMap) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucColourMap*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucColourMap_Init( 
+		lucColourMap*                                      self, 
+		char*                                              _colourMapString, 
+		double                                             minimum,
+		double                                             maximum,
+		Bool                                               logScale,
+		Bool                                               dynamicRange,
+		Bool											   centreOnFixedValue,
+		double											   centringValue	 )
+{	
+	char*        colourMapString = StG_Strdup( _colourMapString );
+	Colour_Index colourCount;
+	Colour_Index colour_I;
+	char*        charPointer;
+	lucColour*    colour;
+	char*        breakChars = " \t\n;,"; 
+
+	self->minimum      = minimum;
+	self->maximum      = maximum;
+	self->logScale     = logScale;
+	self->dynamicRange = dynamicRange;
+	self->centreOnFixedValue = centreOnFixedValue;
+
+  if( centringValue == maximum || centringValue == minimum )
+    self->centringValue = 0.5*(maximum-minimum) + minimum;
+  else
+    self->centringValue = centringValue;
+	
+	/* Find number of colours */
+	colourCount = 1;
+	charPointer = strpbrk( colourMapString, breakChars );
+	while ( charPointer != NULL ) {
+		charPointer = strpbrk( charPointer + 1 , breakChars );
+		colourCount++;
+	}
+	self->colourCount = colourCount;
+
+	/* Allocate space for colour map */
+	self->colourList = Memory_Alloc_Array( lucColour , colourCount, "Colour map");
+
+	/* Initialise the space in the colour map */
+	for( colour_I = 0 ; colour_I < colourCount ; colour_I++ ) {
+		self->colourList[colour_I].red = 0;
+		self->colourList[colour_I].green = 0;
+		self->colourList[colour_I].blue = 0;
+		self->colourList[colour_I].opacity = 0;
+	}
+
+	/* Read String to get colour map */
+	charPointer = strtok( colourMapString, breakChars );
+	for ( colour_I = 0 ; colour_I < colourCount ; colour_I++ ) {
+		colour = lucColourMap_GetColourFromList( self, colour_I );
+		lucColour_FromString( colour, charPointer );
+		charPointer = strtok( NULL, breakChars );
+	}
+
+	Memory_Free( colourMapString );
+}
+
+void lucColourMap_InitAll( 
+		void*                                              colourMap, 
+		char*                                              colourMapString, 
+		double                                             minimum,
+		double                                             maximum,
+		Bool                                               logScale,
+		Bool                                               dynamicRange, 
+		Bool											   centreOnFixedValue,
+		double											   centringValue	 )
+{
+	lucColourMap* self        = colourMap;
+
+	_lucColourMap_Init( self, colourMapString, minimum, maximum, logScale, dynamicRange, centreOnFixedValue, centringValue );
+}
+		
+void _lucColourMap_Delete( void* colourMap ) {
+	lucColourMap* self        = colourMap;
+
+	Memory_Free( self->colourList );
+
+	_Stg_Component_Delete( self );
+}
+
+void _lucColourMap_Print( void* colourMap, Stream* stream ) {
+	lucColourMap* self        = colourMap;
+	Colour_Index  colour_I;
+	lucColour*    colour;
+	lucColour     black;
+	lucColour     white;
+	lucColour     colourFromValue;
+	Index         charCount = 100;
+	Index         char_I;
+	
+	black.red = black.green = black.blue = 0.0;
+	white.red = white.green = white.blue = 1.0;
+
+	Journal_Printf( stream, "lucColourMap: %s\n", self->name );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	Journal_PrintValue( stream, self->colourCount );
+	for ( colour_I = 0 ; colour_I < self->colourCount ; colour_I++ ) {
+		colour = lucColourMap_GetColourFromList( self, colour_I );
+		Journal_Printf( stream, "\tColour %u: Red - %6.3g, Green - %6.3g, Blue - %6.3g, Opacity - %6.3g\n", 
+				colour_I, colour->red, colour->green, colour->blue, colour->opacity );
+	}
+	
+	Journal_PrintValue( stream, self->minimum );
+	Journal_PrintValue( stream, self->maximum );
+	Journal_PrintBool( stream, self->logScale );
+	Journal_PrintBool( stream, self->dynamicRange );
+
+	/* Print Colour Map using terminal colours */
+	for ( char_I = 0 ; char_I < charCount ; char_I++ ) {
+		double value = (double) char_I / (double) (charCount - 1);
+		lucColourMap_GetColourFromValue( self, value, &colourFromValue );
+		lucColour_SetTerminalColours( &black, &colourFromValue, stream );
+		Journal_Printf( stream, " " );
+	}
+	lucColour_SetTerminalColours( &white, &black, stream );
+	Journal_Printf( stream, "\n" );
+
+	/* Print Scale For Colour Map */
+	Journal_Printf( stream, "%.4g", self->minimum );
+	for ( char_I = 0 ; char_I < charCount ; char_I++ ) 
+		Journal_Printf( stream, " " );
+	Journal_Printf( stream, "%.4g\n", self->maximum );
+
+}
+
+void* _lucColourMap_Copy( void* colourMap, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucColourMap* self        = colourMap;
+	lucColourMap* newColourMap;
+
+	newColourMap = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newColourMap->colourCount         = self->colourCount;
+	newColourMap->minimum             = self->minimum;
+	newColourMap->maximum             = self->maximum;
+	newColourMap->logScale            = self->logScale;
+	newColourMap->dynamicRange        = self->dynamicRange;
+	newColourMap->centreOnFixedValue  = self->centreOnFixedValue;
+	newColourMap->centringValue       = self->centringValue;
+
+	if (deep)
+		memcpy( newColourMap->colourList, self->colourList, self->colourCount * sizeof(lucColour) );
+	else 
+		newColourMap->colourList = self->colourList;
+
+	return (void*) newColourMap;
+}
+
+
+void* _lucColourMap_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof( lucColourMap );
+	Type                                                      type = lucColourMap_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucColourMap_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucColourMap_Print;
+	Stg_Class_CopyFunction*                                  _copy = _lucColourMap_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucColourMap_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucColourMap_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucColourMap_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucColourMap_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucColourMap_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucColourMap_Destroy;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucColourMap_New(  LUCCOLOURMAP_PASSARGS  );
+}
+
+void _lucColourMap_AssignFromXML( void* colourMap, Stg_ComponentFactory* cf, void* data ) {
+	lucColourMap* self             = (lucColourMap*) colourMap;
+
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
+
+	_lucColourMap_Init( 
+			self, 
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colours", "Blue;White;Red" ), 
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minimum", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maximum", 1.0  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"logScale", False  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"dynamicRange", False  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"centreOnFixedValue", False  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"centringValue", 0.0 )
+	 );
+
+    self->discrete = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"discrete", False  );
+}
+
+void _lucColourMap_Build( void* colourMap, void* data ) { }
+void _lucColourMap_Initialise( void* colourMap, void* data ) { }
+void _lucColourMap_Execute( void* colourMap, void* data ) { }
+void _lucColourMap_Destroy( void* colourMap, void* data ) { }
+
+void lucColourMap_GetColourFromValue( void* colourMap, double value, lucColour* colour ) {
+	lucColourMap* self;
+
+	self = colourMap;
+
+	/* Scale value to range [0,1] */
+	float scaledValue = lucColourMap_ScaleValue(colourMap, value);
+
+	/* Convert scaled value to colour */
+	lucColourMap_GetColourFromScaledValue(colourMap, scaledValue, colour );
+}
+
+float lucColourMap_ScaleValue( void* colourMap, double value ) {
+	lucColourMap* self        = colourMap;
+	double 	      scaledValue, max, min, centre, sampleValue;
+
+    if (value == self->minimum) return 0.0;
+    if (value == self->maximum) return 1.0;
+
+    /* To get a log scale, transform each value to log10(value) */
+	if (self->logScale == True) {
+		max 	    = log10(self->maximum);
+		min  	    = log10(self->minimum);
+		sampleValue = log10(value);
+	}
+	else {
+		max 	    = self->maximum;
+		min  	    = self->minimum;
+		centre 	    = self->centringValue;
+		sampleValue = value;
+	}
+	
+    /* Scale value so that it is between 0 and 1 */
+	if (self->logScale || !self->centreOnFixedValue) {
+        scaledValue = (sampleValue - min) / (max - min);
+    }
+    else
+    {
+    	/* Scale value so that it is between 0 and 1, taking into account
+    		the fact that centringValue should be at a scaled value 0.5 */
+    	if (sampleValue > centre)
+    		scaledValue = 0.5 + 0.5 * (sampleValue - centre)/(max - centre);
+    	else
+    		scaledValue = 0.5 * (sampleValue - min) / (centre - min); 
+    }
+
+    return scaledValue;
+}
+
+void lucColourMap_GetColourFromScaledValue( void* colourMap, float scaledValue, lucColour* colour ) 
+{
+	lucColourMap* self        = colourMap;
+	Colour_Index  colourBelow_I;
+	lucColour*    colourBelow;
+	lucColour*    colourAbove;
+	float         remainder;
+	Colour_Index  colourCount = self->colourCount;
+
+    /* Check within range */
+    if (scaledValue <= 0.0 || colourCount == 1) {
+		memcpy( colour, lucColourMap_GetColourFromList( self, 0 ), sizeof(lucColour) );
+		return;
+	}
+	if (scaledValue >= 1.0) {
+		memcpy( colour, lucColourMap_GetColourFromList( self, colourCount - 1 ), sizeof(lucColour) );
+		return;
+	}
+
+	/* Discrete colourmap option does not interpolate between colours */
+    if( !self->discrete ) {
+       colourBelow_I = (Colour_Index) ( ( colourCount - 1 ) * scaledValue );
+       colourBelow   = lucColourMap_GetColourFromList( self, colourBelow_I );
+       colourAbove   = lucColourMap_GetColourFromList( self, colourBelow_I + 1 );
+
+       remainder = (float)( colourCount - 1 ) * scaledValue - (float) colourBelow_I;
+
+       /* Do linear interpolation between colours */
+       colour->red     = ( colourAbove->red     - colourBelow->red     ) * remainder + colourBelow->red;
+       colour->green   = ( colourAbove->green   - colourBelow->green   ) * remainder + colourBelow->green;
+       colour->blue    = ( colourAbove->blue    - colourBelow->blue    ) * remainder + colourBelow->blue;
+       colour->opacity = ( colourAbove->opacity - colourBelow->opacity ) * remainder + colourBelow->opacity;
+    }
+    else {
+       colourBelow_I = (Colour_Index) ( (float)colourCount * scaledValue );
+       colourBelow = lucColourMap_GetColourFromList( self, colourBelow_I );
+       colour->red = colourBelow->red;
+       colour->green = colourBelow->green;
+       colour->blue = colourBelow->blue;
+       colour->opacity = colourBelow->opacity;
+    }
+}
+
+void lucColourMap_SetMinMax( void* colourMap, double min, double max ) {
+	lucColourMap* self       = colourMap;
+	double        tolerance  = 1e-10;
+    Stream*       stream     = Journal_Register( InfoStream_Type, (Name)self->type );
+	/* Shift max and min if they are too close */
+	if (fabs(min - max) < tolerance) {	
+		max += tolerance;
+		min -= tolerance;
+	}
+
+	/* Copy to colour map */
+	self->minimum = min;
+	self->maximum = max;
+	if(self->logScale){
+	   if(self->minimum <= FLT_MIN  ) {
+	      self->minimum =  FLT_MIN;
+	      Journal_DPrintf( stream, "\n WARNING: Field used for logscale colourmap possibly contains non-positive values. \n" );
+	   }
+	   if(self->maximum <= FLT_MIN ) {
+	      self->maximum =  FLT_MIN;
+	      Journal_DPrintf( stream, "\n WARNING: Field used for logscale colourmap possibly contains non-positive values. \n" );
+	   }
+	}
+	
+    /* If a centringValue has been imposed on a dynamic problem it should
+        force the max / min to contain it correctly */
+            
+    if (Num_Approx(self->centringValue, 0.0)) self->centringValue = 0.5 * (max - min) + min;
+
+    if (self->centringValue < min)
+        min = self->centringValue - tolerance;
+    
+    if (self->centringValue > max)	
+        max = self->centringValue + tolerance;
+		
+}
+
+void lucColourMap_CalibrateFromVariable( void* colourMap, void* _variable ) {
+	lucColourMap* self        = colourMap;
+	Variable*     variable    = (Variable*)_variable;
+	Index         array_I;
+	Index         arrayCount  = *variable->arraySizePtr;
+	double        value;
+	double        localMin    = 1.0e99;
+	double        localMax    = -1.0e99;
+	double        globalMax;
+	double        globalMin;
+
+	if ( !self->dynamicRange ) return;
+
+	for ( array_I = 0 ; array_I < arrayCount ; array_I++ ){
+		/* Get scalar value from particle */
+		value = Variable_GetValueDouble( variable, array_I ) ;
+
+		if ( value < localMin ) 
+			localMin = value;
+		else if ( value > localMax ) 
+			localMax = value;
+	}
+	
+	MPI_Allreduce( &localMin, &globalMin, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD );
+	MPI_Allreduce( &localMax, &globalMax, 1, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD );
+
+	lucColourMap_SetMinMax( self, globalMin, globalMax );
+}
+
+void lucColourMap_CalibrateFromFieldVariable( void* colourMap, void* _fieldVariable ) {
+	lucColourMap*   self          = colourMap;
+	FieldVariable*  fieldVariable = (FieldVariable*)_fieldVariable;
+
+	if ( !self->dynamicRange ) return;
+
+	lucColourMap_SetMinMax( 
+			self, 
+			FieldVariable_GetMinGlobalFieldMagnitude( fieldVariable ), 
+			FieldVariable_GetMaxGlobalFieldMagnitude( fieldVariable ) );
+}
+
+void lucColourMap_CalibrateFromSwarmVariable( void* colourMap, void* swarmVariable ) {
+	lucColourMap*   self          = colourMap;
+
+	if ( !self->dynamicRange ) return;
+
+	lucColourMap_SetMinMax( 
+			self, 
+			SwarmVariable_GetMinGlobalMagnitude( swarmVariable ), 
+			SwarmVariable_GetMaxGlobalMagnitude( swarmVariable ) );
+}
+
+void lucColour_FromHSV( lucColour* self, float hue, float saturation, float value, float opacity ) {
+	int   Hi     = (int) ( hue/60.0 );
+	float f      = hue/60.0 - (float) Hi;
+	float p      = value * ( 1.0 - saturation );
+	float q      = value * ( 1.0 - saturation * f );
+	float t      = value * ( 1.0 - saturation * ( 1.0 - f ));
+
+	switch ( Hi ){
+		case 0:
+			self->red = value;   self->green = t;       self->blue = p;     break;
+		case 1:
+			self->red = q;       self->green = value;   self->blue = p;     break;
+		case 2:
+			self->red = p;       self->green = value;   self->blue = t;     break;
+		case 3:
+			self->red = p;       self->green = q;       self->blue = value; break;
+		case 4:
+			self->red = t;       self->green = p;       self->blue = value; break;
+		case 5:
+			self->red = value;   self->green = p;       self->blue = q;     break;
+	}
+
+	self->opacity = opacity;
+}
+	
+	
+
+void lucColour_FromString( lucColour* self, char* string ) {
+	char* charPointer;
+	float opacity;
+
+	lucColour_FromX11ColourName( self, string );
+
+	/* Get Opacity From String */
+	/* Opacity must be read in after the ":" of the name of the colour */
+	charPointer = strchr( string, ':' );
+
+	if (charPointer != NULL) {
+		/* Return full opactity (non-transparent) if no opacity is set */
+		if (sscanf( charPointer + 1, "%f", &opacity )	!= 1) 
+			opacity = 1.0;
+	}
+	else 
+		opacity = 1.0;
+	self->opacity = opacity;
+}
+
+typedef enum {
+	Terminal_Black,
+	Terminal_Red,
+	Terminal_Green,
+	Terminal_Yellow,
+	Terminal_Blue,
+	Terminal_Magenta,
+	Terminal_Cyan,
+	Terminal_Grey,
+	Terminal_White 
+} Terminal_Colour;
+
+Terminal_Colour lucColour_GetClosestTerminalColour( lucColour* self ) {
+	Bool hasRed   = ( self->red   > 0.5 );
+	Bool hasGreen = ( self->green > 0.5 );
+	Bool hasBlue  = ( self->blue  > 0.5 );
+	
+	/* Shades */
+	if ( ! hasRed && ! hasGreen && ! hasBlue ) 
+		return Terminal_Black;
+
+	if ( hasRed && hasGreen && hasBlue ) 
+		return Terminal_White;
+	
+	/* Primary Colours */
+	if ( hasRed && ! hasGreen && ! hasBlue ) 
+		return Terminal_Red;
+
+	if ( ! hasRed && hasGreen && ! hasBlue ) 
+		return Terminal_Green;
+	
+	if ( ! hasRed && ! hasGreen && hasBlue ) 
+		return Terminal_Blue;
+
+	/* Secondary Colours */
+	if ( hasRed && ! hasGreen && hasBlue ) 
+		return Terminal_Magenta;
+
+	if ( ! hasRed && hasGreen && hasBlue ) 
+		return Terminal_Cyan;
+	
+	if ( hasRed && hasGreen && ! hasBlue ) 
+		return Terminal_Yellow;
+
+	abort();
+	return Terminal_Black;
+}
+
+void lucColour_SetTerminalColours( lucColour* textColour, lucColour* backgroundColour, Stream* stream ) {
+	int reset = 0;
+	
+	/* Command is the control command to the terminal */
+	Journal_Printf( stream, "%c[%d;%d;%dm", 
+			0x1B, 
+			reset, 
+			lucColour_GetClosestTerminalColour( textColour ) + 30, 
+			lucColour_GetClosestTerminalColour( backgroundColour ) + 40 );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/CrossSection.c
--- a/Base/src/CrossSection.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-#include <StGermain/StGermain.h>
-
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-
-#include "CrossSection.h"
-
-/* Returns a cross section struct parsed from XML string */
-lucCrossSection* lucCrossSection_Read( Stg_ComponentFactory* cf, Name component)
-{
-   Name crossSectionStr;
-   char axisChar;
-   char crossSectionVal[20];
-   char modifierChar = ' ';
-   lucCrossSection* self = (lucCrossSection*)Memory_Alloc_Bytes_Unnamed(sizeof(lucCrossSection), "lucCrossSection");
-   self->value = 0.0;
-   self->axis = 0;
-   self->interpolate = False;
-
-   /* Read the cross section string specification from xml */
-   crossSectionStr = Stg_ComponentFactory_GetString( cf, component, (Dictionary_Entry_Key)"crossSection", "z=min" );
-
-   /* axis=value    : draw at this exact value on axis
-    * axis=min      : draw at minimum of range on axis
-    * axis=max      : draw at maximum of range on axis
-    * axis=value%   : draw at interpolated percentage value of range on axis
-    * Axis is a single character, one of [xyzXYZ] */
-
-   /* Parse the input string */
-   if ( sscanf( crossSectionStr, "%c=%s", &axisChar, crossSectionVal ) == 2 ) 
-   {
-      /* Axis X/Y/Z */
-      if ( toupper( axisChar ) >= 'X' )
-		   self->axis = toupper( axisChar ) - 'X';   /* x=0 y=1 z=2 */
-
-    	if (sscanf( crossSectionVal, "%lf%c", &self->value, &modifierChar) >= 1)
-      {
-         /* Found a numeric value  + optional modifier character */
-         //fprintf(stderr, "CROSS SECTION VALUE %lf on Axis %c\n",self->value, axisChar);
-
-         /* Interpolate cross section using percentage value */
-         if (modifierChar == '%')
-         {
-            /* Interpolate between max and min value using provided value as percentage */
-            self->interpolate = True;
-            //fprintf(stderr, "PERCENTAGE %lf %% CROSS SECTION on Axis %c\n", self->value, axisChar);
-            self->value *= 0.01;
-         }
-      }
-      /* Max or Min specified? */
-      else if (strcmp(crossSectionVal, "min") == 0) 
-      {
-         self->value = 0.0;
-         self->interpolate = True;
-         //fprintf(stderr, "MIN CROSS SECTION AT %lf on Axis %c\n", self->value, axisChar);
-      }
-      else if (strcmp(crossSectionVal, "max") == 0) 
-      {
-         self->value = 1.0;
-         self->interpolate = True;
-         //fprintf(stderr, "MAX CROSS SECTION AT %lf on Axis %c\n", self->value, axisChar);
-      }
-	}
-
-   /* Return cross section data */
-   return self;
-}
-
-/* Setup cross section values from passed parameters 
- * Returns pointer to passed in cross section so can be used in function calls 
- * If input object is NULL a new one is created */
-lucCrossSection* lucCrossSection_Set(lucCrossSection* self, double value, Axis axis, Bool interpolate)
-{
-   /* Allocate if necessary */
-   if (self == NULL)
-      self = (lucCrossSection*)Memory_Alloc_Bytes_Unnamed(sizeof(lucCrossSection), "lucCrossSection");
-
-   /* Copy values */
-   self->value = value;
-   self->axis = axis;
-   self->interpolate = interpolate;
-
-   /* Return pointer */
-   return self; 
-}
-
-/* Returns the cross section value, interpolating where necessary */
-double lucCrossSection_GetValue(lucCrossSection* self, double min, double max)
-{
-   if (self->interpolate)
-      /* Interpolation factor 0-1 provided to determine cross-section value */
-	   return min + self->value * (max - min);
-   else
-      /* Exact value provided */
-	   return self->value;
-}
-
-/* Free cross-section memory */
-void lucCrossSection_Delete(lucCrossSection* self)
-{
-   if (self != NULL) Memory_Free(self);
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/CrossSection.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/CrossSection.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,105 @@
+#include <StGermain/StGermain.h>
+
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "CrossSection.h"
+
+/* Returns a cross section struct parsed from XML string */
+lucCrossSection* lucCrossSection_Read( Stg_ComponentFactory* cf, Name component)
+{
+   Name crossSectionStr;
+   char axisChar;
+   char crossSectionVal[20];
+   char modifierChar = ' ';
+   lucCrossSection* self = (lucCrossSection*)Memory_Alloc_Bytes_Unnamed(sizeof(lucCrossSection), "lucCrossSection");
+   self->value = 0.0;
+   self->axis = 0;
+   self->interpolate = False;
+
+   /* Read the cross section string specification from xml */
+   crossSectionStr = Stg_ComponentFactory_GetString( cf, component, (Dictionary_Entry_Key)"crossSection", "z=min" );
+
+   /* axis=value    : draw at this exact value on axis
+    * axis=min      : draw at minimum of range on axis
+    * axis=max      : draw at maximum of range on axis
+    * axis=value%   : draw at interpolated percentage value of range on axis
+    * Axis is a single character, one of [xyzXYZ] */
+
+   /* Parse the input string */
+   if ( sscanf( crossSectionStr, "%c=%s", &axisChar, crossSectionVal ) == 2 ) 
+   {
+      /* Axis X/Y/Z */
+      if ( toupper( axisChar ) >= 'X' )
+		   self->axis = toupper( axisChar ) - 'X';   /* x=0 y=1 z=2 */
+
+    	if (sscanf( crossSectionVal, "%lf%c", &self->value, &modifierChar) >= 1)
+      {
+         /* Found a numeric value  + optional modifier character */
+         //fprintf(stderr, "CROSS SECTION VALUE %lf on Axis %c\n",self->value, axisChar);
+
+         /* Interpolate cross section using percentage value */
+         if (modifierChar == '%')
+         {
+            /* Interpolate between max and min value using provided value as percentage */
+            self->interpolate = True;
+            //fprintf(stderr, "PERCENTAGE %lf %% CROSS SECTION on Axis %c\n", self->value, axisChar);
+            self->value *= 0.01;
+         }
+      }
+      /* Max or Min specified? */
+      else if (strcmp(crossSectionVal, "min") == 0) 
+      {
+         self->value = 0.0;
+         self->interpolate = True;
+         //fprintf(stderr, "MIN CROSS SECTION AT %lf on Axis %c\n", self->value, axisChar);
+      }
+      else if (strcmp(crossSectionVal, "max") == 0) 
+      {
+         self->value = 1.0;
+         self->interpolate = True;
+         //fprintf(stderr, "MAX CROSS SECTION AT %lf on Axis %c\n", self->value, axisChar);
+      }
+	}
+
+   /* Return cross section data */
+   return self;
+}
+
+/* Setup cross section values from passed parameters 
+ * Returns pointer to passed in cross section so can be used in function calls 
+ * If input object is NULL a new one is created */
+lucCrossSection* lucCrossSection_Set(lucCrossSection* self, double value, Axis axis, Bool interpolate)
+{
+   /* Allocate if necessary */
+   if (self == NULL)
+      self = (lucCrossSection*)Memory_Alloc_Bytes_Unnamed(sizeof(lucCrossSection), "lucCrossSection");
+
+   /* Copy values */
+   self->value = value;
+   self->axis = axis;
+   self->interpolate = interpolate;
+
+   /* Return pointer */
+   return self; 
+}
+
+/* Returns the cross section value, interpolating where necessary */
+double lucCrossSection_GetValue(lucCrossSection* self, double min, double max)
+{
+   if (self->interpolate)
+      /* Interpolation factor 0-1 provided to determine cross-section value */
+	   return min + self->value * (max - min);
+   else
+      /* Exact value provided */
+	   return self->value;
+}
+
+/* Free cross-section memory */
+void lucCrossSection_Delete(lucCrossSection* self)
+{
+   if (self != NULL) Memory_Free(self);
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/DrawingObject.c
--- a/Base/src/DrawingObject.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: DrawingObject.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "ColourMap.h"
-#include "ViewportInfo.h"
-#include "Window.h"
-#include "DrawingObject.h"
-#include "Init.h"
-
-#include <assert.h>
-#include <string.h>
-
-const Type lucDrawingObject_Type = "lucDrawingObject";
-
-lucDrawingObject* _lucDrawingObject_New(  LUCDRAWINGOBJECT_DEFARGS  )
-{
-	lucDrawingObject*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucDrawingObject) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucDrawingObject*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-
-	self->_setup   = _setup;
-	self->_draw    = _draw;
-	self->_cleanUp = _cleanUp;
-	
-	return self;
-}
-
-void _lucDrawingObject_Init( lucDrawingObject* self ) {
-	self->isConstructed = True;
-
-	self->infoStream  = Journal_MyStream( Info_Type,  self );
-	self->errorStream = Journal_MyStream( Error_Type, self );
-	self->debugStream = Journal_MyStream( Debug_Type, self );
-}
-
-void lucDrawingObject_InitAll( void* drawingObject ) {
-	lucDrawingObject* self        = drawingObject;
-
-	_lucDrawingObject_Init( self );
-}
-
-void _lucDrawingObject_Delete( void* drawingObject ) {
-	lucDrawingObject* self        = drawingObject;
-	
-	_Stg_Component_Delete( self );
-}
-
-void _lucDrawingObject_Print( void* drawingObject, Stream* stream ) {
-	lucDrawingObject* self        = drawingObject;
-	
-	Journal_Printf( stream, "lucDrawingObject: %s\n", self->name );
-
-	Stream_Indent( stream );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	Journal_PrintPointer( stream, self->_setup );
-	Journal_PrintPointer( stream, self->_draw );
-	
-	Stream_UnIndent( stream );
-}
-
-void* _lucDrawingObject_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucDrawingObject* self        = drawingObject;
-	lucDrawingObject* newDrawingObject;
-
-	newDrawingObject = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	return (void*) newDrawingObject;
-}
-
-void _lucDrawingObject_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) {
-	lucDrawingObject*        self            = (lucDrawingObject*) drawingObject ;
-
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
-	
-	_lucDrawingObject_Init( self  );
-}
-
-void _lucDrawingObject_Build( void* camera, void* data ) { }
-void _lucDrawingObject_Initialise( void* camera, void* data ) { }
-void _lucDrawingObject_Execute( void* camera, void* data ) { }
-void _lucDrawingObject_Destroy( void* camera, void* data ) { }
-
-void lucDrawingObject_Setup( void* drawingObject, void* context ) {
-	lucDrawingObject*   self       = (lucDrawingObject*) drawingObject ;
-
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	if ( self->needsToSetup ) 
-		self->_setup( self, context );
-	else {
-		Journal_DPrintfL( lucDebug, 2, "Already setup\n" );
-	}
-
-	self->needsToSetup   = False;
-	self->needsToCleanUp = True;
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucDrawingObject_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* context ) {
-	lucDrawingObject*   self       = (lucDrawingObject*) drawingObject ;
-   double time;
-   
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	lucDrawingObject_Setup( self, context );
-	
-	time = MPI_Wtime();
-	
-	self->_draw( self, window, viewportInfo, context );
-	
-	time = MPI_Wtime() - time;
-	Journal_DPrintfL( lucDebug, 2, "(%s) Drawing took %f seconds\n", self->name, time );
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-
-void lucDrawingObject_CleanUp( void* drawingObject, void* context ) {
-	lucDrawingObject*   self       = (lucDrawingObject*) drawingObject ;
-
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	if ( self->needsToCleanUp ) {
-		self->_cleanUp( self, context );
-
-		self->needsToCleanUp = False;
-	}
-	else {
-		Journal_DPrintfL( lucDebug, 2, "%s '%s' has already cleaned up.\n", self->type, self->name );
-	}
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucDrawingObjectMask_Construct( lucDrawingObjectMask* self, Name drawingObjectName, Stg_ComponentFactory* cf, void* mask ) {
-	Name                   maskTypeName;
-
-	self->value     = Stg_ComponentFactory_GetDouble( cf, drawingObjectName, (Dictionary_Entry_Key)"maskValue", 0.0  );
-	self->tolerance = Stg_ComponentFactory_GetDouble( cf, drawingObjectName, (Dictionary_Entry_Key)"maskTolerance", 0.001  );
-
-	maskTypeName = Stg_ComponentFactory_GetString( cf, drawingObjectName, (Dictionary_Entry_Key)"maskType", "GreaterThan"  );
-	if ( strcasecmp( maskTypeName, "GreaterThan" ) == 0 ) 
-		self->type = GreaterThan;
-	else if ( strcasecmp( maskTypeName, "LesserThan" ) == 0 || strcasecmp( maskTypeName, "LessThan" ) == 0 )
-		self->type = LessThan;
-	else if ( strcasecmp( maskTypeName, "EqualTo" ) == 0 )
-		self->type = EqualTo;
-	else {
-		Journal_Printf( lucError, "In func %s: Cannot understand 'maskType' '%s'.\n", __func__, maskTypeName );
-		abort();
-	}
-}
-
-Bool lucDrawingObjectMask_Test( lucDrawingObjectMask* self, double value ) {
-	double maskValue = self->value;
-
-	switch (self->type) {
-		case GreaterThan:
-			if (value > maskValue) 
-				return True;
-			return False;
-		case LessThan:
-			if (value < maskValue) 
-				return True;
-			return False;
-		case EqualTo:
-			if (fabs( maskValue - value ) < self->tolerance )
-				return True;
-			return False;
-	}
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/DrawingObject.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/DrawingObject.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,234 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: DrawingObject.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "ColourMap.h"
+#include "ViewportInfo.h"
+#include "Window.h"
+#include "DrawingObject.h"
+#include "Init.h"
+
+#include <assert.h>
+#include <string.h>
+
+const Type lucDrawingObject_Type = "lucDrawingObject";
+
+lucDrawingObject* _lucDrawingObject_New(  LUCDRAWINGOBJECT_DEFARGS  )
+{
+	lucDrawingObject*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucDrawingObject) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucDrawingObject*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+
+	self->_setup   = _setup;
+	self->_draw    = _draw;
+	self->_cleanUp = _cleanUp;
+	
+	return self;
+}
+
+void _lucDrawingObject_Init( lucDrawingObject* self ) {
+	self->isConstructed = True;
+
+	self->infoStream  = Journal_MyStream( Info_Type,  self );
+	self->errorStream = Journal_MyStream( Error_Type, self );
+	self->debugStream = Journal_MyStream( Debug_Type, self );
+}
+
+void lucDrawingObject_InitAll( void* drawingObject ) {
+	lucDrawingObject* self        = drawingObject;
+
+	_lucDrawingObject_Init( self );
+}
+
+void _lucDrawingObject_Delete( void* drawingObject ) {
+	lucDrawingObject* self        = drawingObject;
+	
+	_Stg_Component_Delete( self );
+}
+
+void _lucDrawingObject_Print( void* drawingObject, Stream* stream ) {
+	lucDrawingObject* self        = drawingObject;
+	
+	Journal_Printf( stream, "lucDrawingObject: %s\n", self->name );
+
+	Stream_Indent( stream );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	Journal_PrintPointer( stream, self->_setup );
+	Journal_PrintPointer( stream, self->_draw );
+	
+	Stream_UnIndent( stream );
+}
+
+void* _lucDrawingObject_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucDrawingObject* self        = drawingObject;
+	lucDrawingObject* newDrawingObject;
+
+	newDrawingObject = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	return (void*) newDrawingObject;
+}
+
+void _lucDrawingObject_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ) {
+	lucDrawingObject*        self            = (lucDrawingObject*) drawingObject ;
+
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
+	
+	_lucDrawingObject_Init( self  );
+}
+
+void _lucDrawingObject_Build( void* camera, void* data ) { }
+void _lucDrawingObject_Initialise( void* camera, void* data ) { }
+void _lucDrawingObject_Execute( void* camera, void* data ) { }
+void _lucDrawingObject_Destroy( void* camera, void* data ) { }
+
+void lucDrawingObject_Setup( void* drawingObject, void* context ) {
+	lucDrawingObject*   self       = (lucDrawingObject*) drawingObject ;
+
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	if ( self->needsToSetup ) 
+		self->_setup( self, context );
+	else {
+		Journal_DPrintfL( lucDebug, 2, "Already setup\n" );
+	}
+
+	self->needsToSetup   = False;
+	self->needsToCleanUp = True;
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucDrawingObject_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* context ) {
+	lucDrawingObject*   self       = (lucDrawingObject*) drawingObject ;
+   double time;
+   
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	lucDrawingObject_Setup( self, context );
+	
+	time = MPI_Wtime();
+	
+	self->_draw( self, window, viewportInfo, context );
+	
+	time = MPI_Wtime() - time;
+	Journal_DPrintfL( lucDebug, 2, "(%s) Drawing took %f seconds\n", self->name, time );
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+
+void lucDrawingObject_CleanUp( void* drawingObject, void* context ) {
+	lucDrawingObject*   self       = (lucDrawingObject*) drawingObject ;
+
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	if ( self->needsToCleanUp ) {
+		self->_cleanUp( self, context );
+
+		self->needsToCleanUp = False;
+	}
+	else {
+		Journal_DPrintfL( lucDebug, 2, "%s '%s' has already cleaned up.\n", self->type, self->name );
+	}
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucDrawingObjectMask_Construct( lucDrawingObjectMask* self, Name drawingObjectName, Stg_ComponentFactory* cf, void* mask ) {
+	Name                   maskTypeName;
+
+	self->value     = Stg_ComponentFactory_GetDouble( cf, drawingObjectName, (Dictionary_Entry_Key)"maskValue", 0.0  );
+	self->tolerance = Stg_ComponentFactory_GetDouble( cf, drawingObjectName, (Dictionary_Entry_Key)"maskTolerance", 0.001  );
+
+	maskTypeName = Stg_ComponentFactory_GetString( cf, drawingObjectName, (Dictionary_Entry_Key)"maskType", "GreaterThan"  );
+	if ( strcasecmp( maskTypeName, "GreaterThan" ) == 0 ) 
+		self->type = GreaterThan;
+	else if ( strcasecmp( maskTypeName, "LesserThan" ) == 0 || strcasecmp( maskTypeName, "LessThan" ) == 0 )
+		self->type = LessThan;
+	else if ( strcasecmp( maskTypeName, "EqualTo" ) == 0 )
+		self->type = EqualTo;
+	else {
+		Journal_Printf( lucError, "In func %s: Cannot understand 'maskType' '%s'.\n", __func__, maskTypeName );
+		abort();
+	}
+}
+
+Bool lucDrawingObjectMask_Test( lucDrawingObjectMask* self, double value ) {
+	double maskValue = self->value;
+
+	switch (self->type) {
+		case GreaterThan:
+			if (value > maskValue) 
+				return True;
+			return False;
+		case LessThan:
+			if (value < maskValue) 
+				return True;
+			return False;
+		case EqualTo:
+			if (fabs( maskValue - value ) < self->tolerance )
+				return True;
+			return False;
+	}
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/DrawingObject_Register.c
--- a/Base/src/DrawingObject_Register.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: DrawingObject_Register.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "ViewportInfo.h"
-#include "Viewport.h"
-#include "ColourMap.h"
-#include "Window.h"
-#include "RenderingEngine.h"
-#include "DrawingObject_Register.h"
-#include "DrawingObject.h"
-#include "Light_Register.h"
-
-
-const Type lucDrawingObject_Register_Type = "lucDrawingObject_Register";
-
-
-lucDrawingObject_Register*	lucDrawingObject_Register_New( void ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(lucDrawingObject_Register);
-	Type                              type = lucDrawingObject_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
-	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
-
-	lucDrawingObject_Register* self;
-	
-	self = (lucDrawingObject_Register*) _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
-
-	return self;
-}
-
-void lucDrawingObject_Register_SetNeedsToSetupFlag( void* drawingObject_Register, Bool flag ) {
-	lucDrawingObject_Register* self           = (lucDrawingObject_Register*) drawingObject_Register;
-	DrawingObject_Index        object_I;
-	DrawingObject_Index        objectCount    = lucDrawingObject_Register_GetCount( self );
-	lucDrawingObject*          object;
-
-	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
-		object = lucDrawingObject_Register_GetByIndex( self, object_I );
-
-		object->needsToSetup = flag;
-	}
-}
-
-void lucDrawingObject_Register_DrawAll( void* drawingObject_Register, lucWindow* window, lucViewportInfo* viewportInfo, void* context, Bool compositeEachDraw ) {
-	lucDrawingObject_Register* self          = (lucDrawingObject_Register*) drawingObject_Register;
-	DrawingObject_Index        object_I;
-	DrawingObject_Index        objectCount   = lucDrawingObject_Register_GetCount( self );
-	lucDrawingObject*          object;
-	lucViewport*               viewport      =  (lucViewport*) viewportInfo->viewport;
-	lucLight_Register*         lightRegister =  (lucLight_Register*) (viewport->light_Register);
-
-	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
-		object = lucDrawingObject_Register_GetByIndex( self, object_I );
-		lucLight_Register_EnableAll( lightRegister );
-		lucDrawingObject_Draw( object, window, viewportInfo, context );
-
-		if ( compositeEachDraw )
-			lucRenderingEngine_CompositeViewport( window->renderingEngine, viewportInfo, context, True );
-	}
-
-	if ( !compositeEachDraw )
-		lucRenderingEngine_CompositeViewport( window->renderingEngine, viewportInfo, context, False );
-}
-
-void lucDrawingObject_Register_CleanUpAll( void* drawingObject_Register, void* context ) {
-	lucDrawingObject_Register* self          = (lucDrawingObject_Register*) drawingObject_Register;
-	DrawingObject_Index        object_I;
-	DrawingObject_Index        objectCount   = lucDrawingObject_Register_GetCount( self );
-	lucDrawingObject*          object;
-
-	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
-		object = lucDrawingObject_Register_GetByIndex( self, object_I );
-		lucDrawingObject_CleanUp( object, context );
-	}
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/DrawingObject_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/DrawingObject_Register.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,126 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: DrawingObject_Register.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "ViewportInfo.h"
+#include "Viewport.h"
+#include "ColourMap.h"
+#include "Window.h"
+#include "RenderingEngine.h"
+#include "DrawingObject_Register.h"
+#include "DrawingObject.h"
+#include "Light_Register.h"
+
+
+const Type lucDrawingObject_Register_Type = "lucDrawingObject_Register";
+
+
+lucDrawingObject_Register*	lucDrawingObject_Register_New( void ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(lucDrawingObject_Register);
+	Type                              type = lucDrawingObject_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
+	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
+
+	lucDrawingObject_Register* self;
+	
+	self = (lucDrawingObject_Register*) _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
+
+	return self;
+}
+
+void lucDrawingObject_Register_SetNeedsToSetupFlag( void* drawingObject_Register, Bool flag ) {
+	lucDrawingObject_Register* self           = (lucDrawingObject_Register*) drawingObject_Register;
+	DrawingObject_Index        object_I;
+	DrawingObject_Index        objectCount    = lucDrawingObject_Register_GetCount( self );
+	lucDrawingObject*          object;
+
+	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
+		object = lucDrawingObject_Register_GetByIndex( self, object_I );
+
+		object->needsToSetup = flag;
+	}
+}
+
+void lucDrawingObject_Register_DrawAll( void* drawingObject_Register, lucWindow* window, lucViewportInfo* viewportInfo, void* context, Bool compositeEachDraw ) {
+	lucDrawingObject_Register* self          = (lucDrawingObject_Register*) drawingObject_Register;
+	DrawingObject_Index        object_I;
+	DrawingObject_Index        objectCount   = lucDrawingObject_Register_GetCount( self );
+	lucDrawingObject*          object;
+	lucViewport*               viewport      =  (lucViewport*) viewportInfo->viewport;
+	lucLight_Register*         lightRegister =  (lucLight_Register*) (viewport->light_Register);
+
+	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
+		object = lucDrawingObject_Register_GetByIndex( self, object_I );
+		lucLight_Register_EnableAll( lightRegister );
+		lucDrawingObject_Draw( object, window, viewportInfo, context );
+
+		if ( compositeEachDraw )
+			lucRenderingEngine_CompositeViewport( window->renderingEngine, viewportInfo, context, True );
+	}
+
+	if ( !compositeEachDraw )
+		lucRenderingEngine_CompositeViewport( window->renderingEngine, viewportInfo, context, False );
+}
+
+void lucDrawingObject_Register_CleanUpAll( void* drawingObject_Register, void* context ) {
+	lucDrawingObject_Register* self          = (lucDrawingObject_Register*) drawingObject_Register;
+	DrawingObject_Index        object_I;
+	DrawingObject_Index        objectCount   = lucDrawingObject_Register_GetCount( self );
+	lucDrawingObject*          object;
+
+	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
+		object = lucDrawingObject_Register_GetByIndex( self, object_I );
+		lucDrawingObject_CleanUp( object, context );
+	}
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Finalise.c
--- a/Base/src/Finalise.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool lucBase_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Finalise.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,60 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool lucBase_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Init.c
--- a/Base/src/Init.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "Base.h"
-
-Stream* lucInfo  = NULL;
-Stream* lucDebug = NULL;
-Stream* lucError = NULL;
-lucInputFormat_Register* lucInputFormat_Register_Singleton = NULL;
-
-Bool lucBase_Init() {
-	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-
-	/* Set up streams */
-	lucInfo  = Journal_Register( InfoStream_Type, (Name)"lucInfo"  );
-	lucDebug = Journal_Register( DebugStream_Type, (Name)"lucDebug"  );
-	lucError = Journal_Register( ErrorStream_Type, (Name)"lucError" );	
-	lucInputFormat_Register_Singleton = lucInputFormat_Register_New( );
-	
-	Stg_ComponentRegister_Add( componentRegister, lucCamera_Type, (Name)"0", _lucCamera_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucColourMap_Type, (Name)"0", _lucColourMap_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucViewport_Type, (Name)"0", _lucViewport_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucWindow_Type, (Name)"0", _lucWindow_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucLight_Type, (Name)"0", _lucLight_DefaultNew  );
-
-	/* Register Parents for type checking */
-	RegisterParent( lucCamera_Type,            Stg_Component_Type );
-	RegisterParent( lucColourMap_Type,         Stg_Component_Type );
-	RegisterParent( lucDrawingObject_Type,     Stg_Component_Type );
-	RegisterParent( lucViewport_Type,          Stg_Component_Type );
-	RegisterParent( lucOutputFormat_Type,      Stg_Component_Type );
-	RegisterParent( lucInputFormat_Type,       Stg_Component_Type );
-	RegisterParent( lucWindow_Type,            Stg_Component_Type );
-	RegisterParent( lucRenderingEngine_Type,   Stg_Component_Type );
-	RegisterParent( lucWindowInteraction_Type, Stg_Component_Type );
-	RegisterParent( lucLight_Type,             Stg_Component_Type );
-
-	
-	
-	RegisterParent( lucDrawingObject_Register_Type, NamedObject_Register_Type );
-	RegisterParent( lucOutputFormat_Register_Type,  NamedObject_Register_Type );
-	RegisterParent( lucWindowInteraction_Register_Type,  NamedObject_Register_Type );
-	RegisterParent( lucLight_Register_Type,  NamedObject_Register_Type );
-
-	/* Create MPI Datatypes */
-	lucCamera_Create_MPI_Datatype();
-	lucViewport_Create_MPI_Datatype();
-	lucViewportInfo_Create_MPI_Datatype();
-	lucWindow_Create_MPI_Datatype();
-
-	return True;
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Init.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,103 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "Base.h"
+
+Stream* lucInfo  = NULL;
+Stream* lucDebug = NULL;
+Stream* lucError = NULL;
+lucInputFormat_Register* lucInputFormat_Register_Singleton = NULL;
+
+Bool lucBase_Init() {
+	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+
+	/* Set up streams */
+	lucInfo  = Journal_Register( InfoStream_Type, (Name)"lucInfo"  );
+	lucDebug = Journal_Register( DebugStream_Type, (Name)"lucDebug"  );
+	lucError = Journal_Register( ErrorStream_Type, (Name)"lucError" );	
+	lucInputFormat_Register_Singleton = lucInputFormat_Register_New( );
+	
+	Stg_ComponentRegister_Add( componentRegister, lucCamera_Type, (Name)"0", _lucCamera_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucColourMap_Type, (Name)"0", _lucColourMap_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucViewport_Type, (Name)"0", _lucViewport_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucWindow_Type, (Name)"0", _lucWindow_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucLight_Type, (Name)"0", _lucLight_DefaultNew  );
+
+	/* Register Parents for type checking */
+	RegisterParent( lucCamera_Type,            Stg_Component_Type );
+	RegisterParent( lucColourMap_Type,         Stg_Component_Type );
+	RegisterParent( lucDrawingObject_Type,     Stg_Component_Type );
+	RegisterParent( lucViewport_Type,          Stg_Component_Type );
+	RegisterParent( lucOutputFormat_Type,      Stg_Component_Type );
+	RegisterParent( lucInputFormat_Type,       Stg_Component_Type );
+	RegisterParent( lucWindow_Type,            Stg_Component_Type );
+	RegisterParent( lucRenderingEngine_Type,   Stg_Component_Type );
+	RegisterParent( lucWindowInteraction_Type, Stg_Component_Type );
+	RegisterParent( lucLight_Type,             Stg_Component_Type );
+
+	
+	
+	RegisterParent( lucDrawingObject_Register_Type, NamedObject_Register_Type );
+	RegisterParent( lucOutputFormat_Register_Type,  NamedObject_Register_Type );
+	RegisterParent( lucWindowInteraction_Register_Type,  NamedObject_Register_Type );
+	RegisterParent( lucLight_Register_Type,  NamedObject_Register_Type );
+
+	/* Create MPI Datatypes */
+	lucCamera_Create_MPI_Datatype();
+	lucViewport_Create_MPI_Datatype();
+	lucViewportInfo_Create_MPI_Datatype();
+	lucWindow_Create_MPI_Datatype();
+
+	return True;
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/InputFormat.c
--- a/Base/src/InputFormat.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "InputFormat.h"
-#include "ColourMap.h"
-#include "Window.h"
-#include "DrawingObject_Register.h"
-#include "DrawingObject.h"
-#include "Camera.h"
-#include "Init.h"
-#include "Window.h"
-
-#include <assert.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-const Type lucInputFormat_Type = "lucInputFormat";
-
-lucInputFormat* _lucInputFormat_New(  LUCINPUTFORMAT_DEFARGS  )
-{
-	lucInputFormat*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucInputFormat) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucInputFormat*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-
-	self->_input = _input;
-
-	return self;
-}
-
-
-void _lucInputFormat_Init( 
-		lucInputFormat*                                   self, 
-		Name                                               imageName)
-{
-	self->imageName     = StG_Strdup( imageName );
-}
-
-void lucInputFormat_InitAll( 
-		void*                                              inputFormat,
-		Name                                               imageName )
-{
-	lucInputFormat* self        = inputFormat;
-
-	_lucInputFormat_Init( self, imageName );
-}
-
-	
-void _lucInputFormat_Delete( void* inputFormat ) {
-	lucInputFormat* self        = inputFormat;
-
-	Memory_Free( self->imageName );
-	
-	_Stg_Component_Delete( self );
-}
-
-void _lucInputFormat_Print( void* inputFormat, Stream* stream ) {
-	lucInputFormat*          self        = inputFormat;
-	
-	Journal_Printf( stream, "lucInputFormat: %s\n", self->name );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	Journal_PrintString( stream, self->imageName );
-}
-
-void* _lucInputFormat_Copy( void* inputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucInputFormat* self        = inputFormat;
-	lucInputFormat* newInputFormat;
-
-	newInputFormat = (lucInputFormat*)_Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	return (void*) newInputFormat;
-}
-
-void _lucInputFormat_AssignFromXML( void* inputFormat, Stg_ComponentFactory* cf, void* data ) {
-	lucInputFormat*        self               = (lucInputFormat*) inputFormat; 
-
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
-}
-void _lucInputFormat_Build( void* inputFormat, void* data ) { }
-void _lucInputFormat_Initialise( void* inputFormat, void* data ) { }
-void _lucInputFormat_Execute( void* inputFormat, void* data ) { }
-void _lucInputFormat_Destroy( void* inputFormat, void* data ) { }
-
-
-lucPixel* lucInputFormat_Input( void* inputFormat, Name imageName, Pixel_Index *imageWidth, Pixel_Index* imageHeight  ) {
-	lucInputFormat*        self               = (lucInputFormat*) inputFormat; 
-	lucPixel* pixelData = self->_input(self, imageName, imageWidth, imageHeight );
-
-	return pixelData;
-}
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/InputFormat.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/InputFormat.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,154 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "InputFormat.h"
+#include "ColourMap.h"
+#include "Window.h"
+#include "DrawingObject_Register.h"
+#include "DrawingObject.h"
+#include "Camera.h"
+#include "Init.h"
+#include "Window.h"
+
+#include <assert.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+const Type lucInputFormat_Type = "lucInputFormat";
+
+lucInputFormat* _lucInputFormat_New(  LUCINPUTFORMAT_DEFARGS  )
+{
+	lucInputFormat*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucInputFormat) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucInputFormat*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+
+	self->_input = _input;
+
+	return self;
+}
+
+
+void _lucInputFormat_Init( 
+		lucInputFormat*                                   self, 
+		Name                                               imageName)
+{
+	self->imageName     = StG_Strdup( imageName );
+}
+
+void lucInputFormat_InitAll( 
+		void*                                              inputFormat,
+		Name                                               imageName )
+{
+	lucInputFormat* self        = inputFormat;
+
+	_lucInputFormat_Init( self, imageName );
+}
+
+	
+void _lucInputFormat_Delete( void* inputFormat ) {
+	lucInputFormat* self        = inputFormat;
+
+	Memory_Free( self->imageName );
+	
+	_Stg_Component_Delete( self );
+}
+
+void _lucInputFormat_Print( void* inputFormat, Stream* stream ) {
+	lucInputFormat*          self        = inputFormat;
+	
+	Journal_Printf( stream, "lucInputFormat: %s\n", self->name );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	Journal_PrintString( stream, self->imageName );
+}
+
+void* _lucInputFormat_Copy( void* inputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucInputFormat* self        = inputFormat;
+	lucInputFormat* newInputFormat;
+
+	newInputFormat = (lucInputFormat*)_Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	return (void*) newInputFormat;
+}
+
+void _lucInputFormat_AssignFromXML( void* inputFormat, Stg_ComponentFactory* cf, void* data ) {
+	lucInputFormat*        self               = (lucInputFormat*) inputFormat; 
+
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
+}
+void _lucInputFormat_Build( void* inputFormat, void* data ) { }
+void _lucInputFormat_Initialise( void* inputFormat, void* data ) { }
+void _lucInputFormat_Execute( void* inputFormat, void* data ) { }
+void _lucInputFormat_Destroy( void* inputFormat, void* data ) { }
+
+
+lucPixel* lucInputFormat_Input( void* inputFormat, Name imageName, Pixel_Index *imageWidth, Pixel_Index* imageHeight  ) {
+	lucInputFormat*        self               = (lucInputFormat*) inputFormat; 
+	lucPixel* pixelData = self->_input(self, imageName, imageWidth, imageHeight );
+
+	return pixelData;
+}
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/InputFormat_Register.c
--- a/Base/src/InputFormat_Register.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "types.h"
-#include "InputFormat_Register.h"
-#include "Init.h"
-
-#include <string.h>
-#include <assert.h>
-
-const Type lucInputFormat_Register_Type = "lucInputFormat_Register";
-
-lucInputFormat_Register* lucInputFormat_Register_New() {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof( lucInputFormat_Register );
-	Type                              type = lucInputFormat_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _lucInputFormat_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _lucInputFormat_Register_Print;
-	Stg_Class_CopyFunction*          _copy = _lucInputFormat_Register_Copy;
-
-	lucInputFormat_Register* self;
-
-	self = _lucInputFormat_Register_New(  LUCINPUTFORMAT_REGISTER_PASSARGS  );
-
-	lucInputFormat_Register_InitAll( self );
-
-	return self;
-}
-
-lucInputFormat_Register* _lucInputFormat_Register_New(  LUCINPUTFORMAT_REGISTER_DEFARGS  )
-{
-	lucInputFormat_Register*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucInputFormat_Register) );
-	self = (lucInputFormat_Register*) _Stg_ComponentRegister_New(  STG_COMPONENTREGISTER_PASSARGS  );
-	
-	return self;
-}
-
-void _lucInputFormat_Register_Init( void* inputFormat_Register ) {
-}
-
-void lucInputFormat_Register_InitAll( 
-		void*                                              inputFormat_Register ) 
-{
-	lucInputFormat_Register* self        = inputFormat_Register;
-
-	Stg_ComponentRegister_Init( ( Stg_ComponentRegister*)self );	
-	_lucInputFormat_Register_Init( self );
-}
-
-void _lucInputFormat_Register_Delete( void* inputFormat_Register ) {
-	lucInputFormat_Register* self        = inputFormat_Register;
-	
-	_Stg_ComponentRegister_Delete( self );
-}
-
-void _lucInputFormat_Register_Print( void* inputFormat_Register, Stream* stream ) {
-	lucInputFormat_Register* self        = (lucInputFormat_Register*) inputFormat_Register;
-	
-	_Stg_ComponentRegister_Print( self, stream );
-}
-
-void* _lucInputFormat_Register_Copy( void* inputFormat_Register, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucInputFormat_Register* self        = inputFormat_Register;
-	lucInputFormat_Register* newInputFormat_Register;
-
-	newInputFormat_Register = (lucInputFormat_Register*) _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	return (void*) newInputFormat_Register;
-}
-
-/* This goes through each input format and finds the which one works with the extension for the filename passed in */
-lucInputFormat* lucInputFormat_Register_CreateFromFileName( void* inputFormat_Register, Name imageName ) {
-	lucInputFormat_Register*                  self        = (lucInputFormat_Register*) inputFormat_Register;
-	Stg_Component_DefaultConstructorFunction* defaultNewFunctionPtr;
-	Name                                      extension;
-	Stream* errorStream = Journal_Register( Error_Type, (Name)lucInputFormat_Register_Type  );
-
-	Journal_Firewall( imageName != NULL, errorStream, "In func '%s for %s Image file name %s cannot be found \n", 
-			__func__, self->type, imageName );
-
-	/* Find extension of image name */ 
-	extension = strrchr( imageName, '.' );
-	Journal_Firewall( extension != (char*) 1, errorStream, 
-			"In func %s for %s - Cannot find extension for filename '%s'.\n", 
-			__func__, self->type, imageName );
-
-	defaultNewFunctionPtr = Stg_ComponentRegister_AssertGet( (Stg_ComponentRegister*)self, extension, "0" );
-
-	return (lucInputFormat*) defaultNewFunctionPtr( imageName );
-}
-	
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/InputFormat_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/InputFormat_Register.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,141 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "types.h"
+#include "InputFormat_Register.h"
+#include "Init.h"
+
+#include <string.h>
+#include <assert.h>
+
+const Type lucInputFormat_Register_Type = "lucInputFormat_Register";
+
+lucInputFormat_Register* lucInputFormat_Register_New() {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof( lucInputFormat_Register );
+	Type                              type = lucInputFormat_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _lucInputFormat_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _lucInputFormat_Register_Print;
+	Stg_Class_CopyFunction*          _copy = _lucInputFormat_Register_Copy;
+
+	lucInputFormat_Register* self;
+
+	self = _lucInputFormat_Register_New(  LUCINPUTFORMAT_REGISTER_PASSARGS  );
+
+	lucInputFormat_Register_InitAll( self );
+
+	return self;
+}
+
+lucInputFormat_Register* _lucInputFormat_Register_New(  LUCINPUTFORMAT_REGISTER_DEFARGS  )
+{
+	lucInputFormat_Register*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucInputFormat_Register) );
+	self = (lucInputFormat_Register*) _Stg_ComponentRegister_New(  STG_COMPONENTREGISTER_PASSARGS  );
+	
+	return self;
+}
+
+void _lucInputFormat_Register_Init( void* inputFormat_Register ) {
+}
+
+void lucInputFormat_Register_InitAll( 
+		void*                                              inputFormat_Register ) 
+{
+	lucInputFormat_Register* self        = inputFormat_Register;
+
+	Stg_ComponentRegister_Init( ( Stg_ComponentRegister*)self );	
+	_lucInputFormat_Register_Init( self );
+}
+
+void _lucInputFormat_Register_Delete( void* inputFormat_Register ) {
+	lucInputFormat_Register* self        = inputFormat_Register;
+	
+	_Stg_ComponentRegister_Delete( self );
+}
+
+void _lucInputFormat_Register_Print( void* inputFormat_Register, Stream* stream ) {
+	lucInputFormat_Register* self        = (lucInputFormat_Register*) inputFormat_Register;
+	
+	_Stg_ComponentRegister_Print( self, stream );
+}
+
+void* _lucInputFormat_Register_Copy( void* inputFormat_Register, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucInputFormat_Register* self        = inputFormat_Register;
+	lucInputFormat_Register* newInputFormat_Register;
+
+	newInputFormat_Register = (lucInputFormat_Register*) _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	return (void*) newInputFormat_Register;
+}
+
+/* This goes through each input format and finds the which one works with the extension for the filename passed in */
+lucInputFormat* lucInputFormat_Register_CreateFromFileName( void* inputFormat_Register, Name imageName ) {
+	lucInputFormat_Register*                  self        = (lucInputFormat_Register*) inputFormat_Register;
+	Stg_Component_DefaultConstructorFunction* defaultNewFunctionPtr;
+	Name                                      extension;
+	Stream* errorStream = Journal_Register( Error_Type, (Name)lucInputFormat_Register_Type  );
+
+	Journal_Firewall( imageName != NULL, errorStream, "In func '%s for %s Image file name %s cannot be found \n", 
+			__func__, self->type, imageName );
+
+	/* Find extension of image name */ 
+	extension = strrchr( imageName, '.' );
+	Journal_Firewall( extension != (char*) 1, errorStream, 
+			"In func %s for %s - Cannot find extension for filename '%s'.\n", 
+			__func__, self->type, imageName );
+
+	defaultNewFunctionPtr = Stg_ComponentRegister_AssertGet( (Stg_ComponentRegister*)self, extension, "0" );
+
+	return (lucInputFormat*) defaultNewFunctionPtr( imageName );
+}
+	
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Light.c
--- a/Base/src/Light.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,344 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Light.c 510 2006-02-17 04:33:32Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "types.h"
-#include "Light.h"
-#include "ViewportInfo.h"
-#include "Init.h"
-
-#include <string.h>
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-
-const Type lucLight_Type = "lucLight";
-
-/* The position defaults have been chosen for a directional light source (hence posW=0)
-   shining onto the left,top,front corner of a 1x1x1 box, currently the most commonly
-   used geometry. -- PatrickSunter, 8 Jun 2006 */
-const double LUC_LIGHT_DEFAULT_POS_X = 1.0;
-const double LUC_LIGHT_DEFAULT_POS_Y = -2.0;
-const double LUC_LIGHT_DEFAULT_POS_Z = -2.0;
-const double LUC_LIGHT_DEFAULT_POS_W = 0.0;
-
-lucLight* lucLight_New( 
-		Name                                               name,
-		Light_Index 				index,
-		int                                   model,
-		int                                   material,
-		float                                 position[4],
-		float                                 lmodel_ambient[4],
-		float                                 spotCutOff,
-		float                                 spotDirection[3]
-)
-{
-	lucLight* self = (lucLight*) _lucLight_DefaultNew( name );
-
-	lucLight_InitAll( self, index, model, material, position, lmodel_ambient, spotCutOff, spotDirection);
-
-	return self;
-}
-
-lucLight* _lucLight_New(  LUCLIGHT_DEFARGS  )
-{
-	lucLight*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucLight) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucLight*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-	
-	
-	return self;
-}
-
-void lucLight_Init(		
-		lucLight*                                         self,
-		Light_Index index,
-		int model,
-		int material,
-		float position[4],
-		float lmodel_ambient[4],
-		float spotCutOff,
-		float spotDirection[3])
-{
-	self->index= index;
-	self->model         = model;
-	self->material          = material;
-	self->position[0] = position[0];
-	self->position[1] = position[1];
-	self->position[2] = position[2];
-	self->position[3] = position[3];
-	self->lmodel_ambient[0] = lmodel_ambient[0];
-	self->lmodel_ambient[1] = lmodel_ambient[1];
-	self->lmodel_ambient[2] = lmodel_ambient[2];
-	self->lmodel_ambient[3] = lmodel_ambient[3];
-	self->spotCutOff = spotCutOff;
-	self->spotDirection[0] = spotDirection[0];
-	self->spotDirection[1] = spotDirection[1];
-	self->spotDirection[2] = spotDirection[2];
-	
-
-	
-}
-
-void lucLight_InitAll( 
-		void*                         light,
-		Light_Index                   index,
-		int                           model,
-		int                           material,
-		float                         position[4],
-		float                         lmodel_ambient[4],
-		float                         spotCutOff,
-		float                         spotDirection[3])
-{
-	
-	lucLight* self        = light;
-
-	/* TODO Init parent */
-	lucLight_Init( self, index, model, material, position, lmodel_ambient, spotCutOff, spotDirection);
-}
-
-void _lucLight_Delete( void* light ) {
-	lucLight* self        = light;
-	
-	/*if ( self->originalLight != NULL );
-		Stg_Class_Delete( self->originalLight );*/
-	
-	_Stg_Component_Delete( self );
-}
-
-void _lucLight_Print( void* light, Stream* stream ) {
-	lucLight* self        = light;
-	
-	Journal_Printf( stream, "lucLight: %s\n", self->name );
-
-	Stream_Indent( stream );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	Stream_UnIndent( stream );
-}
-
-void* _lucLight_Copy( void* light, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucLight* self        = light;
-	lucLight* newLight;
-
-	newLight = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newLight->index    = self->index;
-	newLight->model    = self->model;
-	newLight->material = self->material;	
-	
-
-	/*TODO*/
-       	newLight->position[0] = self->position[0];
-	newLight->position[1] = self-> position[1];
-	newLight->position[2] = self->position[2];
-	newLight->position[3] = self->position[3];
-	newLight->lmodel_ambient[0] = self->lmodel_ambient[0];
-	newLight->lmodel_ambient[1] = self->lmodel_ambient[1];
-	newLight->lmodel_ambient[2] = self->lmodel_ambient[2];
-	newLight->lmodel_ambient[3] = self->lmodel_ambient[3];
-	newLight->spotCutOff = self->spotCutOff;
-	newLight->spotDirection[0] = self->spotDirection[0];
-	newLight->spotDirection[1] = self->spotDirection[1];
-	newLight->spotDirection[2] = self->spotDirection[2];
-
-	
-	return (void*) newLight;
-}
-
-void* _lucLight_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof( lucLight );
-	Type                                                      type = lucLight_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucLight_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucLight_Print;
-	Stg_Class_CopyFunction*                                  _copy = _lucLight_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucLight_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucLight_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucLight_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucLight_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucLight_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucLight_Destroy;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucLight_New(  LUCLIGHT_PASSARGS  );
-}
-
-void _lucLight_AssignFromXML( void* light, Stg_ComponentFactory* cf, void* data ) {
-	lucLight*             	self               = (lucLight*) light;
-	Light_Index             index;
-	int 			model;
-	int 			material;
-	float 	        	position[4];
-	float                   spotCutOff;
-	float                   spotDirection[3];
-	Name                    modelName;
-	Name                    materialName;
-	float                   lmodel_ambient[4]; 
-	
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
-
-	glEnable(GL_LIGHTING );
-
-	/* Spot values */
-	spotCutOff = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"spotCutOff", 180.0  );
-	spotDirection[1] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"spotDirectionX", 0.0  );
-	spotDirection[2] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"spotDirectionY", 0.0  );
-	spotDirection[3] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"spotDirectionZ", -1.0  );
-
-        
-	/* Ambient values*/
-	lmodel_ambient[0] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambR", 0.2  );
-	lmodel_ambient[1] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambG", 0.2  );
-	lmodel_ambient[2] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambB", 0.2  );
-	lmodel_ambient[3] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambA", 1.0  );
-
-
-	modelName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"model", "TwoSide"  );
-	if ( strcasecmp( modelName, "Ambient" ) == 0 ) {
-		model = GL_LIGHT_MODEL_AMBIENT;
-		glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
-	}
-	else if ( strcasecmp( modelName, "Local" ) == 0 ) {
-		model = GL_LIGHT_MODEL_LOCAL_VIEWER;
-		glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
-	}
-	else if ( strcasecmp( modelName, "TwoSide" ) == 0 ){
-		model =  GL_LIGHT_MODEL_TWO_SIDE;
-		glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);	
-	}
-
-	position[0]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posX", LUC_LIGHT_DEFAULT_POS_X  );
-	position[1]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posY", LUC_LIGHT_DEFAULT_POS_Y  );
-	position[2]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posZ", LUC_LIGHT_DEFAULT_POS_Z  );
-        position[3]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posW", LUC_LIGHT_DEFAULT_POS_W  );
-
-	/*HACK - Got to retrieve */
-	materialName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"material", "lucMono"  );
-
-
-	lucLight_Init( self, index, model, material, position, lmodel_ambient, spotCutOff, spotDirection);
-	
-}
-
-void _lucLight_Build( void* light, void* data ) { }
-void _lucLight_Initialise( void* light, void* data ) { }
-void _lucLight_Execute( void* light, void* data ) { }
-void _lucLight_Destroy( void* light, void* data ) { }
-
-
-
-void lucLight_Pickle( void* light, Stream* stream ) {
-	lucLight* self                = light;
-	       
-	Journal_Printf( stream, "<struct name=\"%s\">\n", self->name);
-	Stream_Indent( stream );
-
-	Journal_Printf( stream, "<param name=\"Type\">%s</param>\n", self->type );
-	Journal_Printf( stream, "<param name=\"posX\">%.5g</param>\n", self->position[ 0 ] );
-	Journal_Printf( stream, "<param name=\"posY\">%.5g</param>\n", self->position[ 1 ] );
-	Journal_Printf( stream, "<param name=\"posZ\">%.5g</param>\n", self->position[ 2 ] );	
-	Journal_Printf( stream, "<param name=\"posW\">%.5g</param>\n", self->position[ 3 ] );
-
-	Journal_Printf( stream, "<param name=\"ambX\">%.5g</param>\n", self->lmodel_ambient[ 0 ] );
-	Journal_Printf( stream, "<param name=\"ambY\">%.5g</param>\n", self->lmodel_ambient[ 1 ]  );
-	Journal_Printf( stream, "<param name=\"ambZ\">%.5g</param>\n", self->lmodel_ambient[ 2 ]  );
-	Journal_Printf( stream, "<param name=\"ambW\">%.5g</param>\n", self->lmodel_ambient[ 3 ]  );
-
-	Journal_Printf( stream, "<param name=\"model\">%s</param>\n", 
-			self->model == GL_LIGHT_MODEL_LOCAL_VIEWER ? "Local" :
-			self->model == GL_LIGHT_MODEL_AMBIENT ? "Ambient" : 
-	                self->model == GL_LIGHT_MODEL_TWO_SIDE ? "TwoSide" : "" );
-
-	Journal_Printf( stream, "<param name=\"spotCutOff\">%.5g</param>\n", self->spotCutOff );
-	Journal_Printf( stream, "<param name=\"spotDirectionX\">%.5g</param>\n", self->spotDirection[ 0 ]  );
-	Journal_Printf( stream, "<param name=\"spotDirectionY\">%.5g</param>\n", self->spotDirection[ 1 ]  );
-	Journal_Printf( stream, "<param name=\"spotDirectionZ\">%.5g</param>\n", self->spotDirection[ 2 ]  );
-
-	Stream_UnIndent( stream );
-	Journal_Printf( stream, "</struct>\n");
-}
-
-/* functions to change the lights paramters */
-void lucLight_Position( void * light, int lightIndex, float posX, float posY, float posZ, float posW) {
-	lucLight* self = (lucLight*) light;
-
-	/* Sets the potiotion of the light index = index */	
-	glEnable(GL_LIGHTING);
-        
-	self->position[0]  += posX;
-	self->position[1]  += posY;
-	self->position[2]  += posZ;
-	self->position[3]  += posW;
-
-	glLightfv(GL_LIGHT0 + lightIndex, GL_POSITION, self->position);
-
-	self->needsToDraw = True;
-}
-
-void lucLight_Material( int material) {
-}
-
-void lucLight_SetNeedsToDraw( void * light ){
-	lucLight* self = (lucLight*) light;
-	self->needsToDraw = True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Light.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Light.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,344 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Light.c 510 2006-02-17 04:33:32Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "types.h"
+#include "Light.h"
+#include "ViewportInfo.h"
+#include "Init.h"
+
+#include <string.h>
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+
+const Type lucLight_Type = "lucLight";
+
+/* The position defaults have been chosen for a directional light source (hence posW=0)
+   shining onto the left,top,front corner of a 1x1x1 box, currently the most commonly
+   used geometry. -- PatrickSunter, 8 Jun 2006 */
+const double LUC_LIGHT_DEFAULT_POS_X = 1.0;
+const double LUC_LIGHT_DEFAULT_POS_Y = -2.0;
+const double LUC_LIGHT_DEFAULT_POS_Z = -2.0;
+const double LUC_LIGHT_DEFAULT_POS_W = 0.0;
+
+lucLight* lucLight_New( 
+		Name                                               name,
+		Light_Index 				index,
+		int                                   model,
+		int                                   material,
+		float                                 position[4],
+		float                                 lmodel_ambient[4],
+		float                                 spotCutOff,
+		float                                 spotDirection[3]
+)
+{
+	lucLight* self = (lucLight*) _lucLight_DefaultNew( name );
+
+	lucLight_InitAll( self, index, model, material, position, lmodel_ambient, spotCutOff, spotDirection);
+
+	return self;
+}
+
+lucLight* _lucLight_New(  LUCLIGHT_DEFARGS  )
+{
+	lucLight*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucLight) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucLight*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+	
+	
+	return self;
+}
+
+void lucLight_Init(		
+		lucLight*                                         self,
+		Light_Index index,
+		int model,
+		int material,
+		float position[4],
+		float lmodel_ambient[4],
+		float spotCutOff,
+		float spotDirection[3])
+{
+	self->index= index;
+	self->model         = model;
+	self->material          = material;
+	self->position[0] = position[0];
+	self->position[1] = position[1];
+	self->position[2] = position[2];
+	self->position[3] = position[3];
+	self->lmodel_ambient[0] = lmodel_ambient[0];
+	self->lmodel_ambient[1] = lmodel_ambient[1];
+	self->lmodel_ambient[2] = lmodel_ambient[2];
+	self->lmodel_ambient[3] = lmodel_ambient[3];
+	self->spotCutOff = spotCutOff;
+	self->spotDirection[0] = spotDirection[0];
+	self->spotDirection[1] = spotDirection[1];
+	self->spotDirection[2] = spotDirection[2];
+	
+
+	
+}
+
+void lucLight_InitAll( 
+		void*                         light,
+		Light_Index                   index,
+		int                           model,
+		int                           material,
+		float                         position[4],
+		float                         lmodel_ambient[4],
+		float                         spotCutOff,
+		float                         spotDirection[3])
+{
+	
+	lucLight* self        = light;
+
+	/* TODO Init parent */
+	lucLight_Init( self, index, model, material, position, lmodel_ambient, spotCutOff, spotDirection);
+}
+
+void _lucLight_Delete( void* light ) {
+	lucLight* self        = light;
+	
+	/*if ( self->originalLight != NULL );
+		Stg_Class_Delete( self->originalLight );*/
+	
+	_Stg_Component_Delete( self );
+}
+
+void _lucLight_Print( void* light, Stream* stream ) {
+	lucLight* self        = light;
+	
+	Journal_Printf( stream, "lucLight: %s\n", self->name );
+
+	Stream_Indent( stream );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	Stream_UnIndent( stream );
+}
+
+void* _lucLight_Copy( void* light, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucLight* self        = light;
+	lucLight* newLight;
+
+	newLight = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newLight->index    = self->index;
+	newLight->model    = self->model;
+	newLight->material = self->material;	
+	
+
+	/*TODO*/
+       	newLight->position[0] = self->position[0];
+	newLight->position[1] = self-> position[1];
+	newLight->position[2] = self->position[2];
+	newLight->position[3] = self->position[3];
+	newLight->lmodel_ambient[0] = self->lmodel_ambient[0];
+	newLight->lmodel_ambient[1] = self->lmodel_ambient[1];
+	newLight->lmodel_ambient[2] = self->lmodel_ambient[2];
+	newLight->lmodel_ambient[3] = self->lmodel_ambient[3];
+	newLight->spotCutOff = self->spotCutOff;
+	newLight->spotDirection[0] = self->spotDirection[0];
+	newLight->spotDirection[1] = self->spotDirection[1];
+	newLight->spotDirection[2] = self->spotDirection[2];
+
+	
+	return (void*) newLight;
+}
+
+void* _lucLight_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof( lucLight );
+	Type                                                      type = lucLight_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucLight_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucLight_Print;
+	Stg_Class_CopyFunction*                                  _copy = _lucLight_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucLight_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucLight_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucLight_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucLight_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucLight_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucLight_Destroy;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucLight_New(  LUCLIGHT_PASSARGS  );
+}
+
+void _lucLight_AssignFromXML( void* light, Stg_ComponentFactory* cf, void* data ) {
+	lucLight*             	self               = (lucLight*) light;
+	Light_Index             index;
+	int 			model;
+	int 			material;
+	float 	        	position[4];
+	float                   spotCutOff;
+	float                   spotDirection[3];
+	Name                    modelName;
+	Name                    materialName;
+	float                   lmodel_ambient[4]; 
+	
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
+
+	glEnable(GL_LIGHTING );
+
+	/* Spot values */
+	spotCutOff = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"spotCutOff", 180.0  );
+	spotDirection[1] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"spotDirectionX", 0.0  );
+	spotDirection[2] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"spotDirectionY", 0.0  );
+	spotDirection[3] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"spotDirectionZ", -1.0  );
+
+        
+	/* Ambient values*/
+	lmodel_ambient[0] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambR", 0.2  );
+	lmodel_ambient[1] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambG", 0.2  );
+	lmodel_ambient[2] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambB", 0.2  );
+	lmodel_ambient[3] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"ambA", 1.0  );
+
+
+	modelName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"model", "TwoSide"  );
+	if ( strcasecmp( modelName, "Ambient" ) == 0 ) {
+		model = GL_LIGHT_MODEL_AMBIENT;
+		glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+	}
+	else if ( strcasecmp( modelName, "Local" ) == 0 ) {
+		model = GL_LIGHT_MODEL_LOCAL_VIEWER;
+		glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
+	}
+	else if ( strcasecmp( modelName, "TwoSide" ) == 0 ){
+		model =  GL_LIGHT_MODEL_TWO_SIDE;
+		glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);	
+	}
+
+	position[0]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posX", LUC_LIGHT_DEFAULT_POS_X  );
+	position[1]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posY", LUC_LIGHT_DEFAULT_POS_Y  );
+	position[2]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posZ", LUC_LIGHT_DEFAULT_POS_Z  );
+        position[3]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"posW", LUC_LIGHT_DEFAULT_POS_W  );
+
+	/*HACK - Got to retrieve */
+	materialName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"material", "lucMono"  );
+
+
+	lucLight_Init( self, index, model, material, position, lmodel_ambient, spotCutOff, spotDirection);
+	
+}
+
+void _lucLight_Build( void* light, void* data ) { }
+void _lucLight_Initialise( void* light, void* data ) { }
+void _lucLight_Execute( void* light, void* data ) { }
+void _lucLight_Destroy( void* light, void* data ) { }
+
+
+
+void lucLight_Pickle( void* light, Stream* stream ) {
+	lucLight* self                = light;
+	       
+	Journal_Printf( stream, "<struct name=\"%s\">\n", self->name);
+	Stream_Indent( stream );
+
+	Journal_Printf( stream, "<param name=\"Type\">%s</param>\n", self->type );
+	Journal_Printf( stream, "<param name=\"posX\">%.5g</param>\n", self->position[ 0 ] );
+	Journal_Printf( stream, "<param name=\"posY\">%.5g</param>\n", self->position[ 1 ] );
+	Journal_Printf( stream, "<param name=\"posZ\">%.5g</param>\n", self->position[ 2 ] );	
+	Journal_Printf( stream, "<param name=\"posW\">%.5g</param>\n", self->position[ 3 ] );
+
+	Journal_Printf( stream, "<param name=\"ambX\">%.5g</param>\n", self->lmodel_ambient[ 0 ] );
+	Journal_Printf( stream, "<param name=\"ambY\">%.5g</param>\n", self->lmodel_ambient[ 1 ]  );
+	Journal_Printf( stream, "<param name=\"ambZ\">%.5g</param>\n", self->lmodel_ambient[ 2 ]  );
+	Journal_Printf( stream, "<param name=\"ambW\">%.5g</param>\n", self->lmodel_ambient[ 3 ]  );
+
+	Journal_Printf( stream, "<param name=\"model\">%s</param>\n", 
+			self->model == GL_LIGHT_MODEL_LOCAL_VIEWER ? "Local" :
+			self->model == GL_LIGHT_MODEL_AMBIENT ? "Ambient" : 
+	                self->model == GL_LIGHT_MODEL_TWO_SIDE ? "TwoSide" : "" );
+
+	Journal_Printf( stream, "<param name=\"spotCutOff\">%.5g</param>\n", self->spotCutOff );
+	Journal_Printf( stream, "<param name=\"spotDirectionX\">%.5g</param>\n", self->spotDirection[ 0 ]  );
+	Journal_Printf( stream, "<param name=\"spotDirectionY\">%.5g</param>\n", self->spotDirection[ 1 ]  );
+	Journal_Printf( stream, "<param name=\"spotDirectionZ\">%.5g</param>\n", self->spotDirection[ 2 ]  );
+
+	Stream_UnIndent( stream );
+	Journal_Printf( stream, "</struct>\n");
+}
+
+/* functions to change the lights paramters */
+void lucLight_Position( void * light, int lightIndex, float posX, float posY, float posZ, float posW) {
+	lucLight* self = (lucLight*) light;
+
+	/* Sets the potiotion of the light index = index */	
+	glEnable(GL_LIGHTING);
+        
+	self->position[0]  += posX;
+	self->position[1]  += posY;
+	self->position[2]  += posZ;
+	self->position[3]  += posW;
+
+	glLightfv(GL_LIGHT0 + lightIndex, GL_POSITION, self->position);
+
+	self->needsToDraw = True;
+}
+
+void lucLight_Material( int material) {
+}
+
+void lucLight_SetNeedsToDraw( void * light ){
+	lucLight* self = (lucLight*) light;
+	self->needsToDraw = True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Light_Register.c
--- a/Base/src/Light_Register.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-
-#include "Light_Register.h"
-#include "Light.h"
-#include <gl.h>
-#include <glu.h>
-
-const Type lucLight_Register_Type = "lucLight_Register";
-
-lucLight_Register*	lucLight_Register_New( void ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(lucLight_Register);
-	Type                              type = lucLight_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
-	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
-
-	lucLight_Register* self;
-	
-	self = (lucLight_Register*) _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
-	self->currentLightIndex = 0;
-
-	return self;
-}
-
-void    lucLight_Register_EnableAll( void * lightRegister ) {
-	lucLight_Register* self = (lucLight_Register*) lightRegister;
-	
-	lucLight* light;
-	Light_Index lightCount = 0;
-	Light_Index light_I = 0;
-	
-	/* Enabling the lights */
-	glEnable(GL_LIGHTING);
-	lightCount = lucLight_Register_GetCount( self );
-	
-	for (light_I = 0; light_I < lightCount; light_I++){
-            light = lucLight_Register_GetByIndex(self, light_I);	    
-	    glLightfv(GL_LIGHT0 + light_I, GL_POSITION, light->position);
-	    glLightf(GL_LIGHT0 + light_I, GL_SPOT_CUTOFF, light->spotCutOff);
-	    glLightfv(GL_LIGHT0 + light_I, GL_SPOT_DIRECTION, light->spotDirection);	
-
-            glEnable(GL_LIGHT0 + light_I);	    
-	}
-	
-	if(lightCount == 0) 	/* No light is listed in the xml file, but we still need to enable the default light */
-	   glEnable(GL_LIGHT0);
-
-}
-
-Light_Index   lucLight_Register_GetCurrentLightIndex( void * lightRegister ) {
-	lucLight_Register* self = (lucLight_Register*) lightRegister;
-	return self->currentLightIndex;
-}
-
-void lucLight_Register_SetCurrentLightIndex( void * lightRegister, Light_Index index ) {
-	lucLight_Register* self = (lucLight_Register*) lightRegister;
-	self->currentLightIndex = index;
-}
-void lucLight_Register_ChangeCurrentLightIndex( void * lightRegister ) {
-	lucLight_Register* self = (lucLight_Register*) lightRegister;
-	Light_Index lightCount   = lucLight_Register_GetCount( self );
-	self->currentLightIndex ++;
-	if (self->currentLightIndex == lightCount)  self->currentLightIndex = 0;
-
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Light_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Light_Register.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,118 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+
+#include "Light_Register.h"
+#include "Light.h"
+#include <gl.h>
+#include <glu.h>
+
+const Type lucLight_Register_Type = "lucLight_Register";
+
+lucLight_Register*	lucLight_Register_New( void ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(lucLight_Register);
+	Type                              type = lucLight_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
+	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
+
+	lucLight_Register* self;
+	
+	self = (lucLight_Register*) _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
+	self->currentLightIndex = 0;
+
+	return self;
+}
+
+void    lucLight_Register_EnableAll( void * lightRegister ) {
+	lucLight_Register* self = (lucLight_Register*) lightRegister;
+	
+	lucLight* light;
+	Light_Index lightCount = 0;
+	Light_Index light_I = 0;
+	
+	/* Enabling the lights */
+	glEnable(GL_LIGHTING);
+	lightCount = lucLight_Register_GetCount( self );
+	
+	for (light_I = 0; light_I < lightCount; light_I++){
+            light = lucLight_Register_GetByIndex(self, light_I);	    
+	    glLightfv(GL_LIGHT0 + light_I, GL_POSITION, light->position);
+	    glLightf(GL_LIGHT0 + light_I, GL_SPOT_CUTOFF, light->spotCutOff);
+	    glLightfv(GL_LIGHT0 + light_I, GL_SPOT_DIRECTION, light->spotDirection);	
+
+            glEnable(GL_LIGHT0 + light_I);	    
+	}
+	
+	if(lightCount == 0) 	/* No light is listed in the xml file, but we still need to enable the default light */
+	   glEnable(GL_LIGHT0);
+
+}
+
+Light_Index   lucLight_Register_GetCurrentLightIndex( void * lightRegister ) {
+	lucLight_Register* self = (lucLight_Register*) lightRegister;
+	return self->currentLightIndex;
+}
+
+void lucLight_Register_SetCurrentLightIndex( void * lightRegister, Light_Index index ) {
+	lucLight_Register* self = (lucLight_Register*) lightRegister;
+	self->currentLightIndex = index;
+}
+void lucLight_Register_ChangeCurrentLightIndex( void * lightRegister ) {
+	lucLight_Register* self = (lucLight_Register*) lightRegister;
+	Light_Index lightCount   = lucLight_Register_GetCount( self );
+	self->currentLightIndex ++;
+	if (self->currentLightIndex == lightCount)  self->currentLightIndex = 0;
+
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/OutputFormat.c
--- a/Base/src/OutputFormat.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OutputFormat.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "OutputFormat.h"
-#include "ColourMap.h"
-#include "Window.h"
-#include "DrawingObject_Register.h"
-#include "DrawingObject.h"
-#include "Camera.h"
-#include "Init.h"
-#include "Window.h"
-
-#include <assert.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-const Type lucOutputFormat_Type = "lucOutputFormat";
-
-lucOutputFormat* _lucOutputFormat_New(  LUCOUTPUTFORMAT_DEFARGS  )
-{
-	lucOutputFormat*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucOutputFormat) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucOutputFormat*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-
-	self->_output = _output;
-
-	return self;
-}
-
-void _lucOutputFormat_Init( 
-		lucOutputFormat*                                   self, 
-		Name                                               extension )
-{
-	self->extension     = StG_Strdup( extension );
-}
-
-void lucOutputFormat_InitAll( 
-		void*                                              outputFormat,
-		Name                                               extension )
-{
-	lucOutputFormat* self        = outputFormat;
-
-	_lucOutputFormat_Init( self, extension );
-}
-
-	
-void _lucOutputFormat_Delete( void* outputFormat ) {
-	lucOutputFormat* self        = outputFormat;
-
-	Memory_Free( self->extension );
-	
-	_Stg_Component_Delete( self );
-}
-
-void _lucOutputFormat_Print( void* outputFormat, Stream* stream ) {
-	lucOutputFormat*          self        = outputFormat;
-	
-	Journal_Printf( stream, "lucOutputFormat: %s\n", self->name );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	Journal_PrintString( stream, self->extension );
-}
-
-void* _lucOutputFormat_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucOutputFormat* self        = outputFormat;
-	lucOutputFormat* newOutputFormat;
-
-	newOutputFormat = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newOutputFormat->extension = StG_Strdup( self->extension );
-
-	return (void*) newOutputFormat;
-}
-
-void _lucOutputFormat_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ) {
-	lucOutputFormat* self        = outputFormat;
-
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
-}
-void _lucOutputFormat_Build( void* outputFormat, void* data ) { }
-void _lucOutputFormat_Initialise( void* outputFormat, void* data ) { }
-void _lucOutputFormat_Execute( void* outputFormat, void* data ) { }
-void _lucOutputFormat_Destroy( void* outputFormat, void* data ) { }
-
-
-void lucOutputFormat_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucOutputFormat*        self               = (lucOutputFormat*) outputFormat;
-
-	if ( context->rank != MASTER )
-		return;
-
-	self->_output( self, window, context, pixelData );
-}
-
-
-Name lucOutputFormat_GetImageFilename( void* outputFormat, lucWindow* window, void* _context ) {
-	lucOutputFormat* self       = (lucOutputFormat*) outputFormat;
-	AbstractContext* context    = (AbstractContext*) _context;
-	Stream*          infoStream = Journal_MyStream( Info_Type, self );
-	Name             filename;
-
-	if ( lucWindow_HasStereoCamera( window ) ) 
-		Stg_asprintf( &filename, "%s/%s.%05d.%s.%s", 
-				context->outputPath, 
-				window->name, 
-				context->timeStep, 
-				window->currStereoBuffer == lucLeft ? "left" : "right", 
-				self->extension );
-	else 
-		Stg_asprintf( &filename, "%s/%s.%05d.%s", context->outputPath, window->name, context->timeStep, self->extension );
-	
-	Journal_Printf( infoStream, "Creating %s file: %s\n", self->extension, filename );
-
-	return filename;
-}
-
-FILE* lucOutputFormat_OpenFile( void* outputFormat, lucWindow* window, void* _context, const char *mode ) {
-	lucOutputFormat* self       = (lucOutputFormat*) outputFormat;
-	AbstractContext* context    = (AbstractContext*) _context;
-	Stream*          error      = Journal_MyStream( Error_Type, self );
-	Name             filename;
-	FILE*            file;
-
-	filename = lucOutputFormat_GetImageFilename( self, window, context );
-	file = fopen( filename, mode );
-
-	Journal_Firewall( file != NULL, error, "In func %s: Cannot open file %s.\n", __func__, filename );
-
-	Memory_Free( filename );
-	return file;
-}
-
-Stream* lucOutputFormat_OpenStream( void* outputFormat, lucWindow* window, void* context ) {
-	lucOutputFormat* self       = (lucOutputFormat*) outputFormat;
-	Stream*          stream     = Journal_MyStream( Dump_Type, self );
-	Stream*          error      = Journal_MyStream( Error_Type, self );
-	Name             filename;
-	Bool             result;
-
-	filename = lucOutputFormat_GetImageFilename( self, window, context );
-	result = Stream_RedirectFile( stream, filename );
-
-	Journal_Firewall( result, error, "In func %s: Cannot open file %s.\n", __func__, filename );
-
-	Memory_Free( filename );
-	
-	/* Setup stream */
-	Stream_Enable( stream, True );
-	Stream_SetAutoFlush( stream, True );
-
-	return stream;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/OutputFormat.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/OutputFormat.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,214 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OutputFormat.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "OutputFormat.h"
+#include "ColourMap.h"
+#include "Window.h"
+#include "DrawingObject_Register.h"
+#include "DrawingObject.h"
+#include "Camera.h"
+#include "Init.h"
+#include "Window.h"
+
+#include <assert.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+const Type lucOutputFormat_Type = "lucOutputFormat";
+
+lucOutputFormat* _lucOutputFormat_New(  LUCOUTPUTFORMAT_DEFARGS  )
+{
+	lucOutputFormat*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucOutputFormat) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucOutputFormat*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+
+	self->_output = _output;
+
+	return self;
+}
+
+void _lucOutputFormat_Init( 
+		lucOutputFormat*                                   self, 
+		Name                                               extension )
+{
+	self->extension     = StG_Strdup( extension );
+}
+
+void lucOutputFormat_InitAll( 
+		void*                                              outputFormat,
+		Name                                               extension )
+{
+	lucOutputFormat* self        = outputFormat;
+
+	_lucOutputFormat_Init( self, extension );
+}
+
+	
+void _lucOutputFormat_Delete( void* outputFormat ) {
+	lucOutputFormat* self        = outputFormat;
+
+	Memory_Free( self->extension );
+	
+	_Stg_Component_Delete( self );
+}
+
+void _lucOutputFormat_Print( void* outputFormat, Stream* stream ) {
+	lucOutputFormat*          self        = outputFormat;
+	
+	Journal_Printf( stream, "lucOutputFormat: %s\n", self->name );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	Journal_PrintString( stream, self->extension );
+}
+
+void* _lucOutputFormat_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucOutputFormat* self        = outputFormat;
+	lucOutputFormat* newOutputFormat;
+
+	newOutputFormat = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newOutputFormat->extension = StG_Strdup( self->extension );
+
+	return (void*) newOutputFormat;
+}
+
+void _lucOutputFormat_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ) {
+	lucOutputFormat* self        = outputFormat;
+
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
+}
+void _lucOutputFormat_Build( void* outputFormat, void* data ) { }
+void _lucOutputFormat_Initialise( void* outputFormat, void* data ) { }
+void _lucOutputFormat_Execute( void* outputFormat, void* data ) { }
+void _lucOutputFormat_Destroy( void* outputFormat, void* data ) { }
+
+
+void lucOutputFormat_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucOutputFormat*        self               = (lucOutputFormat*) outputFormat;
+
+	if ( context->rank != MASTER )
+		return;
+
+	self->_output( self, window, context, pixelData );
+}
+
+
+Name lucOutputFormat_GetImageFilename( void* outputFormat, lucWindow* window, void* _context ) {
+	lucOutputFormat* self       = (lucOutputFormat*) outputFormat;
+	AbstractContext* context    = (AbstractContext*) _context;
+	Stream*          infoStream = Journal_MyStream( Info_Type, self );
+	Name             filename;
+
+	if ( lucWindow_HasStereoCamera( window ) ) 
+		Stg_asprintf( &filename, "%s/%s.%05d.%s.%s", 
+				context->outputPath, 
+				window->name, 
+				context->timeStep, 
+				window->currStereoBuffer == lucLeft ? "left" : "right", 
+				self->extension );
+	else 
+		Stg_asprintf( &filename, "%s/%s.%05d.%s", context->outputPath, window->name, context->timeStep, self->extension );
+	
+	Journal_Printf( infoStream, "Creating %s file: %s\n", self->extension, filename );
+
+	return filename;
+}
+
+FILE* lucOutputFormat_OpenFile( void* outputFormat, lucWindow* window, void* _context, const char *mode ) {
+	lucOutputFormat* self       = (lucOutputFormat*) outputFormat;
+	AbstractContext* context    = (AbstractContext*) _context;
+	Stream*          error      = Journal_MyStream( Error_Type, self );
+	Name             filename;
+	FILE*            file;
+
+	filename = lucOutputFormat_GetImageFilename( self, window, context );
+	file = fopen( filename, mode );
+
+	Journal_Firewall( file != NULL, error, "In func %s: Cannot open file %s.\n", __func__, filename );
+
+	Memory_Free( filename );
+	return file;
+}
+
+Stream* lucOutputFormat_OpenStream( void* outputFormat, lucWindow* window, void* context ) {
+	lucOutputFormat* self       = (lucOutputFormat*) outputFormat;
+	Stream*          stream     = Journal_MyStream( Dump_Type, self );
+	Stream*          error      = Journal_MyStream( Error_Type, self );
+	Name             filename;
+	Bool             result;
+
+	filename = lucOutputFormat_GetImageFilename( self, window, context );
+	result = Stream_RedirectFile( stream, filename );
+
+	Journal_Firewall( result, error, "In func %s: Cannot open file %s.\n", __func__, filename );
+
+	Memory_Free( filename );
+	
+	/* Setup stream */
+	Stream_Enable( stream, True );
+	Stream_SetAutoFlush( stream, True );
+
+	return stream;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/OutputFormat_Register.c
--- a/Base/src/OutputFormat_Register.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OutputFormat_Register.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "OutputFormat_Register.h"
-#include "OutputFormat.h"
-
-const Type lucOutputFormat_Register_Type = "lucOutputFormat_Register";
-
-lucOutputFormat_Register*	lucOutputFormat_Register_New( void ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(lucOutputFormat_Register);
-	Type                              type = lucOutputFormat_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
-	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
-
-	lucOutputFormat_Register* self;
-	
-	self = (lucOutputFormat_Register*) _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
-
-	return self;
-}
-
-void lucOutputFormat_Register_OutputAll( void* outputFormat_Register, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucOutputFormat_Register* self          = (lucOutputFormat_Register*) outputFormat_Register;
-	OutputFormat_Index        object_I;
-	OutputFormat_Index        objectCount   = lucOutputFormat_Register_GetCount( self );
-	lucOutputFormat*          object;
-
-	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
-		object = lucOutputFormat_Register_GetByIndex( self, object_I );
-		lucOutputFormat_Output( object, window, context, pixelData );
-	}
-}
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/OutputFormat_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/OutputFormat_Register.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,86 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OutputFormat_Register.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "OutputFormat_Register.h"
+#include "OutputFormat.h"
+
+const Type lucOutputFormat_Register_Type = "lucOutputFormat_Register";
+
+lucOutputFormat_Register*	lucOutputFormat_Register_New( void ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(lucOutputFormat_Register);
+	Type                              type = lucOutputFormat_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
+	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
+
+	lucOutputFormat_Register* self;
+	
+	self = (lucOutputFormat_Register*) _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
+
+	return self;
+}
+
+void lucOutputFormat_Register_OutputAll( void* outputFormat_Register, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucOutputFormat_Register* self          = (lucOutputFormat_Register*) outputFormat_Register;
+	OutputFormat_Index        object_I;
+	OutputFormat_Index        objectCount   = lucOutputFormat_Register_GetCount( self );
+	lucOutputFormat*          object;
+
+	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
+		object = lucOutputFormat_Register_GetByIndex( self, object_I );
+		lucOutputFormat_Output( object, window, context, pixelData );
+	}
+}
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/RenderingEngine.c
--- a/Base/src/RenderingEngine.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: RenderingEngine.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "ColourMap.h"
-#include "X11Colours.h"
-#include "Window.h"
-#include "RenderingEngine.h"
-#include "Init.h"
-
-#include <assert.h>
-
-const Type lucRenderingEngine_Type = "lucRenderingEngine";
-
-lucRenderingEngine* _lucRenderingEngine_New(  LUCRENDERINGENGINE_DEFARGS  )
-{
-	lucRenderingEngine*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucRenderingEngine) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucRenderingEngine*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-
-	self->_render            = _render;
-	self->_clear			 = _clear;
-	self->_getPixelData      = _getPixelData;
-	self->_compositeViewport = _compositeViewport;
-	
-	return self;
-}
-
-void _lucRenderingEngine_Init( lucRenderingEngine* self ) {
-	self->isConstructed = True;
-}
-
-void lucRenderingEngine_InitAll( void* renderingEngine ) {
-	lucRenderingEngine* self        = renderingEngine;
-
-	_lucRenderingEngine_Init( self );
-}
-
-void _lucRenderingEngine_Delete( void* renderingEngine ) {
-	lucRenderingEngine* self        = renderingEngine;
-	
-	_Stg_Component_Delete( self );
-}
-
-void _lucRenderingEngine_Print( void* renderingEngine, Stream* stream ) {
-	lucRenderingEngine* self        = renderingEngine;
-	
-	Journal_Printf( stream, "lucRenderingEngine: %s\n", self->name );
-
-	Stream_Indent( stream );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	Journal_PrintPointer( stream, self->_getPixelData );
-	
-	Stream_UnIndent( stream );
-}
-
-void* _lucRenderingEngine_Copy( void* renderingEngine, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucRenderingEngine* self        = renderingEngine;
-	lucRenderingEngine* newRenderingEngine;
-
-	newRenderingEngine = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	return (void*) newRenderingEngine;
-}
-
-void _lucRenderingEngine_AssignFromXML( void* renderingEngine, Stg_ComponentFactory* cf, void* data ) {
-	lucRenderingEngine*        self            = (lucRenderingEngine*) renderingEngine ;
-
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
-
-	_lucRenderingEngine_Init( self  );
-}
-
-void _lucRenderingEngine_Build( void* camera, void* data ) { }
-void _lucRenderingEngine_Initialise( void* camera, void* data ) { }
-void _lucRenderingEngine_Execute( void* camera, void* data ) { }
-void _lucRenderingEngine_Destroy( void* camera, void* data ) { }
-
-void lucRenderingEngine_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) {
-	lucRenderingEngine*   self       = (lucRenderingEngine*) renderingEngine ;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	self->_render( self, window, context );
-	
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucRenderingEngine_Clear( void* renderingEngine,  lucWindow* window, Bool clearAll ) {
-	lucRenderingEngine*   self       = (lucRenderingEngine*) renderingEngine ;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	self->_clear( self, window, clearAll );
-	
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucRenderingEngine_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* pixelData ) {
-	lucRenderingEngine*   self       = (lucRenderingEngine*) renderingEngine ;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	self->_getPixelData( self, window, pixelData );
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucRenderingEngine_CompositeViewport( 
-		void*                                              renderingEngine, 
-		lucViewportInfo*                                   viewportInfo, 
-		AbstractContext*                                   context, 
-		Bool                                               broadcast )
-{
-	lucRenderingEngine*   self       = (lucRenderingEngine*) renderingEngine ;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	if ( context->nproc ==1 ) {
-		Journal_DPrintfL( lucDebug, 2, "Running in serial - No need to composite.\n" );
-	}
-	else {
-		self->_compositeViewport( self, viewportInfo, context, broadcast );
-	}
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/RenderingEngine.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/RenderingEngine.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,187 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: RenderingEngine.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "ColourMap.h"
+#include "X11Colours.h"
+#include "Window.h"
+#include "RenderingEngine.h"
+#include "Init.h"
+
+#include <assert.h>
+
+const Type lucRenderingEngine_Type = "lucRenderingEngine";
+
+lucRenderingEngine* _lucRenderingEngine_New(  LUCRENDERINGENGINE_DEFARGS  )
+{
+	lucRenderingEngine*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucRenderingEngine) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucRenderingEngine*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+
+	self->_render            = _render;
+	self->_clear			 = _clear;
+	self->_getPixelData      = _getPixelData;
+	self->_compositeViewport = _compositeViewport;
+	
+	return self;
+}
+
+void _lucRenderingEngine_Init( lucRenderingEngine* self ) {
+	self->isConstructed = True;
+}
+
+void lucRenderingEngine_InitAll( void* renderingEngine ) {
+	lucRenderingEngine* self        = renderingEngine;
+
+	_lucRenderingEngine_Init( self );
+}
+
+void _lucRenderingEngine_Delete( void* renderingEngine ) {
+	lucRenderingEngine* self        = renderingEngine;
+	
+	_Stg_Component_Delete( self );
+}
+
+void _lucRenderingEngine_Print( void* renderingEngine, Stream* stream ) {
+	lucRenderingEngine* self        = renderingEngine;
+	
+	Journal_Printf( stream, "lucRenderingEngine: %s\n", self->name );
+
+	Stream_Indent( stream );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	Journal_PrintPointer( stream, self->_getPixelData );
+	
+	Stream_UnIndent( stream );
+}
+
+void* _lucRenderingEngine_Copy( void* renderingEngine, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucRenderingEngine* self        = renderingEngine;
+	lucRenderingEngine* newRenderingEngine;
+
+	newRenderingEngine = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	return (void*) newRenderingEngine;
+}
+
+void _lucRenderingEngine_AssignFromXML( void* renderingEngine, Stg_ComponentFactory* cf, void* data ) {
+	lucRenderingEngine*        self            = (lucRenderingEngine*) renderingEngine ;
+
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
+
+	_lucRenderingEngine_Init( self  );
+}
+
+void _lucRenderingEngine_Build( void* camera, void* data ) { }
+void _lucRenderingEngine_Initialise( void* camera, void* data ) { }
+void _lucRenderingEngine_Execute( void* camera, void* data ) { }
+void _lucRenderingEngine_Destroy( void* camera, void* data ) { }
+
+void lucRenderingEngine_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) {
+	lucRenderingEngine*   self       = (lucRenderingEngine*) renderingEngine ;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	self->_render( self, window, context );
+	
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucRenderingEngine_Clear( void* renderingEngine,  lucWindow* window, Bool clearAll ) {
+	lucRenderingEngine*   self       = (lucRenderingEngine*) renderingEngine ;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	self->_clear( self, window, clearAll );
+	
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucRenderingEngine_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* pixelData ) {
+	lucRenderingEngine*   self       = (lucRenderingEngine*) renderingEngine ;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	self->_getPixelData( self, window, pixelData );
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucRenderingEngine_CompositeViewport( 
+		void*                                              renderingEngine, 
+		lucViewportInfo*                                   viewportInfo, 
+		AbstractContext*                                   context, 
+		Bool                                               broadcast )
+{
+	lucRenderingEngine*   self       = (lucRenderingEngine*) renderingEngine ;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	if ( context->nproc ==1 ) {
+		Journal_DPrintfL( lucDebug, 2, "Running in serial - No need to composite.\n" );
+	}
+	else {
+		self->_compositeViewport( self, viewportInfo, context, broadcast );
+	}
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Viewport.c
--- a/Base/src/Viewport.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,366 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Viewport.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "ColourMap.h"
-#include "Window.h"
-#include "DrawingObject_Register.h"
-#include "Light_Register.h"
-#include "Light.h"
-
-
-#include "Viewport.h"
-
-#include "DrawingObject.h"
-#include "Camera.h"
-#include "Init.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-
-
-const Type lucViewport_Type = "lucViewport";
-
-MPI_Datatype lucViewport_MPI_Datatype;
-
-lucViewport* lucViewport_New(
-		Name                                               name,
-		lucCamera*                                         camera,
-		lucDrawingObject**                                 drawingObjectList,
-		DrawingObject_Index                                drawingObjectCount,
-		lucLight**          				   lightList,
-	  	Light_Index                                        lightCount,
-		Bool                                               drawTitle,
-		Bool                                               drawTime,
-		Bool                                               compositeEachObject,
-		double                                             nearClipPlane,
-		double                                             farClipPlane )
-{
-	lucViewport* self = _lucViewport_DefaultNew( name );
-
-	lucViewport_InitAll( self, camera, drawingObjectList, drawingObjectCount, lightList, lightCount, drawTitle, drawTime, compositeEachObject, nearClipPlane, farClipPlane );
-
-	return self;
-}
-
-lucViewport* _lucViewport_New(  LUCVIEWPORT_DEFARGS  )
-{
-	lucViewport*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucViewport) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucViewport*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-
-	return self;
-}
-
-void _lucViewport_Init( 
-		lucViewport*                                       self, 
-		lucCamera*                                         camera, 
-		lucDrawingObject**                                 drawingObjectList, 
-		DrawingObject_Index                                drawingObjectCount,
-		lucLight**          				   lightList,
-	        Light_Index                                        lightCount,
-		Bool                                               drawTitle,
-		Bool                                               drawTime,
-		Bool                                               compositeEachObject,
-		double                                             nearClipPlane,
-		double                                             farClipPlane )
-{
-	DrawingObject_Index object_I;
-	Light_Index light_I;
-	GLfloat lightPosition[4];
-	GLfloat lmodel_ambient[4] = {0.2, 0.2, 0.2, 1.0};
-	GLfloat spotCutOff = 180.0;
-	GLfloat spotDirection[3] = {0.0, 0.0, -1.0};
-	
-	lightPosition[0]= LUC_LIGHT_DEFAULT_POS_X;
-	lightPosition[1]= LUC_LIGHT_DEFAULT_POS_Y;
-	lightPosition[2]= LUC_LIGHT_DEFAULT_POS_Z;
-	lightPosition[3]= LUC_LIGHT_DEFAULT_POS_W;
-	
-	self->camera                   = camera;
-	self->drawTitle                = drawTitle;
-	self->drawTime                 = drawTime;
-	self->nearClipPlane            = nearClipPlane;
-	self->farClipPlane             = farClipPlane;
-	self->compositeEachObject      = compositeEachObject;
-
-	self->drawingObject_Register = lucDrawingObject_Register_New();
-
-	for ( object_I = 0 ; object_I < drawingObjectCount ; object_I++ )
-		lucDrawingObject_Register_Add( self->drawingObject_Register, drawingObjectList[ object_I ] );
-		
-	/* Setup light register stuff*/	
-	self->light_Register = lucLight_Register_New();
-
-	for ( light_I = 0 ; light_I < lightCount ; light_I++ )
-		lucLight_Register_Add( self->light_Register, lightList[ light_I ] );
-
-       	if(lightCount == 0){
-       		self->defaultLight = lucLight_New( "defaultLight", 0, GL_LIGHT_MODEL_TWO_SIDE,  GL_AMBIENT_AND_DIFFUSE, lightPosition, lmodel_ambient, spotCutOff, spotDirection);
-		lucLight_Register_Add( self->light_Register, self->defaultLight );
-	}
-
-
-}
-
-void lucViewport_InitAll( 
-		void*                                              viewport,
-		lucCamera*                                         camera, 
-		lucDrawingObject**                                 drawingObjectList, 
-		DrawingObject_Index                                drawingObjectCount,
-	        lucLight**          			           lightList,
-	 	Light_Index                                        lightCount,
-		Bool                                               drawTitle,
-		Bool                                               drawTime,
-		Bool                                               compositeEachObject,
-		double                                             nearClipPlane,
-		double                                             farClipPlane )
-{
-	lucViewport* self        = viewport;
-
-	_lucViewport_Init( self, camera, drawingObjectList, drawingObjectCount, lightList, lightCount, drawTitle, drawTime, compositeEachObject, nearClipPlane, farClipPlane );
-}
-
-	
-void _lucViewport_Delete( void* viewport ) {
-	lucViewport* self        = viewport;
-	
-	_Stg_Component_Delete( self );
-}
-
-void _lucViewport_Print( void* viewport, Stream* stream ) {
-	lucViewport*          self        = viewport;
-	
-	Journal_Printf( stream, "lucViewport: %s\n", self->name );
-
-	Stream_Indent( stream );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	lucDrawingObject_Register_PrintAllObjects( self->drawingObject_Register, stream );
-
-	Stg_Class_Print( self->camera, stream );
-
-	Journal_PrintValue( stream, self->nearClipPlane );
-	Journal_PrintValue( stream, self->farClipPlane );
-	
-	Journal_PrintBool( stream, self->drawTitle );
-	Journal_PrintBool( stream, self->drawTime );
-	Journal_PrintBool( stream, self->compositeEachObject );
-	
-	Stream_UnIndent( stream );
-}
-
-void* _lucViewport_Copy( void* viewport, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucViewport* self        = viewport;
-	lucViewport* newViewport;
-
-	newViewport = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-	if ( deep ) {
-		newViewport->camera     = (lucCamera*)  Stg_Class_Copy( self->camera,     dest, deep, nameExt, ptrMap );
-	}
-	else {
-		newViewport->camera        = self->camera;
-	}
-
-	newViewport->nearClipPlane       = self->nearClipPlane;
-	newViewport->farClipPlane        = self->farClipPlane;
-	newViewport->drawTitle           = self->drawTitle;
-	newViewport->drawTime            = self->drawTime;
-	newViewport->compositeEachObject = self->compositeEachObject;
-
-	return (void*) newViewport;
-}
-
-void* _lucViewport_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof( lucViewport );
-	Type                                                      type = lucViewport_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucViewport_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucViewport_Print;
-	Stg_Class_CopyFunction*                                  _copy = _lucViewport_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucViewport_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucViewport_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucViewport_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucViewport_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucViewport_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucViewport_Destroy;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucViewport_New(  LUCVIEWPORT_PASSARGS  );
-}
-
-void _lucViewport_AssignFromXML( void* viewport, Stg_ComponentFactory* cf, void* data ) {
-	lucViewport*        self               = (lucViewport*) viewport;
-	DrawingObject_Index drawingObjectCount;
-	lucDrawingObject**  drawingObjectList;
-	lucLight**          lightList;
-	Light_Index         lightCount;
-	lucCamera*          camera;
-
-	/* TODO Construct Parent */
-
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
-
-	camera =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Camera", lucCamera, True, data  ) ;
-
-	drawingObjectList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"DrawingObject", Stg_ComponentFactory_Unlimited, lucDrawingObject, True, &drawingObjectCount, data  );
-	
-	/* Grab a list of lights for this viewport */
-	lightList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"Light", Stg_ComponentFactory_Unlimited, lucLight, False, &lightCount, data  );
-
-	_lucViewport_Init(
-			self,
-			camera,
-			drawingObjectList,
-			drawingObjectCount,
-			lightList,
-			lightCount,
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawTitle", True  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawTime", False  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"compositeEachObject", False  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"nearClipPlane", 0.1  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"farClipPlane", 40.0 ) );
-
-	Memory_Free( drawingObjectList );
-        if(lightList)
-		Memory_Free( lightList  );
-}
-
-void _lucViewport_Build( void* camera, void* data ) { }
-void _lucViewport_Initialise( void* camera, void* data ) { }
-void _lucViewport_Execute( void* camera, void* data ) { }
-void _lucViewport_Destroy( void* camera, void* data ) { }
-
-void lucViewport_Draw( void* viewport, lucWindow* window, lucViewportInfo* viewportInfo, void* context ) {
-	lucViewport*          self = (lucViewport*) viewport ;
-
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	/*Enables the lights */
-	lucLight_Register_EnableAll( self->light_Register );
-
-	lucDrawingObject_Register_DrawAll( self->drawingObject_Register, window, viewportInfo, context, self->compositeEachObject );
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucViewport_CleanUp( void* viewport, void* context ) {
-	lucViewport*          self = (lucViewport*) viewport ;
-
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	lucDrawingObject_Register_CleanUpAll( self->drawingObject_Register, context );
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucViewport_SetNeedsToSetupFlag( void* viewport, Bool flag ) {
-	lucViewport*       self = (lucViewport*) viewport ;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	lucDrawingObject_Register_SetNeedsToSetupFlag( self->drawingObject_Register, flag );
-	
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucViewport_Reset( void* viewport ) {
-	lucViewport*       self = (lucViewport*) viewport ;
-
-	if (self == NULL) 
-		return;
-	
-	lucCamera_Reset( self->camera );
-}
-
-void lucViewport_Broadcast( void* viewport, int rootRank, MPI_Comm comm ) {
-	lucViewport*       self      = (lucViewport*) viewport ;
-
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	lucCamera_Broadcast( self->camera, rootRank, comm );
-
-	MPI_Bcast( self, 1, lucViewport_MPI_Datatype, rootRank, comm );
-	
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-
-#define lucViewport_TypesCount 5
-void lucViewport_Create_MPI_Datatype() {
-	MPI_Datatype        typeList[lucViewport_TypesCount]     = { MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_INT };
-	int                 blocklen[lucViewport_TypesCount]     = {1, 1, 1, 1, 1};
-	MPI_Aint            displacement[lucViewport_TypesCount];
-	lucViewport         viewport;
-
-	displacement[0] = GetOffsetOfMember( viewport, nearClipPlane );
-	displacement[1] = GetOffsetOfMember( viewport, farClipPlane );
-	displacement[2] = GetOffsetOfMember( viewport, drawTitle );
-	displacement[3] = GetOffsetOfMember( viewport, drawTime );
-	displacement[4] = GetOffsetOfMember( viewport, compositeEachObject );
-	
-	MPI_Type_struct( lucViewport_TypesCount, blocklen, displacement, typeList, &lucViewport_MPI_Datatype );
-	MPI_Type_commit( & lucViewport_MPI_Datatype );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Viewport.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Viewport.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,366 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Viewport.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "ColourMap.h"
+#include "Window.h"
+#include "DrawingObject_Register.h"
+#include "Light_Register.h"
+#include "Light.h"
+
+
+#include "Viewport.h"
+
+#include "DrawingObject.h"
+#include "Camera.h"
+#include "Init.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+
+
+const Type lucViewport_Type = "lucViewport";
+
+MPI_Datatype lucViewport_MPI_Datatype;
+
+lucViewport* lucViewport_New(
+		Name                                               name,
+		lucCamera*                                         camera,
+		lucDrawingObject**                                 drawingObjectList,
+		DrawingObject_Index                                drawingObjectCount,
+		lucLight**          				   lightList,
+	  	Light_Index                                        lightCount,
+		Bool                                               drawTitle,
+		Bool                                               drawTime,
+		Bool                                               compositeEachObject,
+		double                                             nearClipPlane,
+		double                                             farClipPlane )
+{
+	lucViewport* self = _lucViewport_DefaultNew( name );
+
+	lucViewport_InitAll( self, camera, drawingObjectList, drawingObjectCount, lightList, lightCount, drawTitle, drawTime, compositeEachObject, nearClipPlane, farClipPlane );
+
+	return self;
+}
+
+lucViewport* _lucViewport_New(  LUCVIEWPORT_DEFARGS  )
+{
+	lucViewport*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucViewport) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucViewport*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+
+	return self;
+}
+
+void _lucViewport_Init( 
+		lucViewport*                                       self, 
+		lucCamera*                                         camera, 
+		lucDrawingObject**                                 drawingObjectList, 
+		DrawingObject_Index                                drawingObjectCount,
+		lucLight**          				   lightList,
+	        Light_Index                                        lightCount,
+		Bool                                               drawTitle,
+		Bool                                               drawTime,
+		Bool                                               compositeEachObject,
+		double                                             nearClipPlane,
+		double                                             farClipPlane )
+{
+	DrawingObject_Index object_I;
+	Light_Index light_I;
+	GLfloat lightPosition[4];
+	GLfloat lmodel_ambient[4] = {0.2, 0.2, 0.2, 1.0};
+	GLfloat spotCutOff = 180.0;
+	GLfloat spotDirection[3] = {0.0, 0.0, -1.0};
+	
+	lightPosition[0]= LUC_LIGHT_DEFAULT_POS_X;
+	lightPosition[1]= LUC_LIGHT_DEFAULT_POS_Y;
+	lightPosition[2]= LUC_LIGHT_DEFAULT_POS_Z;
+	lightPosition[3]= LUC_LIGHT_DEFAULT_POS_W;
+	
+	self->camera                   = camera;
+	self->drawTitle                = drawTitle;
+	self->drawTime                 = drawTime;
+	self->nearClipPlane            = nearClipPlane;
+	self->farClipPlane             = farClipPlane;
+	self->compositeEachObject      = compositeEachObject;
+
+	self->drawingObject_Register = lucDrawingObject_Register_New();
+
+	for ( object_I = 0 ; object_I < drawingObjectCount ; object_I++ )
+		lucDrawingObject_Register_Add( self->drawingObject_Register, drawingObjectList[ object_I ] );
+		
+	/* Setup light register stuff*/	
+	self->light_Register = lucLight_Register_New();
+
+	for ( light_I = 0 ; light_I < lightCount ; light_I++ )
+		lucLight_Register_Add( self->light_Register, lightList[ light_I ] );
+
+       	if(lightCount == 0){
+       		self->defaultLight = lucLight_New( "defaultLight", 0, GL_LIGHT_MODEL_TWO_SIDE,  GL_AMBIENT_AND_DIFFUSE, lightPosition, lmodel_ambient, spotCutOff, spotDirection);
+		lucLight_Register_Add( self->light_Register, self->defaultLight );
+	}
+
+
+}
+
+void lucViewport_InitAll( 
+		void*                                              viewport,
+		lucCamera*                                         camera, 
+		lucDrawingObject**                                 drawingObjectList, 
+		DrawingObject_Index                                drawingObjectCount,
+	        lucLight**          			           lightList,
+	 	Light_Index                                        lightCount,
+		Bool                                               drawTitle,
+		Bool                                               drawTime,
+		Bool                                               compositeEachObject,
+		double                                             nearClipPlane,
+		double                                             farClipPlane )
+{
+	lucViewport* self        = viewport;
+
+	_lucViewport_Init( self, camera, drawingObjectList, drawingObjectCount, lightList, lightCount, drawTitle, drawTime, compositeEachObject, nearClipPlane, farClipPlane );
+}
+
+	
+void _lucViewport_Delete( void* viewport ) {
+	lucViewport* self        = viewport;
+	
+	_Stg_Component_Delete( self );
+}
+
+void _lucViewport_Print( void* viewport, Stream* stream ) {
+	lucViewport*          self        = viewport;
+	
+	Journal_Printf( stream, "lucViewport: %s\n", self->name );
+
+	Stream_Indent( stream );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	lucDrawingObject_Register_PrintAllObjects( self->drawingObject_Register, stream );
+
+	Stg_Class_Print( self->camera, stream );
+
+	Journal_PrintValue( stream, self->nearClipPlane );
+	Journal_PrintValue( stream, self->farClipPlane );
+	
+	Journal_PrintBool( stream, self->drawTitle );
+	Journal_PrintBool( stream, self->drawTime );
+	Journal_PrintBool( stream, self->compositeEachObject );
+	
+	Stream_UnIndent( stream );
+}
+
+void* _lucViewport_Copy( void* viewport, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucViewport* self        = viewport;
+	lucViewport* newViewport;
+
+	newViewport = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+	if ( deep ) {
+		newViewport->camera     = (lucCamera*)  Stg_Class_Copy( self->camera,     dest, deep, nameExt, ptrMap );
+	}
+	else {
+		newViewport->camera        = self->camera;
+	}
+
+	newViewport->nearClipPlane       = self->nearClipPlane;
+	newViewport->farClipPlane        = self->farClipPlane;
+	newViewport->drawTitle           = self->drawTitle;
+	newViewport->drawTime            = self->drawTime;
+	newViewport->compositeEachObject = self->compositeEachObject;
+
+	return (void*) newViewport;
+}
+
+void* _lucViewport_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof( lucViewport );
+	Type                                                      type = lucViewport_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucViewport_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucViewport_Print;
+	Stg_Class_CopyFunction*                                  _copy = _lucViewport_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucViewport_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucViewport_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucViewport_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucViewport_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucViewport_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucViewport_Destroy;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucViewport_New(  LUCVIEWPORT_PASSARGS  );
+}
+
+void _lucViewport_AssignFromXML( void* viewport, Stg_ComponentFactory* cf, void* data ) {
+	lucViewport*        self               = (lucViewport*) viewport;
+	DrawingObject_Index drawingObjectCount;
+	lucDrawingObject**  drawingObjectList;
+	lucLight**          lightList;
+	Light_Index         lightCount;
+	lucCamera*          camera;
+
+	/* TODO Construct Parent */
+
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
+
+	camera =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Camera", lucCamera, True, data  ) ;
+
+	drawingObjectList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"DrawingObject", Stg_ComponentFactory_Unlimited, lucDrawingObject, True, &drawingObjectCount, data  );
+	
+	/* Grab a list of lights for this viewport */
+	lightList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"Light", Stg_ComponentFactory_Unlimited, lucLight, False, &lightCount, data  );
+
+	_lucViewport_Init(
+			self,
+			camera,
+			drawingObjectList,
+			drawingObjectCount,
+			lightList,
+			lightCount,
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawTitle", True  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawTime", False  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"compositeEachObject", False  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"nearClipPlane", 0.1  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"farClipPlane", 40.0 ) );
+
+	Memory_Free( drawingObjectList );
+        if(lightList)
+		Memory_Free( lightList  );
+}
+
+void _lucViewport_Build( void* camera, void* data ) { }
+void _lucViewport_Initialise( void* camera, void* data ) { }
+void _lucViewport_Execute( void* camera, void* data ) { }
+void _lucViewport_Destroy( void* camera, void* data ) { }
+
+void lucViewport_Draw( void* viewport, lucWindow* window, lucViewportInfo* viewportInfo, void* context ) {
+	lucViewport*          self = (lucViewport*) viewport ;
+
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	/*Enables the lights */
+	lucLight_Register_EnableAll( self->light_Register );
+
+	lucDrawingObject_Register_DrawAll( self->drawingObject_Register, window, viewportInfo, context, self->compositeEachObject );
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucViewport_CleanUp( void* viewport, void* context ) {
+	lucViewport*          self = (lucViewport*) viewport ;
+
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	lucDrawingObject_Register_CleanUpAll( self->drawingObject_Register, context );
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucViewport_SetNeedsToSetupFlag( void* viewport, Bool flag ) {
+	lucViewport*       self = (lucViewport*) viewport ;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	lucDrawingObject_Register_SetNeedsToSetupFlag( self->drawingObject_Register, flag );
+	
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucViewport_Reset( void* viewport ) {
+	lucViewport*       self = (lucViewport*) viewport ;
+
+	if (self == NULL) 
+		return;
+	
+	lucCamera_Reset( self->camera );
+}
+
+void lucViewport_Broadcast( void* viewport, int rootRank, MPI_Comm comm ) {
+	lucViewport*       self      = (lucViewport*) viewport ;
+
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	lucCamera_Broadcast( self->camera, rootRank, comm );
+
+	MPI_Bcast( self, 1, lucViewport_MPI_Datatype, rootRank, comm );
+	
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+
+#define lucViewport_TypesCount 5
+void lucViewport_Create_MPI_Datatype() {
+	MPI_Datatype        typeList[lucViewport_TypesCount]     = { MPI_DOUBLE, MPI_DOUBLE, MPI_INT, MPI_INT, MPI_INT };
+	int                 blocklen[lucViewport_TypesCount]     = {1, 1, 1, 1, 1};
+	MPI_Aint            displacement[lucViewport_TypesCount];
+	lucViewport         viewport;
+
+	displacement[0] = GetOffsetOfMember( viewport, nearClipPlane );
+	displacement[1] = GetOffsetOfMember( viewport, farClipPlane );
+	displacement[2] = GetOffsetOfMember( viewport, drawTitle );
+	displacement[3] = GetOffsetOfMember( viewport, drawTime );
+	displacement[4] = GetOffsetOfMember( viewport, compositeEachObject );
+	
+	MPI_Type_struct( lucViewport_TypesCount, blocklen, displacement, typeList, &lucViewport_MPI_Datatype );
+	MPI_Type_commit( & lucViewport_MPI_Datatype );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Window.c
--- a/Base/src/Window.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,947 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Window.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "ColourMap.h"
-#include "X11Colours.h"
-#include "Window.h"
-#include "Viewport.h"
-#include "Camera.h"
-#include "OutputFormat.h"
-#include "OutputFormat_Register.h"
-#include "Init.h"
-#include "RenderingEngine.h"
-#include "Light.h"
-#include "Light_Register.h"
-
-#include "WindowInteraction.h"
-#include "WindowInteraction_Register.h"
-
-#include "ViewportInfo.h"
-
-#include <ctype.h>
-#include <assert.h>
-#include <string.h>
-
-/* ASCII Characters */
-#define ESCAPE 27
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-const Type lucWindow_Type = "lucWindow";
-
-MPI_Datatype lucWindow_MPI_Datatype;
-MPI_Datatype lucViewportInfo_MPI_Datatype;
-
-lucWindow* _lucWindow_New(  LUCWINDOW_DEFARGS  )
-{
-	lucWindow*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucWindow) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucWindow*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-
-	/* Virtual functions */
-	self->_displayWindow = _displayWindow;
-	self->_eventsWaiting = _eventsWaiting;
-	self->_eventProcessor = _eventProcessor;
-	self->_resizeWindow = _resizeWindow;
-	
-	return self;
-}
-
-void _lucWindow_Init( 
-		lucWindow*                                         self,
-		lucRenderingEngine*                                renderingEngine,
-		lucViewportInfo*                                   viewportInfoList,
-		Viewport_Index                                     viewportCount,
-		lucOutputFormat**                                  outputFormatList,
-		OutputFormat_Index                                 outputFormatCount,
-		lucWindowInteraction**                             windowInteractionList, 
-		WindowInteraction_Index                            windowInteractionCount,
-		AbstractContext*                                   context,
-		Pixel_Index                                        width,
-		Pixel_Index                                        height,
-		Name                                               backgroundColourName,
-		Bool                                               interactive,
-		Bool                                               continuous,
-		Bool                                               isTimedOut,
-		double                                             maxIdleTime ) 
-{
-	OutputFormat_Index   outputFormat_I;
-	WindowInteraction_Index windowInteraction_I;
-
-	self->renderingEngine = renderingEngine;
-	self->width = width;
-	self->height = height;
-    self->resized = False;
-	self->interactive = interactive;
-	self->continuous = continuous; 
-
-	self->viewportInfoList = Memory_Alloc_Array( lucViewportInfo, viewportCount, "viewport info Array" );
-	memcpy( self->viewportInfoList, viewportInfoList, viewportCount * sizeof( lucViewportInfo ) );
-	self->viewportCount = viewportCount;
-	
-	/* Setup output format stuff */
-	self->outputFormat_Register = lucOutputFormat_Register_New();
-	for ( outputFormat_I = 0 ; outputFormat_I < outputFormatCount ; outputFormat_I++ )
-		lucOutputFormat_Register_Add( self->outputFormat_Register, outputFormatList[ outputFormat_I ] );
-		
-	/* Setup window interaction stuff */
-	self->windowInteraction_Register = lucWindowInteraction_Register_New();
-	self->defaultWindowInteraction = lucWindowInteraction_New( "defaultWindowInteraction" );
-	lucWindowInteraction_Register_Add( self->windowInteraction_Register, self->defaultWindowInteraction );
-	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ )
-		lucWindowInteraction_Register_Add( self->windowInteraction_Register, windowInteractionList[ windowInteraction_I ] );
-	
-
-	lucColour_FromString( &self->backgroundColour, backgroundColourName );
-
-	self->currStereoBuffer = lucLeft;
-
-	/* Get window to 'execute' at each 'Dump' entry point, and force the context not to re-execute itself. */
-	//context->hasExecuted = True;
-	EP_AppendClassHook( Context_GetEntryPoint( context, AbstractContext_EP_DumpClass ), self->_execute, self );
-	
-	self->isTimedOut    = isTimedOut;
-	self->maxIdleTime   = maxIdleTime;
-	self->idleTime = 0;
-	self->startx = 0;
-	self->starty = 0;
-	
-	self->title = Memory_Alloc_Array( char, 500, "title string" );
-	strcpy(self->title, " gLucifer output: ");
-	strcat(self->title, self->name);
-}
-		
-void _lucWindow_Delete( void* window ) {
-	lucWindow*     self      = (lucWindow*)window;
-
-	Stg_Class_Delete( self->outputFormat_Register );
-	Stg_Class_Delete( self->defaultWindowInteraction );
-	Stg_Class_Delete( self->windowInteraction_Register );
-
-	_Stg_Component_Delete( window );
-}
-
-void _lucWindow_Print( void* window, Stream* stream ) {
-	lucWindow*          self        = window;
-	
-	Journal_Printf( stream, "lucWindow: %s\n", self->name );
-
-	Stream_Indent( stream );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-
-	Journal_PrintValue( stream, self->width );
-	Journal_PrintValue( stream, self->height );
-	Journal_PrintValue( stream, self->interactive );
-	Journal_PrintValue( stream, self->continuous );
-	Journal_Printf( stream, "self->currStereoBuffer = ");
-	switch ( self->currStereoBuffer ) {
-		case lucLeft:
-			Journal_Printf( stream, "lucLeft\n" ); break;
-		case lucRight:
-			Journal_Printf( stream, "lucRight\n" ); break;
-	}
-	Stream_UnIndent( stream );
-}
-
-void* _lucWindow_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucWindow* self        = window;
-	lucWindow* newWindow;
-
-	newWindow = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newWindow;
-}
-
-void* _lucWindow_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof( lucWindow );
-	Type                                                      type = lucWindow_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucWindow_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucWindow_Print;
-	Stg_Class_CopyFunction*                                  _copy = _lucWindow_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucWindow_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucWindow_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucWindow_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucWindow_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucWindow_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucWindow_Destroy;
-	lucWindow_DisplayFunction*                      _displayWindow = lucWindow_Display;
-	lucWindow_EventsWaitingFunction*                _eventsWaiting = lucWindow_EventsWaiting;
-	lucWindow_EventProcessorFunction*              _eventProcessor = lucWindow_EventProcessor;
-	lucWindow_ResizeFunction*                        _resizeWindow = lucWindow_Resize;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucWindow_New(  LUCWINDOW_PASSARGS  );
-}
-
-void _lucWindow_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ) {
-	lucWindow*               self        = window;
-	lucViewportInfo*         viewportInfoList;
-	Viewport_Index           viewportCount;
-	lucOutputFormat**        outputFormatList;
-	OutputFormat_Index       outputFormatCount;
-	lucRenderingEngine*      renderingEngine;
-	Pixel_Index              width;
-	Pixel_Index              height;
-	lucWindowInteraction**   windowInteractionList;
-	WindowInteraction_Index  windowInteractionCount;
-	Bool                     interactiveDefault;
-	Bool                     interactive;
-	Bool                     continuousDefault;
-	Bool                     continuous;
-	
-	width = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"width", 400  );
-	height = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"height", 400  );
-
-	/* Get information about whether this window is interactive or not
-	 * All lucWindow objects will check in the root dictionary first to see if interactivity in general is turned on
-	 * Specific lucWindow objects can override this parameter in their own component structs */
-	interactiveDefault = Stg_ComponentFactory_GetRootDictBool( cf, (Dictionary_Entry_Key)"interactive", False  );
-	interactive = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"interactive", interactiveDefault  );
-
-	/* Get information about whether this window is in continuous mode or not */
-	continuousDefault = Stg_ComponentFactory_GetRootDictBool( cf, (Dictionary_Entry_Key)"continuous", False  );
-	continuous = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"continuous", continuousDefault  );
-
-	/* Grab information about what viewports are going to be plotting in this window */
-	viewportInfoList = lucWindow_ConstructViewportInfoList( self, cf, width, height, &viewportCount, data );
-
-	/* Grab a list of different output formats for this window to be dumped in */
-	outputFormatList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"OutputFormat", Stg_ComponentFactory_Unlimited, lucOutputFormat, False, &outputFormatCount, data  );
-			
-	/* Grab a list of interactions for the user to interact with this window */
-	windowInteractionList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"WindowInteraction", Stg_ComponentFactory_Unlimited, lucWindowInteraction, False, &windowInteractionCount, data  );
-		
-	/* The window needs information about the context so that it can attach itself 
-	 * onto the AbstractContext_EP_DumpClass entry point. */
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
-
-
-	renderingEngine = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"RenderingEngine", lucRenderingEngine, True, data  );
-
-	_lucWindow_Init( 
-			self,
-			renderingEngine,
-			viewportInfoList,
-			viewportCount,
-			outputFormatList,
-			outputFormatCount,
-			windowInteractionList,
-			windowInteractionCount,
-			self->context,
-			width,
-			height,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"backgroundColour", "white"  ),
-			interactive,
-			continuous,
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"isTimedOut", True  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxIdleTime", 600.0 ) 
-			);
-		
-	/* Free Memory */
-	Memory_Free(viewportInfoList); 
-	if ( windowInteractionList )
-		Memory_Free(windowInteractionList); 
-	if ( outputFormatList )
-		Memory_Free(outputFormatList ); 
-
-}
-
-void _lucWindow_Build( void* window, void* data ) {
-	/* Save context and master flag */
-	lucWindow*  self = (lucWindow*)window;
-	self->isMaster = (self->context->rank == MASTER);
-}
-
-void _lucWindow_Initialise( void* window, void* data ) {
-	lucWindow* self;
-
-	self = (lucWindow*)window;
-
-	lucDeleteFont(); 
-	lucSetupRasterFont();
-}
-
-void _lucWindow_Execute( void* window, void* data ) { 
-	/* Display graphics and allow GUI interaction if enabled */
-	lucWindow*     self         = (lucWindow*) window ;
-	lucDebug_PrintFunctionBegin( self, 1 );
-
-	/* Flag viewports need to re-render new information */
-	lucWindow_SetViewportNeedsToSetupFlag( self, True );
-	lucWindow_SetViewportNeedsToDrawFlag( self, True );
-
-	/* Draw Window (Call virtual to display) 
-	 initial output for background & interactive modes */
-	self->_displayWindow( self );
-
-	/* Reset idle timer */
-	lucWindow_IdleReset(self);	
-
-	/* Interactive mode? Enter event loop processing */
-	if ( self->interactive ) {
-		Bool redisplay = False;
-		lucWindow_InteractionHelpMessage( self, Journal_MyStream( Info_Type, self ) );
-		
-		/* Clear quit flags */
-		self->quitEventLoop = False;
-		self->toggleApplicationQuit = False;
-		
-		while ( !self->quitEventLoop ) {
-            /* Only master processes events */
-            int events = 0;
-			if (self->isMaster)
-            {  
-                /* Check for events */
-                events = self->_eventsWaiting(self);
-                if (self->continuous && events == 0)
-                {
-                    /* Continuous mode and no events waiting, quit loop */
-                    self->quitEventLoop = True; 
-                    redisplay = True;
-                }
-                else	
-                    /* Call virtual to wait for and process events */
-                    if (self->_eventProcessor(self) || events > 1) redisplay = True;
-            }
-
-        	/* Broadcast information about event loop*/ 
-        	MPI_Bcast( &self->quitEventLoop, 1, MPI_INT, MASTER, self->context->communicator );
-        	MPI_Bcast( &events, 1, MPI_INT, MASTER, self->context->communicator );
-        	MPI_Bcast( &redisplay, 1, MPI_INT, MASTER, self->context->communicator );
-      
-			/* Still events to process? delay redisplay until queue empty */
-			if (events <= 1)
-			{
-				/* Redraw Window (Call virtual to display) */
-				if (redisplay) self->_displayWindow( self );
-				redisplay = False;
-			}
-		}
-
-		/* Close application if requested */
-		if( self->toggleApplicationQuit ) {
-			self->context->gracefulQuit = True;
-		}
-	}
-	
-	/* Dump outputs to disk */
-	if ( self->isMaster ) lucWindow_Dump( self, self->context );
-	
-	/* Stop idle timeout */
-	self->idleTime = 0;
-	
-	lucDebug_PrintFunctionEnd( self, 1 );
-}
-
-void _lucWindow_Destroy( void* window, void* data ) {
-	lucWindow*     self      = (lucWindow*)window;
-
-	lucWindow_CleanUp( window, data );
-	Memory_Free(self->title);
-    lucDeleteFont(); 
-}
-
-void lucWindow_Display( void* window )
-{
-	/* Default display function... to be called from derived class display function */
-	lucWindow*     self      = (lucWindow*)window;
-
-	lucWindow_Broadcast( window, 0, MPI_COMM_WORLD );
-
-    /* Resize viewports if necessary */
-    if (self->resized) self->_resizeWindow(window);
-    
-	lucRenderingEngine_Render( self->renderingEngine, self, self->context );
-}
-
-int lucWindow_EventsWaiting( void* window )
-{
-	/* Dummy events waiting function... */
-	return 0;
-}
-
-Bool lucWindow_EventProcessor( void *window)
-{
-	/* Dummy event processor function... */
-	lucWindow*     self      = (lucWindow*)window;
-	self->quitEventLoop = True;
-	/* Returns true redisplay required */
-	return False;
-}
-
-void lucWindow_Resize( void* window ) {
-    /* Default window resize function */
-	lucWindow*       self      = (lucWindow*) window;
-	Viewport_Index   viewport_I;
-	Viewport_Index   viewportCount = self->viewportCount;
-	Viewport_Index   horizontalCount = viewportCount / self->verticalCount;
-	lucViewportInfo* viewportInfo;
-
-	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
-		viewportInfo = &self->viewportInfoList[ viewport_I ];
-        int vertical_I = viewport_I / horizontalCount;
-        int horizontal_I = viewport_I % horizontalCount;
-		viewportInfo->width  = div( self->width, horizontalCount ).quot;
-		viewportInfo->height = div( self->height, self->verticalCount ).quot;
-		viewportInfo->startx = horizontal_I * viewportInfo->width;
-		viewportInfo->starty = (self->verticalCount - 1 - vertical_I) * viewportInfo->height;
-	}
-
-    self->resized = False;
-     _lucWindow_Initialise(self, self->context);	/* Reset font stuff */
-
-	/* Flag display lists must be created and objects drawn */
-	lucWindow_SetViewportNeedsToSetupFlag( self, True );
-	lucWindow_SetViewportNeedsToDrawFlag( self, True );
-}
-
-void lucWindow_Dump( void* window, AbstractContext* context ) {
-	lucWindow*     self         = (lucWindow*) window ;
-	Pixel_Index    width        = self->width;
-	Pixel_Index    height       = self->height;
-	lucPixel*      imageBuffer  = NULL;
-	Stream*        errorStream  = Journal_MyStream( Error_Type, self );
-
-	lucDebug_PrintFunctionBegin( self, 1 );
-
-	/* Allocate Memory */
-	imageBuffer = Memory_Alloc_Array( lucPixel, width * height, "Pixels" );
-	Journal_Firewall( imageBuffer != NULL, errorStream, "In func %s: Cannot allocate array.", __func__ );
-
-	/* Grab Pixels from window */
-	lucRenderingEngine_GetPixelData( self->renderingEngine, self, imageBuffer );
-
-	/* Output in different formats that the user gives */
-	lucOutputFormat_Register_OutputAll( self->outputFormat_Register, self, context, imageBuffer );
-	
-	/* Free memory */
-	Memory_Free( imageBuffer );
-	lucDebug_PrintFunctionEnd( self, 1 );
-}
-
-void lucWindow_CleanUp( void* window, void* context ) {
-	lucWindow*     self      = (lucWindow*) window;
-	Viewport_Index viewport_I;
-	Viewport_Index viewportCount = self->viewportCount;
-	lucViewport*   viewport;
-
-	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
-		viewport = self->viewportInfoList[ viewport_I ].viewport;
-		
-		lucViewport_CleanUp( viewport, context );
-	}
-}
-
-/* Window event processing - mouse & keyboard */
-void lucWindow_MouseMotion( void* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos) {
-	lucWindow*            self      = (lucWindow*) window;
-	Index                 windowInteraction_I;
-	Index                 windowInteractionCount = lucWindowInteraction_Register_GetCount( self->windowInteraction_Register ); 
-	lucWindowInteraction* windowInteraction;
-
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
-		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
-		lucWindowInteraction_MouseMotion( windowInteraction, window, button, xpos, ypos, self->startx, self->starty );
-	}
-	self->startx = xpos;
-	self->starty = ypos;
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucWindow_MouseClick( void* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) {
-	lucWindow*            self      = (lucWindow*) window;
-	Index                 windowInteraction_I;
-	Index                 windowInteractionCount = lucWindowInteraction_Register_GetCount( self->windowInteraction_Register ); 
-	lucWindowInteraction* windowInteraction;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
-		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
-		lucWindowInteraction_MouseClick( windowInteraction, window, button, state, xpos, ypos );
-	}
-	self->startx = xpos;
-	self->starty = ypos;
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucWindow_KeyboardEvent( void* window, char key, Pixel_Index xpos, Pixel_Index ypos ) {
-	lucWindow*              self      = (lucWindow*) window;
-	WindowInteraction_Index windowInteraction_I;
-	WindowInteraction_Index windowInteractionCount = lucWindowInteraction_Register_GetCount( self->windowInteraction_Register ); 
-	lucWindowInteraction*   windowInteraction;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount; windowInteraction_I++ ) {
-		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
-		lucWindowInteraction_KeyboardEvent( windowInteraction, window, key, xpos, ypos );
-	}
-	self->startx = xpos;
-	self->starty = ypos;
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-Bool lucWindow_HasStereoCamera( lucWindow* self ) {
-	Viewport_Index viewport_I;
-	Viewport_Index viewportCount = self->viewportCount;
-	lucViewport*   viewport;
-
-	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
-		viewport = self->viewportInfoList[ viewport_I ].viewport;
-		
-		if (viewport->camera->stereoType != lucMono )
-			return True;
-	}
-	return False;
-}
-
-void lucWindow_CheckCameraFlag( void* window ) {
-	lucWindow*            self          = (lucWindow*) window;
-	Viewport_Index        viewport_I;
-	Viewport_Index        viewportCount = self->viewportCount;
-	lucViewport*          viewport;
-	lucViewportInfo*      viewportInfo;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
-		viewportInfo = &self->viewportInfoList[ viewport_I ];
-		viewport = viewportInfo->viewport;
-
-		if ( viewport->camera->needsToDraw )
-			viewportInfo->needsToDraw = True;
-
-	}
-
-	/* Now that camera has passed message to viewport - the camera's flag is no longer nessesary */
-	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
-		viewport = self->viewportInfoList[ viewport_I ].viewport;
-
-		viewport->camera->needsToDraw = False;
-	}
-	
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-
-void lucWindow_CheckLightFlag( void* window ) {
-	lucWindow*            self          = (lucWindow*) window;
-	Viewport_Index        viewport_I;
-	Viewport_Index        viewportCount = self->viewportCount;
-	lucViewport*          viewport;
-	lucViewportInfo*      viewportInfo;
-	
-	lucLight*                   light;
-	Light_Index                 light_I = 0;
-	Light_Index                 lightCount = 0;
-
-	lucDebug_PrintFunctionBegin( self, 2 );
-	
-	/* Loop through lights that are registered on the window */
-	
-	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
-	
-		viewportInfo = &self->viewportInfoList[ viewport_I ];
-		viewport = viewportInfo->viewport;
-
-		/* Finds the number of lights, and if one has been modified, then redraw */
-		lightCount   = lucLight_Register_GetCount( viewport->light_Register );
-		for ( light_I = 0 ; light_I < lightCount ; light_I++ ) {
-			light = lucLight_Register_GetByIndex( viewport->light_Register, light_I );
-
-			if ( light->needsToDraw )
-				viewportInfo->needsToDraw = True;
-
-		}
-	}
-
-	/* Now that lights has passed message to viewport - the lights' flag is no longer nessesary */
-	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
-		viewport = self->viewportInfoList[ viewport_I ].viewport;
-
-		lightCount   = lucLight_Register_GetCount( viewport->light_Register );
-		for ( light_I = 0 ; light_I < lightCount ; light_I++ ) {
-			light = lucLight_Register_GetByIndex( viewport->light_Register, light_I );						 light->needsToDraw = False;
-		}
-	}
-	
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucWindow_SetViewportNeedsToSetupFlag( void* window, Bool flag ) {
-	lucWindow*              self         = (lucWindow*) window ;
-	Viewport_Index          viewport_I;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-	
-	for ( viewport_I = 0 ; viewport_I < self->viewportCount ; viewport_I++ ) {
-		lucViewport_SetNeedsToSetupFlag( self->viewportInfoList[ viewport_I ].viewport, flag );
-	}
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucWindow_SetViewportNeedsToDrawFlag( void* window, Bool flag ) {
-	lucWindow*              self         = (lucWindow*) window ;
-	Viewport_Index          viewport_I;
-
-	lucDebug_PrintFunctionBegin( self, 2 );
-	for ( viewport_I = 0 ; viewport_I < self->viewportCount ; viewport_I++ ) {
-		self->viewportInfoList[ viewport_I ].needsToDraw = flag;
-	}
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-lucViewportInfo* lucWindow_GetViewportInfoByPixel( void* window, Pixel_Index xPixel, Pixel_Index yPixel ) {
-	lucWindow*              self         = (lucWindow*) window ;
-	Viewport_Index          viewport_I;
-	
-	for ( viewport_I = 0 ; viewport_I < self->viewportCount ; viewport_I++ ) {
-		if ( lucViewportInfo_IsPixelInside( &self->viewportInfoList[ viewport_I ], xPixel, yPixel ) )
-			return &self->viewportInfoList[ viewport_I ];
-	}
-
-	return NULL;	
-}
-
-lucViewport* lucWindow_GetViewportByPixel( void* window, Pixel_Index xPixel, Pixel_Index yPixel ) {
-	lucWindow*              self         = (lucWindow*) window ;
-	lucViewportInfo*        viewportInfo;
-
-	viewportInfo = lucWindow_GetViewportInfoByPixel( self, xPixel, yPixel );
-	
-	if ( viewportInfo )
-		return viewportInfo->viewport;
-	else 
-		return NULL;
-}
-
-
-void lucWindow_Broadcast( void* window, int rootRank, MPI_Comm comm ) {
-	lucWindow*         self      = (lucWindow*) window;
-	Viewport_Index     viewport_I;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	MPI_Bcast( self, 1, lucWindow_MPI_Datatype, rootRank, comm );
-
-	/* Broadcast Viewport Infos */
-	for ( viewport_I = 0 ; viewport_I < self->viewportCount ; viewport_I++ ) {
-		lucViewportInfo_Broadcast( &self->viewportInfoList[ viewport_I ], rootRank, comm );
-	}
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void lucViewportInfo_Broadcast( lucViewportInfo* self, int rootRank, MPI_Comm comm ) {
-	Journal_DPrintfL( lucDebug, 2, "In %s.\n", __func__ );
-
-	lucViewport_Broadcast( self->viewport, rootRank, comm );
-
-	MPI_Bcast( self, 1, lucViewportInfo_MPI_Datatype, rootRank, comm );
-}
-
-Bool lucViewportInfo_IsPixelInside( lucViewportInfo* viewportInfo, Pixel_Index xPixel, Pixel_Index yPixel ) {
-	if ( xPixel < viewportInfo->startx ) 
-		return False;
-	if ( yPixel < viewportInfo->starty ) 
-		return False;
-	
-	if ( xPixel >= viewportInfo->startx + viewportInfo->width ) 
-		return False;
-	if ( yPixel >= viewportInfo->starty + viewportInfo->height ) 
-		return False;
-
-	return True;
-}	
-
-lucViewportInfo* lucWindow_ConstructViewportInfoList( 
-		lucWindow* self, 
-		Stg_ComponentFactory* cf, 
-		Pixel_Index width, 
-		Pixel_Index height, 
-		Viewport_Index* viewportCount,
-		void* data ) 
-{
-	Viewport_Index          vertical_I;
-	Viewport_Index          horizontal_I;
-	Viewport_Index          horizontalCount;
-	Viewport_Index          total_I                 = 0;
-	Pixel_Index             viewportHeight;
-	Pixel_Index             viewportWidth;
-	Dictionary_Entry_Value* list;
-	char*                   charPtr;
-	char*                   horizontalVP_String;
-	const char*             breakChars              = "\n\t ,;";
-	lucViewportInfo*        viewportInfoList        = Memory_Alloc_Array( lucViewportInfo, 1, "viewportInfoArray" );
-	lucViewportInfo*        currViewportInfo;
-	Dictionary*             dictionary              = Dictionary_GetDictionary( cf->componentDict, self->name );
-	Name                    viewportName[16];
-   char*                   savePtr;
-
-	*viewportCount = 0;
-	
-	list = Dictionary_Get( dictionary, (Dictionary_Entry_Key)"Viewport"  );
-	Journal_Firewall( list != NULL, lucError, "Cannot Find 'Viewport' for %s '%s'.\n", self->type, self->name );
-		
-	self->verticalCount = Dictionary_Entry_Value_GetCount( list );
-
-	/* Calculate viewport height */
-	viewportHeight = div( height, self->verticalCount ).quot;
-
-	for ( vertical_I = 0 ; vertical_I < self->verticalCount ; vertical_I++ ) {
-		horizontalVP_String = StG_Strdup( Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( list, vertical_I ) ) );
-	
-		/* Find number of horizontal layers */
-		horizontalCount = 0;
-		char* horizVPstr_ptr = horizontalVP_String;
-		charPtr = strtok_r( horizVPstr_ptr , breakChars, &savePtr);
-		while ( charPtr != NULL ) {
-			viewportName[horizontalCount] = StG_Strdup( charPtr );
-			horizontalCount++;
-			charPtr = strtok_r( NULL , breakChars, &savePtr);
-         if (horizontalCount == 16) {
-            /* Maximum 8 viewports across in single window */
-            if (charPtr != NULL)
-   			   Journal_Printf( lucError, "Error in func '%s' - too many viewports in window %s, maximum = 16 wide.\n", __func__, self->name);
-            break; 
-         }
-		}
-		
-		/* Sum up total number of viewports */
-		*viewportCount += horizontalCount;
-
-		/* Reallocate */
-		viewportInfoList = Memory_Realloc_Array( viewportInfoList, lucViewportInfo, *viewportCount );
-		
-		/* Calculate viewport width */
-		viewportWidth = div( width, horizontalCount ).quot;
-
-		/* Read String to get colour map */
-		for ( horizontal_I = 0 ; horizontal_I < horizontalCount ; horizontal_I++ ) {
-			currViewportInfo = &viewportInfoList[ total_I ];
-
-			/* Find viewport */
-			currViewportInfo->viewport = Stg_ComponentFactory_ConstructByName( cf, viewportName[horizontal_I], lucViewport, True, data ) ;
-			Memory_Free( viewportName[horizontal_I] );
-
-			/* Setup viewport dimensions */
-			currViewportInfo->startx = horizontal_I * viewportWidth;
-			currViewportInfo->starty = (self->verticalCount - 1 - vertical_I ) * viewportHeight;
-			currViewportInfo->width  = viewportWidth;
-			currViewportInfo->height = viewportHeight;
-
-			total_I++;
-		}
-
-		Memory_Free( horizontalVP_String );
-	}	
-
-	Journal_Firewall( total_I == *viewportCount, lucError, 
-			"Something went wrong in %s for %s '%s' - Incorrectly counted number of viewports.\n", 
-			__func__, self->type, self->name );
-
-	return viewportInfoList;
-}
-
-void lucWindow_InteractionHelpMessage( void* window, Stream* stream ) {
-	lucWindow*              self      = (lucWindow*) window;
-	WindowInteraction_Index windowInteraction_I;
-	WindowInteraction_Index windowInteractionCount = lucWindowInteraction_Register_GetCount( self->windowInteraction_Register ); 
-	lucWindowInteraction*   windowInteraction;
-
-	Journal_Printf( stream, "--------------------------------------------------------------------\n" );
-	Journal_Printf( stream, "Help for %s '%s':\n", self->type, self->name );
-
-	Journal_Printf( stream, "Window Interactions registered on this window are:\n" );
-	Stream_Indent( stream );
-	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
-		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
-		Journal_Printf( stream, "'%s' (type %s)\n", windowInteraction->name, windowInteraction->type );
-	}
-	Stream_UnIndent( stream );
-	
-	Journal_Printf( stream, "Mouse Interaction:\n" );
-	Stream_Indent( stream );
-	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
-		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
-		lucWindowInteraction_MouseMessage( windowInteraction, stream );
-	}
-	Stream_UnIndent( stream );	
-
-	Journal_Printf( stream, "Keyboard Interaction:\n" );
-	Stream_Indent( stream );
-	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
-		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
-		lucWindowInteraction_KeyboardMessage( windowInteraction, stream );
-	}
-	Stream_UnIndent( stream );	
-	Journal_Printf( stream, "--------------------------------------------------------------------\n" );
-}
-	
-
-#define lucWindow_TypesCount 7
-void lucWindow_Create_MPI_Datatype() {
-	MPI_Datatype        typeList[lucWindow_TypesCount]     = { MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_FLOAT, MPI_INT };
-	int                 blocklen[lucWindow_TypesCount]     = {1, 1, 1, 1, 1, 4, 1};
-	MPI_Aint            displacement[lucWindow_TypesCount];
-	lucWindow           window;
-
-	displacement[0] = GetOffsetOfMember( window, width );
-	displacement[1] = GetOffsetOfMember( window, height );
-	displacement[2] = GetOffsetOfMember( window, interactive );
-	displacement[3] = GetOffsetOfMember( window, quitEventLoop );
-	displacement[4] = GetOffsetOfMember( window, resized );
-	displacement[5] = GetOffsetOfMember( window, backgroundColour );
-	displacement[6] = GetOffsetOfMember( window, currStereoBuffer );
-	
-	MPI_Type_struct( lucWindow_TypesCount, blocklen, displacement, typeList, &lucWindow_MPI_Datatype );
-	MPI_Type_commit( & lucWindow_MPI_Datatype );
-}
-
-
-#define lucViewportInfo_TypesCount 5
-void lucViewportInfo_Create_MPI_Datatype() {
-	MPI_Datatype        typeList[lucViewportInfo_TypesCount]     = { MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT };
-	int                 blocklen[lucViewportInfo_TypesCount]     = {1, 1, 1, 1, 1};
-	MPI_Aint            displacement[lucViewportInfo_TypesCount];
-	lucViewportInfo     viewportInfo;
-
-	displacement[0] = GetOffsetOfMember( viewportInfo, startx );
-	displacement[1] = GetOffsetOfMember( viewportInfo, starty );
-	displacement[2] = GetOffsetOfMember( viewportInfo, width );
-	displacement[3] = GetOffsetOfMember( viewportInfo, height );
-	displacement[4] = GetOffsetOfMember( viewportInfo, needsToDraw );
-	
-	MPI_Type_struct( lucViewportInfo_TypesCount, blocklen, displacement, typeList, &lucViewportInfo_MPI_Datatype );
-	MPI_Type_commit( & lucViewportInfo_MPI_Datatype );
-}
-
-void lucWindow_ChangeInteractiveMode( void* window ) {
-	lucWindow*              self         = (lucWindow*) window ;
-	self->interactive = !self->interactive;
-}
-
-
-void lucWindow_ChangeContinuousMode( void* window ) {
-	lucWindow*              self         = (lucWindow*) window ;
-	self->continuous = !self->continuous;
-}
-
-void lucWindow_QuitEventLoop( void* window ) {
-	lucWindow*              self         = (lucWindow*) window ;
-
-	self->quitEventLoop = True;
-}
-
-void lucWindow_ToggleApplicationQuit( void* window ) {
-	lucWindow*              self         = (lucWindow*) window ;
-
-	lucWindow_QuitEventLoop( self );
-	self->toggleApplicationQuit = True;
-}
-
-Bool lucWindow_SetSize( void* window, Pixel_Index newWidth, Pixel_Index newHeight ) {
-	lucWindow*       self      = (lucWindow*) window;
-
-	if (newWidth < 32 || newHeight < 32) return False;
-    if (newWidth == self->width && newHeight == self->height) return False; /* No resize neccessary */
-
-	self->width = newWidth;
-	self->height = newHeight;
-
-    self->resized = True;
-  	Journal_DPrintfL( lucDebug, 2, "Window resized %d x %d\n", self->width, self->height);
-
-    return True;
-}
-
-void lucWindow_IdleReset(void *window) {
-	/* Update Idle timer */
-	lucWindow* self = (lucWindow*)window;
-	self->idleTime = MPI_Wtime();
-}
-
-void lucWindow_IdleCheck(void *window) {
-	lucWindow* self = (lucWindow*)window;
-	if (self->isTimedOut && self->idleTime > 0){
-		if ( MPI_Wtime() > self->idleTime + self->maxIdleTime ) {
-			Journal_Printf( lucError, "Error in func '%s' - Interactive window '%s' open for too long (over %g seconds) without interaction.\n",
-							__func__, self->name, self->maxIdleTime );
-			abort();
-		}
-	}
-}
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/Window.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/Window.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,947 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Window.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "ColourMap.h"
+#include "X11Colours.h"
+#include "Window.h"
+#include "Viewport.h"
+#include "Camera.h"
+#include "OutputFormat.h"
+#include "OutputFormat_Register.h"
+#include "Init.h"
+#include "RenderingEngine.h"
+#include "Light.h"
+#include "Light_Register.h"
+
+#include "WindowInteraction.h"
+#include "WindowInteraction_Register.h"
+
+#include "ViewportInfo.h"
+
+#include <ctype.h>
+#include <assert.h>
+#include <string.h>
+
+/* ASCII Characters */
+#define ESCAPE 27
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+const Type lucWindow_Type = "lucWindow";
+
+MPI_Datatype lucWindow_MPI_Datatype;
+MPI_Datatype lucViewportInfo_MPI_Datatype;
+
+lucWindow* _lucWindow_New(  LUCWINDOW_DEFARGS  )
+{
+	lucWindow*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucWindow) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucWindow*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+
+	/* Virtual functions */
+	self->_displayWindow = _displayWindow;
+	self->_eventsWaiting = _eventsWaiting;
+	self->_eventProcessor = _eventProcessor;
+	self->_resizeWindow = _resizeWindow;
+	
+	return self;
+}
+
+void _lucWindow_Init( 
+		lucWindow*                                         self,
+		lucRenderingEngine*                                renderingEngine,
+		lucViewportInfo*                                   viewportInfoList,
+		Viewport_Index                                     viewportCount,
+		lucOutputFormat**                                  outputFormatList,
+		OutputFormat_Index                                 outputFormatCount,
+		lucWindowInteraction**                             windowInteractionList, 
+		WindowInteraction_Index                            windowInteractionCount,
+		AbstractContext*                                   context,
+		Pixel_Index                                        width,
+		Pixel_Index                                        height,
+		Name                                               backgroundColourName,
+		Bool                                               interactive,
+		Bool                                               continuous,
+		Bool                                               isTimedOut,
+		double                                             maxIdleTime ) 
+{
+	OutputFormat_Index   outputFormat_I;
+	WindowInteraction_Index windowInteraction_I;
+
+	self->renderingEngine = renderingEngine;
+	self->width = width;
+	self->height = height;
+    self->resized = False;
+	self->interactive = interactive;
+	self->continuous = continuous; 
+
+	self->viewportInfoList = Memory_Alloc_Array( lucViewportInfo, viewportCount, "viewport info Array" );
+	memcpy( self->viewportInfoList, viewportInfoList, viewportCount * sizeof( lucViewportInfo ) );
+	self->viewportCount = viewportCount;
+	
+	/* Setup output format stuff */
+	self->outputFormat_Register = lucOutputFormat_Register_New();
+	for ( outputFormat_I = 0 ; outputFormat_I < outputFormatCount ; outputFormat_I++ )
+		lucOutputFormat_Register_Add( self->outputFormat_Register, outputFormatList[ outputFormat_I ] );
+		
+	/* Setup window interaction stuff */
+	self->windowInteraction_Register = lucWindowInteraction_Register_New();
+	self->defaultWindowInteraction = lucWindowInteraction_New( "defaultWindowInteraction" );
+	lucWindowInteraction_Register_Add( self->windowInteraction_Register, self->defaultWindowInteraction );
+	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ )
+		lucWindowInteraction_Register_Add( self->windowInteraction_Register, windowInteractionList[ windowInteraction_I ] );
+	
+
+	lucColour_FromString( &self->backgroundColour, backgroundColourName );
+
+	self->currStereoBuffer = lucLeft;
+
+	/* Get window to 'execute' at each 'Dump' entry point, and force the context not to re-execute itself. */
+	//context->hasExecuted = True;
+	EP_AppendClassHook( Context_GetEntryPoint( context, AbstractContext_EP_DumpClass ), self->_execute, self );
+	
+	self->isTimedOut    = isTimedOut;
+	self->maxIdleTime   = maxIdleTime;
+	self->idleTime = 0;
+	self->startx = 0;
+	self->starty = 0;
+	
+	self->title = Memory_Alloc_Array( char, 500, "title string" );
+	strcpy(self->title, " gLucifer output: ");
+	strcat(self->title, self->name);
+}
+		
+void _lucWindow_Delete( void* window ) {
+	lucWindow*     self      = (lucWindow*)window;
+
+	Stg_Class_Delete( self->outputFormat_Register );
+	Stg_Class_Delete( self->defaultWindowInteraction );
+	Stg_Class_Delete( self->windowInteraction_Register );
+
+	_Stg_Component_Delete( window );
+}
+
+void _lucWindow_Print( void* window, Stream* stream ) {
+	lucWindow*          self        = window;
+	
+	Journal_Printf( stream, "lucWindow: %s\n", self->name );
+
+	Stream_Indent( stream );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+
+	Journal_PrintValue( stream, self->width );
+	Journal_PrintValue( stream, self->height );
+	Journal_PrintValue( stream, self->interactive );
+	Journal_PrintValue( stream, self->continuous );
+	Journal_Printf( stream, "self->currStereoBuffer = ");
+	switch ( self->currStereoBuffer ) {
+		case lucLeft:
+			Journal_Printf( stream, "lucLeft\n" ); break;
+		case lucRight:
+			Journal_Printf( stream, "lucRight\n" ); break;
+	}
+	Stream_UnIndent( stream );
+}
+
+void* _lucWindow_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucWindow* self        = window;
+	lucWindow* newWindow;
+
+	newWindow = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newWindow;
+}
+
+void* _lucWindow_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof( lucWindow );
+	Type                                                      type = lucWindow_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucWindow_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucWindow_Print;
+	Stg_Class_CopyFunction*                                  _copy = _lucWindow_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucWindow_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucWindow_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucWindow_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucWindow_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucWindow_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucWindow_Destroy;
+	lucWindow_DisplayFunction*                      _displayWindow = lucWindow_Display;
+	lucWindow_EventsWaitingFunction*                _eventsWaiting = lucWindow_EventsWaiting;
+	lucWindow_EventProcessorFunction*              _eventProcessor = lucWindow_EventProcessor;
+	lucWindow_ResizeFunction*                        _resizeWindow = lucWindow_Resize;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucWindow_New(  LUCWINDOW_PASSARGS  );
+}
+
+void _lucWindow_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ) {
+	lucWindow*               self        = window;
+	lucViewportInfo*         viewportInfoList;
+	Viewport_Index           viewportCount;
+	lucOutputFormat**        outputFormatList;
+	OutputFormat_Index       outputFormatCount;
+	lucRenderingEngine*      renderingEngine;
+	Pixel_Index              width;
+	Pixel_Index              height;
+	lucWindowInteraction**   windowInteractionList;
+	WindowInteraction_Index  windowInteractionCount;
+	Bool                     interactiveDefault;
+	Bool                     interactive;
+	Bool                     continuousDefault;
+	Bool                     continuous;
+	
+	width = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"width", 400  );
+	height = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"height", 400  );
+
+	/* Get information about whether this window is interactive or not
+	 * All lucWindow objects will check in the root dictionary first to see if interactivity in general is turned on
+	 * Specific lucWindow objects can override this parameter in their own component structs */
+	interactiveDefault = Stg_ComponentFactory_GetRootDictBool( cf, (Dictionary_Entry_Key)"interactive", False  );
+	interactive = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"interactive", interactiveDefault  );
+
+	/* Get information about whether this window is in continuous mode or not */
+	continuousDefault = Stg_ComponentFactory_GetRootDictBool( cf, (Dictionary_Entry_Key)"continuous", False  );
+	continuous = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"continuous", continuousDefault  );
+
+	/* Grab information about what viewports are going to be plotting in this window */
+	viewportInfoList = lucWindow_ConstructViewportInfoList( self, cf, width, height, &viewportCount, data );
+
+	/* Grab a list of different output formats for this window to be dumped in */
+	outputFormatList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"OutputFormat", Stg_ComponentFactory_Unlimited, lucOutputFormat, False, &outputFormatCount, data  );
+			
+	/* Grab a list of interactions for the user to interact with this window */
+	windowInteractionList = Stg_ComponentFactory_ConstructByList( cf, self->name, (Dictionary_Entry_Key)"WindowInteraction", Stg_ComponentFactory_Unlimited, lucWindowInteraction, False, &windowInteractionCount, data  );
+		
+	/* The window needs information about the context so that it can attach itself 
+	 * onto the AbstractContext_EP_DumpClass entry point. */
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  );
+
+
+	renderingEngine = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"RenderingEngine", lucRenderingEngine, True, data  );
+
+	_lucWindow_Init( 
+			self,
+			renderingEngine,
+			viewportInfoList,
+			viewportCount,
+			outputFormatList,
+			outputFormatCount,
+			windowInteractionList,
+			windowInteractionCount,
+			self->context,
+			width,
+			height,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"backgroundColour", "white"  ),
+			interactive,
+			continuous,
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"isTimedOut", True  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxIdleTime", 600.0 ) 
+			);
+		
+	/* Free Memory */
+	Memory_Free(viewportInfoList); 
+	if ( windowInteractionList )
+		Memory_Free(windowInteractionList); 
+	if ( outputFormatList )
+		Memory_Free(outputFormatList ); 
+
+}
+
+void _lucWindow_Build( void* window, void* data ) {
+	/* Save context and master flag */
+	lucWindow*  self = (lucWindow*)window;
+	self->isMaster = (self->context->rank == MASTER);
+}
+
+void _lucWindow_Initialise( void* window, void* data ) {
+	lucWindow* self;
+
+	self = (lucWindow*)window;
+
+	lucDeleteFont(); 
+	lucSetupRasterFont();
+}
+
+void _lucWindow_Execute( void* window, void* data ) { 
+	/* Display graphics and allow GUI interaction if enabled */
+	lucWindow*     self         = (lucWindow*) window ;
+	lucDebug_PrintFunctionBegin( self, 1 );
+
+	/* Flag viewports need to re-render new information */
+	lucWindow_SetViewportNeedsToSetupFlag( self, True );
+	lucWindow_SetViewportNeedsToDrawFlag( self, True );
+
+	/* Draw Window (Call virtual to display) 
+	 initial output for background & interactive modes */
+	self->_displayWindow( self );
+
+	/* Reset idle timer */
+	lucWindow_IdleReset(self);	
+
+	/* Interactive mode? Enter event loop processing */
+	if ( self->interactive ) {
+		Bool redisplay = False;
+		lucWindow_InteractionHelpMessage( self, Journal_MyStream( Info_Type, self ) );
+		
+		/* Clear quit flags */
+		self->quitEventLoop = False;
+		self->toggleApplicationQuit = False;
+		
+		while ( !self->quitEventLoop ) {
+            /* Only master processes events */
+            int events = 0;
+			if (self->isMaster)
+            {  
+                /* Check for events */
+                events = self->_eventsWaiting(self);
+                if (self->continuous && events == 0)
+                {
+                    /* Continuous mode and no events waiting, quit loop */
+                    self->quitEventLoop = True; 
+                    redisplay = True;
+                }
+                else	
+                    /* Call virtual to wait for and process events */
+                    if (self->_eventProcessor(self) || events > 1) redisplay = True;
+            }
+
+        	/* Broadcast information about event loop*/ 
+        	MPI_Bcast( &self->quitEventLoop, 1, MPI_INT, MASTER, self->context->communicator );
+        	MPI_Bcast( &events, 1, MPI_INT, MASTER, self->context->communicator );
+        	MPI_Bcast( &redisplay, 1, MPI_INT, MASTER, self->context->communicator );
+      
+			/* Still events to process? delay redisplay until queue empty */
+			if (events <= 1)
+			{
+				/* Redraw Window (Call virtual to display) */
+				if (redisplay) self->_displayWindow( self );
+				redisplay = False;
+			}
+		}
+
+		/* Close application if requested */
+		if( self->toggleApplicationQuit ) {
+			self->context->gracefulQuit = True;
+		}
+	}
+	
+	/* Dump outputs to disk */
+	if ( self->isMaster ) lucWindow_Dump( self, self->context );
+	
+	/* Stop idle timeout */
+	self->idleTime = 0;
+	
+	lucDebug_PrintFunctionEnd( self, 1 );
+}
+
+void _lucWindow_Destroy( void* window, void* data ) {
+	lucWindow*     self      = (lucWindow*)window;
+
+	lucWindow_CleanUp( window, data );
+	Memory_Free(self->title);
+    lucDeleteFont(); 
+}
+
+void lucWindow_Display( void* window )
+{
+	/* Default display function... to be called from derived class display function */
+	lucWindow*     self      = (lucWindow*)window;
+
+	lucWindow_Broadcast( window, 0, MPI_COMM_WORLD );
+
+    /* Resize viewports if necessary */
+    if (self->resized) self->_resizeWindow(window);
+    
+	lucRenderingEngine_Render( self->renderingEngine, self, self->context );
+}
+
+int lucWindow_EventsWaiting( void* window )
+{
+	/* Dummy events waiting function... */
+	return 0;
+}
+
+Bool lucWindow_EventProcessor( void *window)
+{
+	/* Dummy event processor function... */
+	lucWindow*     self      = (lucWindow*)window;
+	self->quitEventLoop = True;
+	/* Returns true redisplay required */
+	return False;
+}
+
+void lucWindow_Resize( void* window ) {
+    /* Default window resize function */
+	lucWindow*       self      = (lucWindow*) window;
+	Viewport_Index   viewport_I;
+	Viewport_Index   viewportCount = self->viewportCount;
+	Viewport_Index   horizontalCount = viewportCount / self->verticalCount;
+	lucViewportInfo* viewportInfo;
+
+	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+		viewportInfo = &self->viewportInfoList[ viewport_I ];
+        int vertical_I = viewport_I / horizontalCount;
+        int horizontal_I = viewport_I % horizontalCount;
+		viewportInfo->width  = div( self->width, horizontalCount ).quot;
+		viewportInfo->height = div( self->height, self->verticalCount ).quot;
+		viewportInfo->startx = horizontal_I * viewportInfo->width;
+		viewportInfo->starty = (self->verticalCount - 1 - vertical_I) * viewportInfo->height;
+	}
+
+    self->resized = False;
+     _lucWindow_Initialise(self, self->context);	/* Reset font stuff */
+
+	/* Flag display lists must be created and objects drawn */
+	lucWindow_SetViewportNeedsToSetupFlag( self, True );
+	lucWindow_SetViewportNeedsToDrawFlag( self, True );
+}
+
+void lucWindow_Dump( void* window, AbstractContext* context ) {
+	lucWindow*     self         = (lucWindow*) window ;
+	Pixel_Index    width        = self->width;
+	Pixel_Index    height       = self->height;
+	lucPixel*      imageBuffer  = NULL;
+	Stream*        errorStream  = Journal_MyStream( Error_Type, self );
+
+	lucDebug_PrintFunctionBegin( self, 1 );
+
+	/* Allocate Memory */
+	imageBuffer = Memory_Alloc_Array( lucPixel, width * height, "Pixels" );
+	Journal_Firewall( imageBuffer != NULL, errorStream, "In func %s: Cannot allocate array.", __func__ );
+
+	/* Grab Pixels from window */
+	lucRenderingEngine_GetPixelData( self->renderingEngine, self, imageBuffer );
+
+	/* Output in different formats that the user gives */
+	lucOutputFormat_Register_OutputAll( self->outputFormat_Register, self, context, imageBuffer );
+	
+	/* Free memory */
+	Memory_Free( imageBuffer );
+	lucDebug_PrintFunctionEnd( self, 1 );
+}
+
+void lucWindow_CleanUp( void* window, void* context ) {
+	lucWindow*     self      = (lucWindow*) window;
+	Viewport_Index viewport_I;
+	Viewport_Index viewportCount = self->viewportCount;
+	lucViewport*   viewport;
+
+	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+		viewport = self->viewportInfoList[ viewport_I ].viewport;
+		
+		lucViewport_CleanUp( viewport, context );
+	}
+}
+
+/* Window event processing - mouse & keyboard */
+void lucWindow_MouseMotion( void* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos) {
+	lucWindow*            self      = (lucWindow*) window;
+	Index                 windowInteraction_I;
+	Index                 windowInteractionCount = lucWindowInteraction_Register_GetCount( self->windowInteraction_Register ); 
+	lucWindowInteraction* windowInteraction;
+
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
+		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
+		lucWindowInteraction_MouseMotion( windowInteraction, window, button, xpos, ypos, self->startx, self->starty );
+	}
+	self->startx = xpos;
+	self->starty = ypos;
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucWindow_MouseClick( void* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) {
+	lucWindow*            self      = (lucWindow*) window;
+	Index                 windowInteraction_I;
+	Index                 windowInteractionCount = lucWindowInteraction_Register_GetCount( self->windowInteraction_Register ); 
+	lucWindowInteraction* windowInteraction;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
+		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
+		lucWindowInteraction_MouseClick( windowInteraction, window, button, state, xpos, ypos );
+	}
+	self->startx = xpos;
+	self->starty = ypos;
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucWindow_KeyboardEvent( void* window, char key, Pixel_Index xpos, Pixel_Index ypos ) {
+	lucWindow*              self      = (lucWindow*) window;
+	WindowInteraction_Index windowInteraction_I;
+	WindowInteraction_Index windowInteractionCount = lucWindowInteraction_Register_GetCount( self->windowInteraction_Register ); 
+	lucWindowInteraction*   windowInteraction;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount; windowInteraction_I++ ) {
+		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
+		lucWindowInteraction_KeyboardEvent( windowInteraction, window, key, xpos, ypos );
+	}
+	self->startx = xpos;
+	self->starty = ypos;
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+Bool lucWindow_HasStereoCamera( lucWindow* self ) {
+	Viewport_Index viewport_I;
+	Viewport_Index viewportCount = self->viewportCount;
+	lucViewport*   viewport;
+
+	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+		viewport = self->viewportInfoList[ viewport_I ].viewport;
+		
+		if (viewport->camera->stereoType != lucMono )
+			return True;
+	}
+	return False;
+}
+
+void lucWindow_CheckCameraFlag( void* window ) {
+	lucWindow*            self          = (lucWindow*) window;
+	Viewport_Index        viewport_I;
+	Viewport_Index        viewportCount = self->viewportCount;
+	lucViewport*          viewport;
+	lucViewportInfo*      viewportInfo;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+		viewportInfo = &self->viewportInfoList[ viewport_I ];
+		viewport = viewportInfo->viewport;
+
+		if ( viewport->camera->needsToDraw )
+			viewportInfo->needsToDraw = True;
+
+	}
+
+	/* Now that camera has passed message to viewport - the camera's flag is no longer nessesary */
+	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+		viewport = self->viewportInfoList[ viewport_I ].viewport;
+
+		viewport->camera->needsToDraw = False;
+	}
+	
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+
+void lucWindow_CheckLightFlag( void* window ) {
+	lucWindow*            self          = (lucWindow*) window;
+	Viewport_Index        viewport_I;
+	Viewport_Index        viewportCount = self->viewportCount;
+	lucViewport*          viewport;
+	lucViewportInfo*      viewportInfo;
+	
+	lucLight*                   light;
+	Light_Index                 light_I = 0;
+	Light_Index                 lightCount = 0;
+
+	lucDebug_PrintFunctionBegin( self, 2 );
+	
+	/* Loop through lights that are registered on the window */
+	
+	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+	
+		viewportInfo = &self->viewportInfoList[ viewport_I ];
+		viewport = viewportInfo->viewport;
+
+		/* Finds the number of lights, and if one has been modified, then redraw */
+		lightCount   = lucLight_Register_GetCount( viewport->light_Register );
+		for ( light_I = 0 ; light_I < lightCount ; light_I++ ) {
+			light = lucLight_Register_GetByIndex( viewport->light_Register, light_I );
+
+			if ( light->needsToDraw )
+				viewportInfo->needsToDraw = True;
+
+		}
+	}
+
+	/* Now that lights has passed message to viewport - the lights' flag is no longer nessesary */
+	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+		viewport = self->viewportInfoList[ viewport_I ].viewport;
+
+		lightCount   = lucLight_Register_GetCount( viewport->light_Register );
+		for ( light_I = 0 ; light_I < lightCount ; light_I++ ) {
+			light = lucLight_Register_GetByIndex( viewport->light_Register, light_I );						 light->needsToDraw = False;
+		}
+	}
+	
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucWindow_SetViewportNeedsToSetupFlag( void* window, Bool flag ) {
+	lucWindow*              self         = (lucWindow*) window ;
+	Viewport_Index          viewport_I;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+	
+	for ( viewport_I = 0 ; viewport_I < self->viewportCount ; viewport_I++ ) {
+		lucViewport_SetNeedsToSetupFlag( self->viewportInfoList[ viewport_I ].viewport, flag );
+	}
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucWindow_SetViewportNeedsToDrawFlag( void* window, Bool flag ) {
+	lucWindow*              self         = (lucWindow*) window ;
+	Viewport_Index          viewport_I;
+
+	lucDebug_PrintFunctionBegin( self, 2 );
+	for ( viewport_I = 0 ; viewport_I < self->viewportCount ; viewport_I++ ) {
+		self->viewportInfoList[ viewport_I ].needsToDraw = flag;
+	}
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+lucViewportInfo* lucWindow_GetViewportInfoByPixel( void* window, Pixel_Index xPixel, Pixel_Index yPixel ) {
+	lucWindow*              self         = (lucWindow*) window ;
+	Viewport_Index          viewport_I;
+	
+	for ( viewport_I = 0 ; viewport_I < self->viewportCount ; viewport_I++ ) {
+		if ( lucViewportInfo_IsPixelInside( &self->viewportInfoList[ viewport_I ], xPixel, yPixel ) )
+			return &self->viewportInfoList[ viewport_I ];
+	}
+
+	return NULL;	
+}
+
+lucViewport* lucWindow_GetViewportByPixel( void* window, Pixel_Index xPixel, Pixel_Index yPixel ) {
+	lucWindow*              self         = (lucWindow*) window ;
+	lucViewportInfo*        viewportInfo;
+
+	viewportInfo = lucWindow_GetViewportInfoByPixel( self, xPixel, yPixel );
+	
+	if ( viewportInfo )
+		return viewportInfo->viewport;
+	else 
+		return NULL;
+}
+
+
+void lucWindow_Broadcast( void* window, int rootRank, MPI_Comm comm ) {
+	lucWindow*         self      = (lucWindow*) window;
+	Viewport_Index     viewport_I;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	MPI_Bcast( self, 1, lucWindow_MPI_Datatype, rootRank, comm );
+
+	/* Broadcast Viewport Infos */
+	for ( viewport_I = 0 ; viewport_I < self->viewportCount ; viewport_I++ ) {
+		lucViewportInfo_Broadcast( &self->viewportInfoList[ viewport_I ], rootRank, comm );
+	}
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void lucViewportInfo_Broadcast( lucViewportInfo* self, int rootRank, MPI_Comm comm ) {
+	Journal_DPrintfL( lucDebug, 2, "In %s.\n", __func__ );
+
+	lucViewport_Broadcast( self->viewport, rootRank, comm );
+
+	MPI_Bcast( self, 1, lucViewportInfo_MPI_Datatype, rootRank, comm );
+}
+
+Bool lucViewportInfo_IsPixelInside( lucViewportInfo* viewportInfo, Pixel_Index xPixel, Pixel_Index yPixel ) {
+	if ( xPixel < viewportInfo->startx ) 
+		return False;
+	if ( yPixel < viewportInfo->starty ) 
+		return False;
+	
+	if ( xPixel >= viewportInfo->startx + viewportInfo->width ) 
+		return False;
+	if ( yPixel >= viewportInfo->starty + viewportInfo->height ) 
+		return False;
+
+	return True;
+}	
+
+lucViewportInfo* lucWindow_ConstructViewportInfoList( 
+		lucWindow* self, 
+		Stg_ComponentFactory* cf, 
+		Pixel_Index width, 
+		Pixel_Index height, 
+		Viewport_Index* viewportCount,
+		void* data ) 
+{
+	Viewport_Index          vertical_I;
+	Viewport_Index          horizontal_I;
+	Viewport_Index          horizontalCount;
+	Viewport_Index          total_I                 = 0;
+	Pixel_Index             viewportHeight;
+	Pixel_Index             viewportWidth;
+	Dictionary_Entry_Value* list;
+	char*                   charPtr;
+	char*                   horizontalVP_String;
+	const char*             breakChars              = "\n\t ,;";
+	lucViewportInfo*        viewportInfoList        = Memory_Alloc_Array( lucViewportInfo, 1, "viewportInfoArray" );
+	lucViewportInfo*        currViewportInfo;
+	Dictionary*             dictionary              = Dictionary_GetDictionary( cf->componentDict, self->name );
+	Name                    viewportName[16];
+   char*                   savePtr;
+
+	*viewportCount = 0;
+	
+	list = Dictionary_Get( dictionary, (Dictionary_Entry_Key)"Viewport"  );
+	Journal_Firewall( list != NULL, lucError, "Cannot Find 'Viewport' for %s '%s'.\n", self->type, self->name );
+		
+	self->verticalCount = Dictionary_Entry_Value_GetCount( list );
+
+	/* Calculate viewport height */
+	viewportHeight = div( height, self->verticalCount ).quot;
+
+	for ( vertical_I = 0 ; vertical_I < self->verticalCount ; vertical_I++ ) {
+		horizontalVP_String = StG_Strdup( Dictionary_Entry_Value_AsString( Dictionary_Entry_Value_GetElement( list, vertical_I ) ) );
+	
+		/* Find number of horizontal layers */
+		horizontalCount = 0;
+		char* horizVPstr_ptr = horizontalVP_String;
+		charPtr = strtok_r( horizVPstr_ptr , breakChars, &savePtr);
+		while ( charPtr != NULL ) {
+			viewportName[horizontalCount] = StG_Strdup( charPtr );
+			horizontalCount++;
+			charPtr = strtok_r( NULL , breakChars, &savePtr);
+         if (horizontalCount == 16) {
+            /* Maximum 8 viewports across in single window */
+            if (charPtr != NULL)
+   			   Journal_Printf( lucError, "Error in func '%s' - too many viewports in window %s, maximum = 16 wide.\n", __func__, self->name);
+            break; 
+         }
+		}
+		
+		/* Sum up total number of viewports */
+		*viewportCount += horizontalCount;
+
+		/* Reallocate */
+		viewportInfoList = Memory_Realloc_Array( viewportInfoList, lucViewportInfo, *viewportCount );
+		
+		/* Calculate viewport width */
+		viewportWidth = div( width, horizontalCount ).quot;
+
+		/* Read String to get colour map */
+		for ( horizontal_I = 0 ; horizontal_I < horizontalCount ; horizontal_I++ ) {
+			currViewportInfo = &viewportInfoList[ total_I ];
+
+			/* Find viewport */
+			currViewportInfo->viewport = Stg_ComponentFactory_ConstructByName( cf, viewportName[horizontal_I], lucViewport, True, data ) ;
+			Memory_Free( viewportName[horizontal_I] );
+
+			/* Setup viewport dimensions */
+			currViewportInfo->startx = horizontal_I * viewportWidth;
+			currViewportInfo->starty = (self->verticalCount - 1 - vertical_I ) * viewportHeight;
+			currViewportInfo->width  = viewportWidth;
+			currViewportInfo->height = viewportHeight;
+
+			total_I++;
+		}
+
+		Memory_Free( horizontalVP_String );
+	}	
+
+	Journal_Firewall( total_I == *viewportCount, lucError, 
+			"Something went wrong in %s for %s '%s' - Incorrectly counted number of viewports.\n", 
+			__func__, self->type, self->name );
+
+	return viewportInfoList;
+}
+
+void lucWindow_InteractionHelpMessage( void* window, Stream* stream ) {
+	lucWindow*              self      = (lucWindow*) window;
+	WindowInteraction_Index windowInteraction_I;
+	WindowInteraction_Index windowInteractionCount = lucWindowInteraction_Register_GetCount( self->windowInteraction_Register ); 
+	lucWindowInteraction*   windowInteraction;
+
+	Journal_Printf( stream, "--------------------------------------------------------------------\n" );
+	Journal_Printf( stream, "Help for %s '%s':\n", self->type, self->name );
+
+	Journal_Printf( stream, "Window Interactions registered on this window are:\n" );
+	Stream_Indent( stream );
+	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
+		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
+		Journal_Printf( stream, "'%s' (type %s)\n", windowInteraction->name, windowInteraction->type );
+	}
+	Stream_UnIndent( stream );
+	
+	Journal_Printf( stream, "Mouse Interaction:\n" );
+	Stream_Indent( stream );
+	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
+		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
+		lucWindowInteraction_MouseMessage( windowInteraction, stream );
+	}
+	Stream_UnIndent( stream );	
+
+	Journal_Printf( stream, "Keyboard Interaction:\n" );
+	Stream_Indent( stream );
+	for ( windowInteraction_I = 0 ; windowInteraction_I < windowInteractionCount ; windowInteraction_I++ ) {
+		windowInteraction = lucWindowInteraction_Register_GetByIndex( self->windowInteraction_Register, windowInteraction_I );
+		lucWindowInteraction_KeyboardMessage( windowInteraction, stream );
+	}
+	Stream_UnIndent( stream );	
+	Journal_Printf( stream, "--------------------------------------------------------------------\n" );
+}
+	
+
+#define lucWindow_TypesCount 7
+void lucWindow_Create_MPI_Datatype() {
+	MPI_Datatype        typeList[lucWindow_TypesCount]     = { MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_FLOAT, MPI_INT };
+	int                 blocklen[lucWindow_TypesCount]     = {1, 1, 1, 1, 1, 4, 1};
+	MPI_Aint            displacement[lucWindow_TypesCount];
+	lucWindow           window;
+
+	displacement[0] = GetOffsetOfMember( window, width );
+	displacement[1] = GetOffsetOfMember( window, height );
+	displacement[2] = GetOffsetOfMember( window, interactive );
+	displacement[3] = GetOffsetOfMember( window, quitEventLoop );
+	displacement[4] = GetOffsetOfMember( window, resized );
+	displacement[5] = GetOffsetOfMember( window, backgroundColour );
+	displacement[6] = GetOffsetOfMember( window, currStereoBuffer );
+	
+	MPI_Type_struct( lucWindow_TypesCount, blocklen, displacement, typeList, &lucWindow_MPI_Datatype );
+	MPI_Type_commit( & lucWindow_MPI_Datatype );
+}
+
+
+#define lucViewportInfo_TypesCount 5
+void lucViewportInfo_Create_MPI_Datatype() {
+	MPI_Datatype        typeList[lucViewportInfo_TypesCount]     = { MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT };
+	int                 blocklen[lucViewportInfo_TypesCount]     = {1, 1, 1, 1, 1};
+	MPI_Aint            displacement[lucViewportInfo_TypesCount];
+	lucViewportInfo     viewportInfo;
+
+	displacement[0] = GetOffsetOfMember( viewportInfo, startx );
+	displacement[1] = GetOffsetOfMember( viewportInfo, starty );
+	displacement[2] = GetOffsetOfMember( viewportInfo, width );
+	displacement[3] = GetOffsetOfMember( viewportInfo, height );
+	displacement[4] = GetOffsetOfMember( viewportInfo, needsToDraw );
+	
+	MPI_Type_struct( lucViewportInfo_TypesCount, blocklen, displacement, typeList, &lucViewportInfo_MPI_Datatype );
+	MPI_Type_commit( & lucViewportInfo_MPI_Datatype );
+}
+
+void lucWindow_ChangeInteractiveMode( void* window ) {
+	lucWindow*              self         = (lucWindow*) window ;
+	self->interactive = !self->interactive;
+}
+
+
+void lucWindow_ChangeContinuousMode( void* window ) {
+	lucWindow*              self         = (lucWindow*) window ;
+	self->continuous = !self->continuous;
+}
+
+void lucWindow_QuitEventLoop( void* window ) {
+	lucWindow*              self         = (lucWindow*) window ;
+
+	self->quitEventLoop = True;
+}
+
+void lucWindow_ToggleApplicationQuit( void* window ) {
+	lucWindow*              self         = (lucWindow*) window ;
+
+	lucWindow_QuitEventLoop( self );
+	self->toggleApplicationQuit = True;
+}
+
+Bool lucWindow_SetSize( void* window, Pixel_Index newWidth, Pixel_Index newHeight ) {
+	lucWindow*       self      = (lucWindow*) window;
+
+	if (newWidth < 32 || newHeight < 32) return False;
+    if (newWidth == self->width && newHeight == self->height) return False; /* No resize neccessary */
+
+	self->width = newWidth;
+	self->height = newHeight;
+
+    self->resized = True;
+  	Journal_DPrintfL( lucDebug, 2, "Window resized %d x %d\n", self->width, self->height);
+
+    return True;
+}
+
+void lucWindow_IdleReset(void *window) {
+	/* Update Idle timer */
+	lucWindow* self = (lucWindow*)window;
+	self->idleTime = MPI_Wtime();
+}
+
+void lucWindow_IdleCheck(void *window) {
+	lucWindow* self = (lucWindow*)window;
+	if (self->isTimedOut && self->idleTime > 0){
+		if ( MPI_Wtime() > self->idleTime + self->maxIdleTime ) {
+			Journal_Printf( lucError, "Error in func '%s' - Interactive window '%s' open for too long (over %g seconds) without interaction.\n",
+							__func__, self->name, self->maxIdleTime );
+			abort();
+		}
+	}
+}
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/WindowInteraction.c
--- a/Base/src/WindowInteraction.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,362 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "ColourMap.h"
-#include "X11Colours.h"
-#include "ViewportInfo.h"
-#include "WindowInteraction.h"
-#include "WindowInteraction_Register.h"
-#include "Viewport.h"
-#include "Camera.h"
-#include "OutputFormat.h"
-#include "OutputFormat_Register.h"
-#include "Init.h"
-#include "RenderingEngine.h"
-#include "Window.h"
-
-
-#include <ctype.h>
-#include <assert.h>
-#include <string.h>
-
-/* ASCII Characters */
-#define ESCAPE 27
-
-const Type lucWindowInteraction_Type = "lucWindowInteraction";
-
-lucWindowInteraction* lucWindowInteraction_New( Name name ) {
-	lucWindowInteraction* self = (lucWindowInteraction*) _lucWindowInteraction_DefaultNew( name );
-
-	lucWindowInteraction_InitAll( self );
-
-	return self;
-}
-
-lucWindowInteraction* _lucWindowInteraction_New(  LUCWINDOWINTERACTION_DEFARGS  )
-{
-	lucWindowInteraction*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucWindowInteraction) );
-	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
-	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
-	   and so should be set to ZERO in any children of this class. */
-	nameAllocationType = NON_GLOBAL;
-
-	self = (lucWindowInteraction*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
-
-	/* Set virtual functions specific to this sub-class here: */
-	self->_mouseMotion     = _mouseMotion;
-	self->_mouseClick      = _mouseClick;
-	self->_mouseMessage    = _mouseMessage;
-	self->_keyboardEvent   = _keyboardEvent;
-	self->_keyboardMessage = _keyboardMessage;
-
-	return self;
-}
-
-void _lucWindowInteraction_Init( lucWindowInteraction*                              self ) {
-}
-
-void lucWindowInteraction_InitAll( void* windowInteractor ) {
-	lucWindowInteraction* self        = windowInteractor;
-
-	_lucWindowInteraction_Init( self );
-}
-		
-void _lucWindowInteraction_Delete( void* windowInteractor ) {
-	lucWindowInteraction* self        = windowInteractor;
-	
-	_Stg_Component_Delete( self );
-}
-
-void _lucWindowInteraction_Print( void* windowInteractor, Stream* stream ) {
-	lucWindowInteraction*          self        = windowInteractor;
-	
-	Journal_Printf( stream, "lucWindowInteraction: %s\n", self->name );
-
-	Stream_Indent( stream );
-
-	/* Print Parent */
-	_Stg_Component_Print( self, stream );
-
-	Stream_UnIndent( stream );
-}
-
-void* _lucWindowInteraction_Copy( void* windowInteractor, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucWindowInteraction* self        = windowInteractor;
-	lucWindowInteraction* newWindowInteraction;
-
-	newWindowInteraction = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newWindowInteraction;
-}
-
-void* _lucWindowInteraction_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                  _sizeOfSelf = sizeof( lucWindowInteraction );
-	Type                                                          type = lucWindowInteraction_Type;
-	Stg_Class_DeleteFunction*                                  _delete = _lucWindowInteraction_Delete;
-	Stg_Class_PrintFunction*                                    _print = _lucWindowInteraction_Print;
-	Stg_Class_CopyFunction*                                      _copy = _lucWindowInteraction_Copy;
-	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucWindowInteraction_DefaultNew;
-	Stg_Component_ConstructFunction*                        _construct = _lucWindowInteraction_AssignFromXML;
-	Stg_Component_BuildFunction*                                _build = _lucWindowInteraction_Build;
-	Stg_Component_InitialiseFunction*                      _initialise = _lucWindowInteraction_Initialise;
-	Stg_Component_ExecuteFunction*                            _execute = _lucWindowInteraction_Execute;
-	Stg_Component_DestroyFunction*                            _destroy = _lucWindowInteraction_Destroy;
-	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucWindowInteraction_MouseMotion;
-	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucWindowInteraction_MouseClick;
-	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucWindowInteraction_MouseMessage;
-	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucWindowInteraction_KeyboardEvent;
-	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucWindowInteraction_KeyboardMessage;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
-}
-
-void _lucWindowInteraction_AssignFromXML( void* windowInteractor, Stg_ComponentFactory* cf, void* data ) {
-	lucWindowInteraction*          self        = windowInteractor;
-	
-	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
-	if( !self->context  ) 
-		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
-	
-	_lucWindowInteraction_Init( self  );
-}
-
-void _lucWindowInteraction_Build( void* windowInteractor, void* data ) { }
-void _lucWindowInteraction_Initialise( void* windowInteractor, void* data ) { }
-void _lucWindowInteraction_Execute( void* windowInteractor, void* data ) { }
-void _lucWindowInteraction_Destroy( void* windowInteractor, void* data ) { }
-
-/* Wrappers to virtual functions */
-void lucWindowInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {
-	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
-
-	self->_mouseMotion( self, window, button, xpos, ypos, startx, starty );
-}
-
-void lucWindowInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) {
-	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
-
-	self->_mouseClick( self, window, button, state, xpos, ypos );
-}
-
-void lucWindowInteraction_MouseMessage( void* windowInteraction, Stream* stream ) {
-	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
-
-	self->_mouseMessage( self, stream );
-}
-
-void lucWindowInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
-	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
-
-	self->_keyboardEvent( self, window, key, xpos, ypos );
-}
-
-void lucWindowInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
-	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
-
-	self->_keyboardMessage( self, stream );
-}
-
-/* Default Virtual Function Implementations */
-void _lucWindowInteraction_MouseMotion( void* windowInteractor, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {
-	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteractor;
-	lucViewport*   viewport;
-	lucCamera*     camera;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	viewport = lucWindow_GetViewportByPixel( window, xpos, ypos );
-	if (viewport == NULL) {
-		lucDebug_PrintFunctionEnd( self, 2 );
-		return;
-	}
-	camera = viewport->camera;
-	
-	switch (button) {
-		case lucLeftButton:
-			lucCamera_RotateAroundUpDirection(  camera, ((double)startx - (double)xpos) * M_PI/180.0 );
-			lucCamera_RotateTowardsUpDirection( camera, ((double)starty - (double)ypos) * M_PI/180.0 );
-			break;
-		case lucRightButton: 
-		    lucCamera_ChangeFocalPoint( camera, startx, starty, xpos, ypos);
-			break;
-		case lucMiddleButton:
-			lucCamera_Zoom( camera, 1.0 + ((double)starty - (double)ypos)/10.0 );
-			break;
-		default:
-			break;
-	}
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void _lucWindowInteraction_MouseClick( void* windowInteractor, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) {
-	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteractor;
-	lucViewport*   viewport;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	viewport = lucWindow_GetViewportByPixel( window, xpos, ypos );
-	if (viewport == NULL) 
-		return;
-
-	switch (state) {
-		case lucButtonPress:
-			break;
-		case lucButtonRelease:
-			break;
-		default:
-			break;
-	}
-
-	switch (button) {
-		case lucLeftButton:
-			break;
-		case lucRightButton:
-			break;
-		case lucMiddleButton:
-			break;
-		case lucWheelUp:
-			lucCamera_Zoom( viewport->camera, 0.9 );
-			break;
-		case lucWheelDown:
-			lucCamera_Zoom( viewport->camera, 1.1 );
-			break;
-	}
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}	
-
-void _lucWindowInteraction_MouseMessage( void* windowInteractor, Stream* stream ) {
-	Journal_Printf( stream, "Left Button:                  Rotate camera around model.\n" );
-	Journal_Printf( stream, "Middle Button:                Zoom camera in or out of the model.\n" );
-	Journal_Printf( stream, "Right Button:                 Move camera's focal point.\n" );
-}
-
-void _lucWindowInteraction_KeyboardEvent( void* windowInteractor, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
-	lucWindowInteraction* self      = (lucWindowInteraction*) windowInteractor;
-	lucViewport*          viewport = lucWindow_GetViewportByPixel( window, xpos, ypos );
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-
-	/* Make Case Insensitive */
-	/*key = tolower( key )*/;
-
-	Journal_DPrintfL( lucDebug, 0, "Key pressed '%c' (%d)\n", key, key );
-
-	switch (key) {
-		case ESCAPE:
-			Journal_Printf( Journal_MyStream( Info_Type, self ), "Escape key pressed - Exiting program.\n" );
-			lucDebug_PrintFunctionEnd( self, 2 );
-			lucWindow_ToggleApplicationQuit( window );
-			break;
-		case 'q': case ' ':
-			lucDebug_PrintFunctionEnd( self, 2 );
-			lucWindow_QuitEventLoop( window );
-			break;
-		case 'h': 
-			lucWindow_InteractionHelpMessage( window, Journal_MyStream( Info_Type, window ) );     
-			break;
-		case 'i': 
-			lucWindow_ChangeInteractiveMode( window );     
-			Journal_Printf( Journal_MyStream( Info_Type, self ), "Interactivity for %s '%s' is %s.\n",
-					window->type, window->name, window->interactive ? "True" : "False" );
-			break;
-		case 'r': 
-			if (viewport)
-				lucViewport_Reset( viewport );
-			break;
-		case 's': 
-			if (viewport)
-				lucCamera_Pickle( viewport->camera, Journal_MyStream( Info_Type, viewport->camera ) );
-			break;
-		case '[':
-			if (viewport)
-				lucCamera_Zoom( viewport->camera, 1.1 );
-			break;
-		case ']':
-			if (viewport)
-				lucCamera_Zoom( viewport->camera, 0.9 );
-			break;
-		case 'o':
-			lucWindow_ChangeContinuousMode( window );
-			Journal_Printf( Journal_MyStream( Info_Type, self ), "Continuous for %s '%s' is %s.\n",
-					window->type, window->name, window->continuous ? "True" : "False" );
-			lucWindow_QuitEventLoop( window );
-			break;
-		
-		default:
-			break;
-	}
-
-	lucDebug_PrintFunctionEnd( self, 2 );
-}
-
-void _lucWindowInteraction_KeyboardMessage( void* windowInteractor, Stream* stream ) {
-	Journal_Printf( stream, "escape:                       Exit out of program.\n" );
-	Journal_Printf( stream, "q, space:                     Close window and continue running program.\n" );
-	Journal_Printf( stream, "h:                            Print this help message.\n" );
-	Journal_Printf( stream, "i:                            Toggle Window Interactivity.\n" );
-	Journal_Printf( stream, "r:                            Reset camera for viewport under cursor.\n" );
-	Journal_Printf( stream, "s:                            Output information for camera associated with viewport under cursor.\n" );
-	Journal_Printf( stream, "[:                            Zoom out with camera associated with viewport under cursor.\n" );
-	Journal_Printf( stream, "]:                            Zoom in with camera associated with viewport under cursor.\n" );
-	Journal_Printf( stream, "o:                            Continuous mode on/off (keep rendering new frames while interacting).\n" );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/WindowInteraction.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/WindowInteraction.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,362 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "ColourMap.h"
+#include "X11Colours.h"
+#include "ViewportInfo.h"
+#include "WindowInteraction.h"
+#include "WindowInteraction_Register.h"
+#include "Viewport.h"
+#include "Camera.h"
+#include "OutputFormat.h"
+#include "OutputFormat_Register.h"
+#include "Init.h"
+#include "RenderingEngine.h"
+#include "Window.h"
+
+
+#include <ctype.h>
+#include <assert.h>
+#include <string.h>
+
+/* ASCII Characters */
+#define ESCAPE 27
+
+const Type lucWindowInteraction_Type = "lucWindowInteraction";
+
+lucWindowInteraction* lucWindowInteraction_New( Name name ) {
+	lucWindowInteraction* self = (lucWindowInteraction*) _lucWindowInteraction_DefaultNew( name );
+
+	lucWindowInteraction_InitAll( self );
+
+	return self;
+}
+
+lucWindowInteraction* _lucWindowInteraction_New(  LUCWINDOWINTERACTION_DEFARGS  )
+{
+	lucWindowInteraction*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucWindowInteraction) );
+	/* The following terms are parameters that have been passed into this function but are being set before being passed onto the parent */
+	/* This means that any values of these parameters that are passed into this function are not passed onto the parent function
+	   and so should be set to ZERO in any children of this class. */
+	nameAllocationType = NON_GLOBAL;
+
+	self = (lucWindowInteraction*) _Stg_Component_New(  STG_COMPONENT_PASSARGS  );
+
+	/* Set virtual functions specific to this sub-class here: */
+	self->_mouseMotion     = _mouseMotion;
+	self->_mouseClick      = _mouseClick;
+	self->_mouseMessage    = _mouseMessage;
+	self->_keyboardEvent   = _keyboardEvent;
+	self->_keyboardMessage = _keyboardMessage;
+
+	return self;
+}
+
+void _lucWindowInteraction_Init( lucWindowInteraction*                              self ) {
+}
+
+void lucWindowInteraction_InitAll( void* windowInteractor ) {
+	lucWindowInteraction* self        = windowInteractor;
+
+	_lucWindowInteraction_Init( self );
+}
+		
+void _lucWindowInteraction_Delete( void* windowInteractor ) {
+	lucWindowInteraction* self        = windowInteractor;
+	
+	_Stg_Component_Delete( self );
+}
+
+void _lucWindowInteraction_Print( void* windowInteractor, Stream* stream ) {
+	lucWindowInteraction*          self        = windowInteractor;
+	
+	Journal_Printf( stream, "lucWindowInteraction: %s\n", self->name );
+
+	Stream_Indent( stream );
+
+	/* Print Parent */
+	_Stg_Component_Print( self, stream );
+
+	Stream_UnIndent( stream );
+}
+
+void* _lucWindowInteraction_Copy( void* windowInteractor, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucWindowInteraction* self        = windowInteractor;
+	lucWindowInteraction* newWindowInteraction;
+
+	newWindowInteraction = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newWindowInteraction;
+}
+
+void* _lucWindowInteraction_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                  _sizeOfSelf = sizeof( lucWindowInteraction );
+	Type                                                          type = lucWindowInteraction_Type;
+	Stg_Class_DeleteFunction*                                  _delete = _lucWindowInteraction_Delete;
+	Stg_Class_PrintFunction*                                    _print = _lucWindowInteraction_Print;
+	Stg_Class_CopyFunction*                                      _copy = _lucWindowInteraction_Copy;
+	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucWindowInteraction_DefaultNew;
+	Stg_Component_ConstructFunction*                        _construct = _lucWindowInteraction_AssignFromXML;
+	Stg_Component_BuildFunction*                                _build = _lucWindowInteraction_Build;
+	Stg_Component_InitialiseFunction*                      _initialise = _lucWindowInteraction_Initialise;
+	Stg_Component_ExecuteFunction*                            _execute = _lucWindowInteraction_Execute;
+	Stg_Component_DestroyFunction*                            _destroy = _lucWindowInteraction_Destroy;
+	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucWindowInteraction_MouseMotion;
+	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucWindowInteraction_MouseClick;
+	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucWindowInteraction_MouseMessage;
+	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucWindowInteraction_KeyboardEvent;
+	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucWindowInteraction_KeyboardMessage;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
+}
+
+void _lucWindowInteraction_AssignFromXML( void* windowInteractor, Stg_ComponentFactory* cf, void* data ) {
+	lucWindowInteraction*          self        = windowInteractor;
+	
+	self->context = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Context", AbstractContext, False, data );
+	if( !self->context  ) 
+		self->context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data );
+	
+	_lucWindowInteraction_Init( self  );
+}
+
+void _lucWindowInteraction_Build( void* windowInteractor, void* data ) { }
+void _lucWindowInteraction_Initialise( void* windowInteractor, void* data ) { }
+void _lucWindowInteraction_Execute( void* windowInteractor, void* data ) { }
+void _lucWindowInteraction_Destroy( void* windowInteractor, void* data ) { }
+
+/* Wrappers to virtual functions */
+void lucWindowInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {
+	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
+
+	self->_mouseMotion( self, window, button, xpos, ypos, startx, starty );
+}
+
+void lucWindowInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) {
+	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
+
+	self->_mouseClick( self, window, button, state, xpos, ypos );
+}
+
+void lucWindowInteraction_MouseMessage( void* windowInteraction, Stream* stream ) {
+	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
+
+	self->_mouseMessage( self, stream );
+}
+
+void lucWindowInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
+	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
+
+	self->_keyboardEvent( self, window, key, xpos, ypos );
+}
+
+void lucWindowInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
+	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteraction;
+
+	self->_keyboardMessage( self, stream );
+}
+
+/* Default Virtual Function Implementations */
+void _lucWindowInteraction_MouseMotion( void* windowInteractor, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {
+	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteractor;
+	lucViewport*   viewport;
+	lucCamera*     camera;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	viewport = lucWindow_GetViewportByPixel( window, xpos, ypos );
+	if (viewport == NULL) {
+		lucDebug_PrintFunctionEnd( self, 2 );
+		return;
+	}
+	camera = viewport->camera;
+	
+	switch (button) {
+		case lucLeftButton:
+			lucCamera_RotateAroundUpDirection(  camera, ((double)startx - (double)xpos) * M_PI/180.0 );
+			lucCamera_RotateTowardsUpDirection( camera, ((double)starty - (double)ypos) * M_PI/180.0 );
+			break;
+		case lucRightButton: 
+		    lucCamera_ChangeFocalPoint( camera, startx, starty, xpos, ypos);
+			break;
+		case lucMiddleButton:
+			lucCamera_Zoom( camera, 1.0 + ((double)starty - (double)ypos)/10.0 );
+			break;
+		default:
+			break;
+	}
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void _lucWindowInteraction_MouseClick( void* windowInteractor, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) {
+	lucWindowInteraction*     self      = (lucWindowInteraction*) windowInteractor;
+	lucViewport*   viewport;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	viewport = lucWindow_GetViewportByPixel( window, xpos, ypos );
+	if (viewport == NULL) 
+		return;
+
+	switch (state) {
+		case lucButtonPress:
+			break;
+		case lucButtonRelease:
+			break;
+		default:
+			break;
+	}
+
+	switch (button) {
+		case lucLeftButton:
+			break;
+		case lucRightButton:
+			break;
+		case lucMiddleButton:
+			break;
+		case lucWheelUp:
+			lucCamera_Zoom( viewport->camera, 0.9 );
+			break;
+		case lucWheelDown:
+			lucCamera_Zoom( viewport->camera, 1.1 );
+			break;
+	}
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}	
+
+void _lucWindowInteraction_MouseMessage( void* windowInteractor, Stream* stream ) {
+	Journal_Printf( stream, "Left Button:                  Rotate camera around model.\n" );
+	Journal_Printf( stream, "Middle Button:                Zoom camera in or out of the model.\n" );
+	Journal_Printf( stream, "Right Button:                 Move camera's focal point.\n" );
+}
+
+void _lucWindowInteraction_KeyboardEvent( void* windowInteractor, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
+	lucWindowInteraction* self      = (lucWindowInteraction*) windowInteractor;
+	lucViewport*          viewport = lucWindow_GetViewportByPixel( window, xpos, ypos );
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+
+	/* Make Case Insensitive */
+	/*key = tolower( key )*/;
+
+	Journal_DPrintfL( lucDebug, 0, "Key pressed '%c' (%d)\n", key, key );
+
+	switch (key) {
+		case ESCAPE:
+			Journal_Printf( Journal_MyStream( Info_Type, self ), "Escape key pressed - Exiting program.\n" );
+			lucDebug_PrintFunctionEnd( self, 2 );
+			lucWindow_ToggleApplicationQuit( window );
+			break;
+		case 'q': case ' ':
+			lucDebug_PrintFunctionEnd( self, 2 );
+			lucWindow_QuitEventLoop( window );
+			break;
+		case 'h': 
+			lucWindow_InteractionHelpMessage( window, Journal_MyStream( Info_Type, window ) );     
+			break;
+		case 'i': 
+			lucWindow_ChangeInteractiveMode( window );     
+			Journal_Printf( Journal_MyStream( Info_Type, self ), "Interactivity for %s '%s' is %s.\n",
+					window->type, window->name, window->interactive ? "True" : "False" );
+			break;
+		case 'r': 
+			if (viewport)
+				lucViewport_Reset( viewport );
+			break;
+		case 's': 
+			if (viewport)
+				lucCamera_Pickle( viewport->camera, Journal_MyStream( Info_Type, viewport->camera ) );
+			break;
+		case '[':
+			if (viewport)
+				lucCamera_Zoom( viewport->camera, 1.1 );
+			break;
+		case ']':
+			if (viewport)
+				lucCamera_Zoom( viewport->camera, 0.9 );
+			break;
+		case 'o':
+			lucWindow_ChangeContinuousMode( window );
+			Journal_Printf( Journal_MyStream( Info_Type, self ), "Continuous for %s '%s' is %s.\n",
+					window->type, window->name, window->continuous ? "True" : "False" );
+			lucWindow_QuitEventLoop( window );
+			break;
+		
+		default:
+			break;
+	}
+
+	lucDebug_PrintFunctionEnd( self, 2 );
+}
+
+void _lucWindowInteraction_KeyboardMessage( void* windowInteractor, Stream* stream ) {
+	Journal_Printf( stream, "escape:                       Exit out of program.\n" );
+	Journal_Printf( stream, "q, space:                     Close window and continue running program.\n" );
+	Journal_Printf( stream, "h:                            Print this help message.\n" );
+	Journal_Printf( stream, "i:                            Toggle Window Interactivity.\n" );
+	Journal_Printf( stream, "r:                            Reset camera for viewport under cursor.\n" );
+	Journal_Printf( stream, "s:                            Output information for camera associated with viewport under cursor.\n" );
+	Journal_Printf( stream, "[:                            Zoom out with camera associated with viewport under cursor.\n" );
+	Journal_Printf( stream, "]:                            Zoom in with camera associated with viewport under cursor.\n" );
+	Journal_Printf( stream, "o:                            Continuous mode on/off (keep rendering new frames while interacting).\n" );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/WindowInteraction_Register.c
--- a/Base/src/WindowInteraction_Register.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "WindowInteraction_Register.h"
-#include "WindowInteraction.h"
-
-const Type lucWindowInteraction_Register_Type = "lucWindowInteraction_Register";
-
-lucWindowInteraction_Register*	lucWindowInteraction_Register_New( void ) {
-	/* Variables set in this function */
-	SizeT                      _sizeOfSelf = sizeof(lucWindowInteraction_Register);
-	Type                              type = lucWindowInteraction_Register_Type;
-	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
-	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
-	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
-
-	lucWindowInteraction_Register* self;
-	
-	self = (lucWindowInteraction_Register*) _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
-
-	return self;
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/WindowInteraction_Register.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/WindowInteraction_Register.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,73 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "WindowInteraction_Register.h"
+#include "WindowInteraction.h"
+
+const Type lucWindowInteraction_Register_Type = "lucWindowInteraction_Register";
+
+lucWindowInteraction_Register*	lucWindowInteraction_Register_New( void ) {
+	/* Variables set in this function */
+	SizeT                      _sizeOfSelf = sizeof(lucWindowInteraction_Register);
+	Type                              type = lucWindowInteraction_Register_Type;
+	Stg_Class_DeleteFunction*      _delete = _NamedObject_Register_Delete;
+	Stg_Class_PrintFunction*        _print = _NamedObject_Register_Print;
+	Stg_Class_CopyFunction*          _copy = _NamedObject_Register_Copy;
+
+	lucWindowInteraction_Register* self;
+	
+	self = (lucWindowInteraction_Register*) _NamedObject_Register_New(  NAMEDOBJECT_REGISTER_PASSARGS  );
+
+	return self;
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/X11Colours.c
--- a/Base/src/X11Colours.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2090 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: X11Colours.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "types.h"
-#include "ColourMap.h"
-#include "X11Colours.h"
-#include <ctype.h>
-#include <string.h>
-
-/* Reads hex or colour from X11 Colour Chart */
-/* Defaults to black if anything else */
-void lucColour_FromX11ColourName( lucColour* self, Name x11ColourName ) {
-	int rgb[3];
-
-	if (strncmp(x11ColourName,"#",1) == 0) {
-		lucColour_FromHexName( self, x11ColourName );
-		return;
-	}
-	else if (strncasecmp(x11ColourName,"snow",4) == 0) {
-		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 250;
-	}
-	else if (strncasecmp(x11ColourName,"GhostWhite",10) == 0) {
-		rgb[0] = 248;	rgb[1] = 248;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"WhiteSmoke",10) == 0) {
-		rgb[0] = 245;	rgb[1] = 245;	rgb[2] = 245;
-	}
-	else if (strncasecmp(x11ColourName,"gainsboro",9) == 0) {
-		rgb[0] = 220;	rgb[1] = 220;	rgb[2] = 220;
-	}
-	else if (strncasecmp(x11ColourName,"FloralWhite",11) == 0) {
-		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 240;
-	}
-	else if (strncasecmp(x11ColourName,"OldLace",7) == 0) {
-		rgb[0] = 253;	rgb[1] = 245;	rgb[2] = 230;
-	}
-	else if (strncasecmp(x11ColourName,"linen",5) == 0) {
-		rgb[0] = 250;	rgb[1] = 240;	rgb[2] = 230;
-	}
-	else if (strncasecmp(x11ColourName,"AntiqueWhite",12) == 0) {
-		rgb[0] = 250;	rgb[1] = 235;	rgb[2] = 215;
-	}
-	else if (strncasecmp(x11ColourName,"PapayaWhip",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 239;	rgb[2] = 213;
-	}
-	else if (strncasecmp(x11ColourName,"BlanchedAlmond",14) == 0) {
-		rgb[0] = 255;	rgb[1] = 235;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"bisque",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 196;
-	}
-	else if (strncasecmp(x11ColourName,"PeachPuff",9) == 0) {
-		rgb[0] = 255;	rgb[1] = 218;	rgb[2] = 185;
-	}
-	else if (strncasecmp(x11ColourName,"NavajoWhite",11) == 0) {
-		rgb[0] = 255;	rgb[1] = 222;	rgb[2] = 173;
-	}
-	else if (strncasecmp(x11ColourName,"moccasin",8) == 0) {
-		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 181;
-	}
-	else if (strncasecmp(x11ColourName,"cornsilk",8) == 0) {
-		rgb[0] = 255;	rgb[1] = 248;	rgb[2] = 220;
-	}
-	else if (strncasecmp(x11ColourName,"ivory",5) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 240;
-	}
-	else if (strncasecmp(x11ColourName,"LemonChiffon",12) == 0) {
-		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"seashell",8) == 0) {
-		rgb[0] = 255;	rgb[1] = 245;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"honeydew",8) == 0) {
-		rgb[0] = 240;	rgb[1] = 255;	rgb[2] = 240;
-	}
-	else if (strncasecmp(x11ColourName,"MintCream",9) == 0) {
-		rgb[0] = 245;	rgb[1] = 255;	rgb[2] = 250;
-	}
-	else if (strncasecmp(x11ColourName,"azure",5) == 0) {
-		rgb[0] = 240;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"AliceBlue",9) == 0) {
-		rgb[0] = 240;	rgb[1] = 248;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"lavender",8) == 0) {
-		rgb[0] = 230;	rgb[1] = 230;	rgb[2] = 250;
-	}
-	else if (strncasecmp(x11ColourName,"LavenderBlush",13) == 0) {
-		rgb[0] = 255;	rgb[1] = 240;	rgb[2] = 245;
-	}
-	else if (strncasecmp(x11ColourName,"MistyRose",9) == 0) {
-		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 225;
-	}
-	else if (strncasecmp(x11ColourName,"white",5) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"black",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSlateGray",13) == 0) {
-		rgb[0] = 47;	rgb[1] = 79;	rgb[2] = 79;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSlateGrey",13) == 0) {
-		rgb[0] = 47;	rgb[1] = 79;	rgb[2] = 79;
-	}
-	else if (strncasecmp(x11ColourName,"DimGray",7) == 0) {
-		rgb[0] = 105;	rgb[1] = 105;	rgb[2] = 105;
-	}
-	else if (strncasecmp(x11ColourName,"DimGrey",7) == 0) {
-		rgb[0] = 105;	rgb[1] = 105;	rgb[2] = 105;
-	}
-	else if (strncasecmp(x11ColourName,"SlateGray",9) == 0) {
-		rgb[0] = 112;	rgb[1] = 128;	rgb[2] = 144;
-	}
-	else if (strncasecmp(x11ColourName,"SlateGrey",9) == 0) {
-		rgb[0] = 112;	rgb[1] = 128;	rgb[2] = 144;
-	}
-	else if (strncasecmp(x11ColourName,"LightSlateGray",14) == 0) {
-		rgb[0] = 119;	rgb[1] = 136;	rgb[2] = 153;
-	}
-	else if (strncasecmp(x11ColourName,"LightSlateGrey",14) == 0) {
-		rgb[0] = 119;	rgb[1] = 136;	rgb[2] = 153;
-	}
-	else if (strncasecmp(x11ColourName,"gray",4) == 0) {
-		rgb[0] = 190;	rgb[1] = 190;	rgb[2] = 190;
-	}
-	else if (strncasecmp(x11ColourName,"grey",4) == 0) {
-		rgb[0] = 190;	rgb[1] = 190;	rgb[2] = 190;
-	}
-	else if (strncasecmp(x11ColourName,"LightGrey",9) == 0) {
-		rgb[0] = 211;	rgb[1] = 211;	rgb[2] = 211;
-	}
-	else if (strncasecmp(x11ColourName,"LightGray",9) == 0) {
-		rgb[0] = 211;	rgb[1] = 211;	rgb[2] = 211;
-	}
-	else if (strncasecmp(x11ColourName,"MidnightBlue",12) == 0) {
-		rgb[0] = 25;	rgb[1] = 25;	rgb[2] = 112;
-	}
-	else if (strncasecmp(x11ColourName,"navy",4) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 128;
-	}
-	else if (strncasecmp(x11ColourName,"NavyBlue",8) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 128;
-	}
-	else if (strncasecmp(x11ColourName,"CornflowerBlue",14) == 0) {
-		rgb[0] = 100;	rgb[1] = 149;	rgb[2] = 237;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSlateBlue",13) == 0) {
-		rgb[0] = 72;	rgb[1] = 61;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"SlateBlue",9) == 0) {
-		rgb[0] = 106;	rgb[1] = 90;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"MediumSlateBlue",15) == 0) {
-		rgb[0] = 123;	rgb[1] = 104;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"LightSlateBlue",14) == 0) {
-		rgb[0] = 132;	rgb[1] = 112;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"MediumBlue",10) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"RoyalBlue",9) == 0) {
-		rgb[0] = 65;	rgb[1] = 105;	rgb[2] = 225;
-	}
-	else if (strncasecmp(x11ColourName,"blue",4) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"DodgerBlue",10) == 0) {
-		rgb[0] = 30;	rgb[1] = 144;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"DeepSkyBlue",11) == 0) {
-		rgb[0] = 0;	rgb[1] = 191;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"SkyBlue",7) == 0) {
-		rgb[0] = 135;	rgb[1] = 206;	rgb[2] = 235;
-	}
-	else if (strncasecmp(x11ColourName,"LightSkyBlue",12) == 0) {
-		rgb[0] = 135;	rgb[1] = 206;	rgb[2] = 250;
-	}
-	else if (strncasecmp(x11ColourName,"SteelBlue",9) == 0) {
-		rgb[0] = 70;	rgb[1] = 130;	rgb[2] = 180;
-	}
-	else if (strncasecmp(x11ColourName,"LightSteelBlue",14) == 0) {
-		rgb[0] = 176;	rgb[1] = 196;	rgb[2] = 222;
-	}
-	else if (strncasecmp(x11ColourName,"LightBlue",9) == 0) {
-		rgb[0] = 173;	rgb[1] = 216;	rgb[2] = 230;
-	}
-	else if (strncasecmp(x11ColourName,"PowderBlue",10) == 0) {
-		rgb[0] = 176;	rgb[1] = 224;	rgb[2] = 230;
-	}
-	else if (strncasecmp(x11ColourName,"PaleTurquoise",13) == 0) {
-		rgb[0] = 175;	rgb[1] = 238;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"DarkTurquoise",13) == 0) {
-		rgb[0] = 0;	rgb[1] = 206;	rgb[2] = 209;
-	}
-	else if (strncasecmp(x11ColourName,"MediumTurquoise",15) == 0) {
-		rgb[0] = 72;	rgb[1] = 209;	rgb[2] = 204;
-	}
-	else if (strncasecmp(x11ColourName,"turquoise",9) == 0) {
-		rgb[0] = 64;	rgb[1] = 224;	rgb[2] = 208;
-	}
-	else if (strncasecmp(x11ColourName,"cyan",4) == 0) {
-		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"LightCyan",9) == 0) {
-		rgb[0] = 224;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"CadetBlue",9) == 0) {
-		rgb[0] = 95;	rgb[1] = 158;	rgb[2] = 160;
-	}
-	else if (strncasecmp(x11ColourName,"MediumAquamarine",16) == 0) {
-		rgb[0] = 102;	rgb[1] = 205;	rgb[2] = 170;
-	}
-	else if (strncasecmp(x11ColourName,"aquamarine",10) == 0) {
-		rgb[0] = 127;	rgb[1] = 255;	rgb[2] = 212;
-	}
-	else if (strncasecmp(x11ColourName,"DarkGreen",9) == 0) {
-		rgb[0] = 0;	rgb[1] = 100;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOliveGreen",14) == 0) {
-		rgb[0] = 85;	rgb[1] = 107;	rgb[2] = 47;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSeaGreen",12) == 0) {
-		rgb[0] = 143;	rgb[1] = 188;	rgb[2] = 143;
-	}
-	else if (strncasecmp(x11ColourName,"SeaGreen",8) == 0) {
-		rgb[0] = 46;	rgb[1] = 139;	rgb[2] = 87;
-	}
-	else if (strncasecmp(x11ColourName,"MediumSeaGreen",14) == 0) {
-		rgb[0] = 60;	rgb[1] = 179;	rgb[2] = 113;
-	}
-	else if (strncasecmp(x11ColourName,"LightSeaGreen",13) == 0) {
-		rgb[0] = 32;	rgb[1] = 178;	rgb[2] = 170;
-	}
-	else if (strncasecmp(x11ColourName,"PaleGreen",9) == 0) {
-		rgb[0] = 152;	rgb[1] = 251;	rgb[2] = 152;
-	}
-	else if (strncasecmp(x11ColourName,"SpringGreen",11) == 0) {
-		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 127;
-	}
-	else if (strncasecmp(x11ColourName,"LawnGreen",9) == 0) {
-		rgb[0] = 124;	rgb[1] = 252;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"green",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"chartreuse",10) == 0) {
-		rgb[0] = 127;	rgb[1] = 255;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"MediumSpringGreen",17) == 0) {
-		rgb[0] = 0;	rgb[1] = 250;	rgb[2] = 154;
-	}
-	else if (strncasecmp(x11ColourName,"GreenYellow",11) == 0) {
-		rgb[0] = 173;	rgb[1] = 255;	rgb[2] = 47;
-	}
-	else if (strncasecmp(x11ColourName,"LimeGreen",9) == 0) {
-		rgb[0] = 50;	rgb[1] = 205;	rgb[2] = 50;
-	}
-	else if (strncasecmp(x11ColourName,"YellowGreen",11) == 0) {
-		rgb[0] = 154;	rgb[1] = 205;	rgb[2] = 50;
-	}
-	else if (strncasecmp(x11ColourName,"ForestGreen",11) == 0) {
-		rgb[0] = 34;	rgb[1] = 139;	rgb[2] = 34;
-	}
-	else if (strncasecmp(x11ColourName,"OliveDrab",9) == 0) {
-		rgb[0] = 107;	rgb[1] = 142;	rgb[2] = 35;
-	}
-	else if (strncasecmp(x11ColourName,"DarkKhaki",9) == 0) {
-		rgb[0] = 189;	rgb[1] = 183;	rgb[2] = 107;
-	}
-	else if (strncasecmp(x11ColourName,"khaki",5) == 0) {
-		rgb[0] = 240;	rgb[1] = 230;	rgb[2] = 140;
-	}
-	else if (strncasecmp(x11ColourName,"PaleGoldenrod",13) == 0) {
-		rgb[0] = 238;	rgb[1] = 232;	rgb[2] = 170;
-	}
-	else if (strncasecmp(x11ColourName,"LightGoldenrodYellow",20) == 0) {
-		rgb[0] = 250;	rgb[1] = 250;	rgb[2] = 210;
-	}
-	else if (strncasecmp(x11ColourName,"LightYellow",11) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 224;
-	}
-	else if (strncasecmp(x11ColourName,"yellow",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"gold",4) == 0) {
-		rgb[0] = 255;	rgb[1] = 215;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"LightGoldenrod",14) == 0) {
-		rgb[0] = 238;	rgb[1] = 221;	rgb[2] = 130;
-	}
-	else if (strncasecmp(x11ColourName,"goldenrod",9) == 0) {
-		rgb[0] = 218;	rgb[1] = 165;	rgb[2] = 32;
-	}
-	else if (strncasecmp(x11ColourName,"DarkGoldenrod",13) == 0) {
-		rgb[0] = 184;	rgb[1] = 134;	rgb[2] = 11;
-	}
-	else if (strncasecmp(x11ColourName,"RosyBrown",9) == 0) {
-		rgb[0] = 188;	rgb[1] = 143;	rgb[2] = 143;
-	}
-	else if (strncasecmp(x11ColourName,"IndianRed",9) == 0) {
-		rgb[0] = 205;	rgb[1] = 92;	rgb[2] = 92;
-	}
-	else if (strncasecmp(x11ColourName,"SaddleBrown",11) == 0) {
-		rgb[0] = 139;	rgb[1] = 69;	rgb[2] = 19;
-	}
-	else if (strncasecmp(x11ColourName,"sienna",6) == 0) {
-		rgb[0] = 160;	rgb[1] = 82;	rgb[2] = 45;
-	}
-	else if (strncasecmp(x11ColourName,"peru",4) == 0) {
-		rgb[0] = 205;	rgb[1] = 133;	rgb[2] = 63;
-	}
-	else if (strncasecmp(x11ColourName,"burlywood",9) == 0) {
-		rgb[0] = 222;	rgb[1] = 184;	rgb[2] = 135;
-	}
-	else if (strncasecmp(x11ColourName,"beige",5) == 0) {
-		rgb[0] = 245;	rgb[1] = 245;	rgb[2] = 220;
-	}
-	else if (strncasecmp(x11ColourName,"wheat",5) == 0) {
-		rgb[0] = 245;	rgb[1] = 222;	rgb[2] = 179;
-	}
-	else if (strncasecmp(x11ColourName,"SandyBrown",10) == 0) {
-		rgb[0] = 244;	rgb[1] = 164;	rgb[2] = 96;
-	}
-	else if (strncasecmp(x11ColourName,"tan",3) == 0) {
-		rgb[0] = 210;	rgb[1] = 180;	rgb[2] = 140;
-	}
-	else if (strncasecmp(x11ColourName,"chocolate",9) == 0) {
-		rgb[0] = 210;	rgb[1] = 105;	rgb[2] = 30;
-	}
-	else if (strncasecmp(x11ColourName,"firebrick",9) == 0) {
-		rgb[0] = 178;	rgb[1] = 34;	rgb[2] = 34;
-	}
-	else if (strncasecmp(x11ColourName,"brown",5) == 0) {
-		rgb[0] = 165;	rgb[1] = 42;	rgb[2] = 42;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSalmon",10) == 0) {
-		rgb[0] = 233;	rgb[1] = 150;	rgb[2] = 122;
-	}
-	else if (strncasecmp(x11ColourName,"salmon",6) == 0) {
-		rgb[0] = 250;	rgb[1] = 128;	rgb[2] = 114;
-	}
-	else if (strncasecmp(x11ColourName,"LightSalmon",11) == 0) {
-		rgb[0] = 255;	rgb[1] = 160;	rgb[2] = 122;
-	}
-	else if (strncasecmp(x11ColourName,"orange",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 165;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrange",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 140;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"coral",5) == 0) {
-		rgb[0] = 255;	rgb[1] = 127;	rgb[2] = 80;
-	}
-	else if (strncasecmp(x11ColourName,"LightCoral",10) == 0) {
-		rgb[0] = 240;	rgb[1] = 128;	rgb[2] = 128;
-	}
-	else if (strncasecmp(x11ColourName,"tomato",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 99;	rgb[2] = 71;
-	}
-	else if (strncasecmp(x11ColourName,"OrangeRed",9) == 0) {
-		rgb[0] = 255;	rgb[1] = 69;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"red",3) == 0) {
-		rgb[0] = 255;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"HotPink",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 105;	rgb[2] = 180;
-	}
-	else if (strncasecmp(x11ColourName,"DeepPink",8) == 0) {
-		rgb[0] = 255;	rgb[1] = 20;	rgb[2] = 147;
-	}
-	else if (strncasecmp(x11ColourName,"pink",4) == 0) {
-		rgb[0] = 255;	rgb[1] = 192;	rgb[2] = 203;
-	}
-	else if (strncasecmp(x11ColourName,"LightPink",9) == 0) {
-		rgb[0] = 255;	rgb[1] = 182;	rgb[2] = 193;
-	}
-	else if (strncasecmp(x11ColourName,"PaleVioletRed",13) == 0) {
-		rgb[0] = 219;	rgb[1] = 112;	rgb[2] = 147;
-	}
-	else if (strncasecmp(x11ColourName,"maroon",6) == 0) {
-		rgb[0] = 176;	rgb[1] = 48;	rgb[2] = 96;
-	}
-	else if (strncasecmp(x11ColourName,"MediumVioletRed",15) == 0) {
-		rgb[0] = 199;	rgb[1] = 21;	rgb[2] = 133;
-	}
-	else if (strncasecmp(x11ColourName,"VioletRed",9) == 0) {
-		rgb[0] = 208;	rgb[1] = 32;	rgb[2] = 144;
-	}
-	else if (strncasecmp(x11ColourName,"magenta",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 0;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"violet",6) == 0) {
-		rgb[0] = 238;	rgb[1] = 130;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"plum",4) == 0) {
-		rgb[0] = 221;	rgb[1] = 160;	rgb[2] = 221;
-	}
-	else if (strncasecmp(x11ColourName,"orchid",6) == 0) {
-		rgb[0] = 218;	rgb[1] = 112;	rgb[2] = 214;
-	}
-	else if (strncasecmp(x11ColourName,"MediumOrchid",12) == 0) {
-		rgb[0] = 186;	rgb[1] = 85;	rgb[2] = 211;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrchid",10) == 0) {
-		rgb[0] = 153;	rgb[1] = 50;	rgb[2] = 204;
-	}
-	else if (strncasecmp(x11ColourName,"DarkViolet",10) == 0) {
-		rgb[0] = 148;	rgb[1] = 0;	rgb[2] = 211;
-	}
-	else if (strncasecmp(x11ColourName,"BlueViolet",10) == 0) {
-		rgb[0] = 138;	rgb[1] = 43;	rgb[2] = 226;
-	}
-	else if (strncasecmp(x11ColourName,"purple",6) == 0) {
-		rgb[0] = 160;	rgb[1] = 32;	rgb[2] = 240;
-	}
-	else if (strncasecmp(x11ColourName,"MediumPurple",12) == 0) {
-		rgb[0] = 147;	rgb[1] = 112;	rgb[2] = 219;
-	}
-	else if (strncasecmp(x11ColourName,"thistle",7) == 0) {
-		rgb[0] = 216;	rgb[1] = 191;	rgb[2] = 216;
-	}
-	else if (strncasecmp(x11ColourName,"snow1",5) == 0) {
-		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 250;
-	}
-	else if (strncasecmp(x11ColourName,"snow2",5) == 0) {
-		rgb[0] = 238;	rgb[1] = 233;	rgb[2] = 233;
-	}
-	else if (strncasecmp(x11ColourName,"snow3",5) == 0) {
-		rgb[0] = 205;	rgb[1] = 201;	rgb[2] = 201;
-	}
-	else if (strncasecmp(x11ColourName,"snow4",5) == 0) {
-		rgb[0] = 139;	rgb[1] = 137;	rgb[2] = 137;
-	}
-	else if (strncasecmp(x11ColourName,"seashell1",9) == 0) {
-		rgb[0] = 255;	rgb[1] = 245;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"seashell2",9) == 0) {
-		rgb[0] = 238;	rgb[1] = 229;	rgb[2] = 222;
-	}
-	else if (strncasecmp(x11ColourName,"seashell3",9) == 0) {
-		rgb[0] = 205;	rgb[1] = 197;	rgb[2] = 191;
-	}
-	else if (strncasecmp(x11ColourName,"seashell4",9) == 0) {
-		rgb[0] = 139;	rgb[1] = 134;	rgb[2] = 130;
-	}
-	else if (strncasecmp(x11ColourName,"AntiqueWhite1",13) == 0) {
-		rgb[0] = 255;	rgb[1] = 239;	rgb[2] = 219;
-	}
-	else if (strncasecmp(x11ColourName,"AntiqueWhite2",13) == 0) {
-		rgb[0] = 238;	rgb[1] = 223;	rgb[2] = 204;
-	}
-	else if (strncasecmp(x11ColourName,"AntiqueWhite3",13) == 0) {
-		rgb[0] = 205;	rgb[1] = 192;	rgb[2] = 176;
-	}
-	else if (strncasecmp(x11ColourName,"AntiqueWhite4",13) == 0) {
-		rgb[0] = 139;	rgb[1] = 131;	rgb[2] = 120;
-	}
-	else if (strncasecmp(x11ColourName,"bisque1",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 196;
-	}
-	else if (strncasecmp(x11ColourName,"bisque2",7) == 0) {
-		rgb[0] = 238;	rgb[1] = 213;	rgb[2] = 183;
-	}
-	else if (strncasecmp(x11ColourName,"bisque3",7) == 0) {
-		rgb[0] = 205;	rgb[1] = 183;	rgb[2] = 158;
-	}
-	else if (strncasecmp(x11ColourName,"bisque4",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 125;	rgb[2] = 107;
-	}
-	else if (strncasecmp(x11ColourName,"PeachPuff1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 218;	rgb[2] = 185;
-	}
-	else if (strncasecmp(x11ColourName,"PeachPuff2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 203;	rgb[2] = 173;
-	}
-	else if (strncasecmp(x11ColourName,"PeachPuff3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 175;	rgb[2] = 149;
-	}
-	else if (strncasecmp(x11ColourName,"PeachPuff4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 119;	rgb[2] = 101;
-	}
-	else if (strncasecmp(x11ColourName,"NavajoWhite1",12) == 0) {
-		rgb[0] = 255;	rgb[1] = 222;	rgb[2] = 173;
-	}
-	else if (strncasecmp(x11ColourName,"NavajoWhite2",12) == 0) {
-		rgb[0] = 238;	rgb[1] = 207;	rgb[2] = 161;
-	}
-	else if (strncasecmp(x11ColourName,"NavajoWhite3",12) == 0) {
-		rgb[0] = 205;	rgb[1] = 179;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"NavajoWhite4",12) == 0) {
-		rgb[0] = 139;	rgb[1] = 121;	rgb[2] = 94;
-	}
-	else if (strncasecmp(x11ColourName,"LemonChiffon1",13) == 0) {
-		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"LemonChiffon2",13) == 0) {
-		rgb[0] = 238;	rgb[1] = 233;	rgb[2] = 191;
-	}
-	else if (strncasecmp(x11ColourName,"LemonChiffon3",13) == 0) {
-		rgb[0] = 205;	rgb[1] = 201;	rgb[2] = 165;
-	}
-	else if (strncasecmp(x11ColourName,"LemonChiffon4",13) == 0) {
-		rgb[0] = 139;	rgb[1] = 137;	rgb[2] = 112;
-	}
-	else if (strncasecmp(x11ColourName,"cornsilk1",9) == 0) {
-		rgb[0] = 255;	rgb[1] = 248;	rgb[2] = 220;
-	}
-	else if (strncasecmp(x11ColourName,"cornsilk2",9) == 0) {
-		rgb[0] = 238;	rgb[1] = 232;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"cornsilk3",9) == 0) {
-		rgb[0] = 205;	rgb[1] = 200;	rgb[2] = 177;
-	}
-	else if (strncasecmp(x11ColourName,"cornsilk4",9) == 0) {
-		rgb[0] = 139;	rgb[1] = 136;	rgb[2] = 120;
-	}
-	else if (strncasecmp(x11ColourName,"ivory1",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 240;
-	}
-	else if (strncasecmp(x11ColourName,"ivory2",6) == 0) {
-		rgb[0] = 238;	rgb[1] = 238;	rgb[2] = 224;
-	}
-	else if (strncasecmp(x11ColourName,"ivory3",6) == 0) {
-		rgb[0] = 205;	rgb[1] = 205;	rgb[2] = 193;
-	}
-	else if (strncasecmp(x11ColourName,"ivory4",6) == 0) {
-		rgb[0] = 139;	rgb[1] = 139;	rgb[2] = 131;
-	}
-	else if (strncasecmp(x11ColourName,"honeydew1",9) == 0) {
-		rgb[0] = 240;	rgb[1] = 255;	rgb[2] = 240;
-	}
-	else if (strncasecmp(x11ColourName,"honeydew2",9) == 0) {
-		rgb[0] = 224;	rgb[1] = 238;	rgb[2] = 224;
-	}
-	else if (strncasecmp(x11ColourName,"honeydew3",9) == 0) {
-		rgb[0] = 193;	rgb[1] = 205;	rgb[2] = 193;
-	}
-	else if (strncasecmp(x11ColourName,"honeydew4",9) == 0) {
-		rgb[0] = 131;	rgb[1] = 139;	rgb[2] = 131;
-	}
-	else if (strncasecmp(x11ColourName,"LavenderBlush1",14) == 0) {
-		rgb[0] = 255;	rgb[1] = 240;	rgb[2] = 245;
-	}
-	else if (strncasecmp(x11ColourName,"LavenderBlush2",14) == 0) {
-		rgb[0] = 238;	rgb[1] = 224;	rgb[2] = 229;
-	}
-	else if (strncasecmp(x11ColourName,"LavenderBlush3",14) == 0) {
-		rgb[0] = 205;	rgb[1] = 193;	rgb[2] = 197;
-	}
-	else if (strncasecmp(x11ColourName,"LavenderBlush4",14) == 0) {
-		rgb[0] = 139;	rgb[1] = 131;	rgb[2] = 134;
-	}
-	else if (strncasecmp(x11ColourName,"MistyRose1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 225;
-	}
-	else if (strncasecmp(x11ColourName,"MistyRose2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 213;	rgb[2] = 210;
-	}
-	else if (strncasecmp(x11ColourName,"MistyRose3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 183;	rgb[2] = 181;
-	}
-	else if (strncasecmp(x11ColourName,"MistyRose4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 125;	rgb[2] = 123;
-	}
-	else if (strncasecmp(x11ColourName,"azure1",6) == 0) {
-		rgb[0] = 240;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"azure2",6) == 0) {
-		rgb[0] = 224;	rgb[1] = 238;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"azure3",6) == 0) {
-		rgb[0] = 193;	rgb[1] = 205;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"azure4",6) == 0) {
-		rgb[0] = 131;	rgb[1] = 139;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"SlateBlue1",10) == 0) {
-		rgb[0] = 131;	rgb[1] = 111;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"SlateBlue2",10) == 0) {
-		rgb[0] = 122;	rgb[1] = 103;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"SlateBlue3",10) == 0) {
-		rgb[0] = 105;	rgb[1] = 89;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"SlateBlue4",10) == 0) {
-		rgb[0] = 71;	rgb[1] = 60;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"RoyalBlue1",10) == 0) {
-		rgb[0] = 72;	rgb[1] = 118;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"RoyalBlue2",10) == 0) {
-		rgb[0] = 67;	rgb[1] = 110;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"RoyalBlue3",10) == 0) {
-		rgb[0] = 58;	rgb[1] = 95;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"RoyalBlue4",10) == 0) {
-		rgb[0] = 39;	rgb[1] = 64;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"blue1",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"blue2",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"blue3",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"blue4",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"DodgerBlue1",11) == 0) {
-		rgb[0] = 30;	rgb[1] = 144;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"DodgerBlue2",11) == 0) {
-		rgb[0] = 28;	rgb[1] = 134;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"DodgerBlue3",11) == 0) {
-		rgb[0] = 24;	rgb[1] = 116;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"DodgerBlue4",11) == 0) {
-		rgb[0] = 16;	rgb[1] = 78;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"SteelBlue1",10) == 0) {
-		rgb[0] = 99;	rgb[1] = 184;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"SteelBlue2",10) == 0) {
-		rgb[0] = 92;	rgb[1] = 172;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"SteelBlue3",10) == 0) {
-		rgb[0] = 79;	rgb[1] = 148;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"SteelBlue4",10) == 0) {
-		rgb[0] = 54;	rgb[1] = 100;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"DeepSkyBlue1",12) == 0) {
-		rgb[0] = 0;	rgb[1] = 191;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"DeepSkyBlue2",12) == 0) {
-		rgb[0] = 0;	rgb[1] = 178;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"DeepSkyBlue3",12) == 0) {
-		rgb[0] = 0;	rgb[1] = 154;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"DeepSkyBlue4",12) == 0) {
-		rgb[0] = 0;	rgb[1] = 104;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"SkyBlue1",8) == 0) {
-		rgb[0] = 135;	rgb[1] = 206;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"SkyBlue2",8) == 0) {
-		rgb[0] = 126;	rgb[1] = 192;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"SkyBlue3",8) == 0) {
-		rgb[0] = 108;	rgb[1] = 166;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"SkyBlue4",8) == 0) {
-		rgb[0] = 74;	rgb[1] = 112;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"LightSkyBlue1",13) == 0) {
-		rgb[0] = 176;	rgb[1] = 226;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"LightSkyBlue2",13) == 0) {
-		rgb[0] = 164;	rgb[1] = 211;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"LightSkyBlue3",13) == 0) {
-		rgb[0] = 141;	rgb[1] = 182;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"LightSkyBlue4",13) == 0) {
-		rgb[0] = 96;	rgb[1] = 123;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"SlateGray1",10) == 0) {
-		rgb[0] = 198;	rgb[1] = 226;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"SlateGray2",10) == 0) {
-		rgb[0] = 185;	rgb[1] = 211;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"SlateGray3",10) == 0) {
-		rgb[0] = 159;	rgb[1] = 182;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"SlateGray4",10) == 0) {
-		rgb[0] = 108;	rgb[1] = 123;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"LightSteelBlue1",15) == 0) {
-		rgb[0] = 202;	rgb[1] = 225;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"LightSteelBlue2",15) == 0) {
-		rgb[0] = 188;	rgb[1] = 210;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"LightSteelBlue3",15) == 0) {
-		rgb[0] = 162;	rgb[1] = 181;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"LightSteelBlue4",15) == 0) {
-		rgb[0] = 110;	rgb[1] = 123;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"LightBlue1",10) == 0) {
-		rgb[0] = 191;	rgb[1] = 239;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"LightBlue2",10) == 0) {
-		rgb[0] = 178;	rgb[1] = 223;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"LightBlue3",10) == 0) {
-		rgb[0] = 154;	rgb[1] = 192;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"LightBlue4",10) == 0) {
-		rgb[0] = 104;	rgb[1] = 131;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"LightCyan1",10) == 0) {
-		rgb[0] = 224;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"LightCyan2",10) == 0) {
-		rgb[0] = 209;	rgb[1] = 238;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"LightCyan3",10) == 0) {
-		rgb[0] = 180;	rgb[1] = 205;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"LightCyan4",10) == 0) {
-		rgb[0] = 122;	rgb[1] = 139;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"PaleTurquoise1",14) == 0) {
-		rgb[0] = 187;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"PaleTurquoise2",14) == 0) {
-		rgb[0] = 174;	rgb[1] = 238;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"PaleTurquoise3",14) == 0) {
-		rgb[0] = 150;	rgb[1] = 205;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"PaleTurquoise4",14) == 0) {
-		rgb[0] = 102;	rgb[1] = 139;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"CadetBlue1",10) == 0) {
-		rgb[0] = 152;	rgb[1] = 245;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"CadetBlue2",10) == 0) {
-		rgb[0] = 142;	rgb[1] = 229;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"CadetBlue3",10) == 0) {
-		rgb[0] = 122;	rgb[1] = 197;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"CadetBlue4",10) == 0) {
-		rgb[0] = 83;	rgb[1] = 134;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"turquoise1",10) == 0) {
-		rgb[0] = 0;	rgb[1] = 245;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"turquoise2",10) == 0) {
-		rgb[0] = 0;	rgb[1] = 229;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"turquoise3",10) == 0) {
-		rgb[0] = 0;	rgb[1] = 197;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"turquoise4",10) == 0) {
-		rgb[0] = 0;	rgb[1] = 134;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"cyan1",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"cyan2",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 238;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"cyan3",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 205;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"cyan4",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 139;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSlateGray1",14) == 0) {
-		rgb[0] = 151;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSlateGray2",14) == 0) {
-		rgb[0] = 141;	rgb[1] = 238;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSlateGray3",14) == 0) {
-		rgb[0] = 121;	rgb[1] = 205;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSlateGray4",14) == 0) {
-		rgb[0] = 82;	rgb[1] = 139;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"aquamarine1",11) == 0) {
-		rgb[0] = 127;	rgb[1] = 255;	rgb[2] = 212;
-	}
-	else if (strncasecmp(x11ColourName,"aquamarine2",11) == 0) {
-		rgb[0] = 118;	rgb[1] = 238;	rgb[2] = 198;
-	}
-	else if (strncasecmp(x11ColourName,"aquamarine3",11) == 0) {
-		rgb[0] = 102;	rgb[1] = 205;	rgb[2] = 170;
-	}
-	else if (strncasecmp(x11ColourName,"aquamarine4",11) == 0) {
-		rgb[0] = 69;	rgb[1] = 139;	rgb[2] = 116;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSeaGreen1",13) == 0) {
-		rgb[0] = 193;	rgb[1] = 255;	rgb[2] = 193;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSeaGreen2",13) == 0) {
-		rgb[0] = 180;	rgb[1] = 238;	rgb[2] = 180;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSeaGreen3",13) == 0) {
-		rgb[0] = 155;	rgb[1] = 205;	rgb[2] = 155;
-	}
-	else if (strncasecmp(x11ColourName,"DarkSeaGreen4",13) == 0) {
-		rgb[0] = 105;	rgb[1] = 139;	rgb[2] = 105;
-	}
-	else if (strncasecmp(x11ColourName,"SeaGreen1",9) == 0) {
-		rgb[0] = 84;	rgb[1] = 255;	rgb[2] = 159;
-	}
-	else if (strncasecmp(x11ColourName,"SeaGreen2",9) == 0) {
-		rgb[0] = 78;	rgb[1] = 238;	rgb[2] = 148;
-	}
-	else if (strncasecmp(x11ColourName,"SeaGreen3",9) == 0) {
-		rgb[0] = 67;	rgb[1] = 205;	rgb[2] = 128;
-	}
-	else if (strncasecmp(x11ColourName,"SeaGreen4",9) == 0) {
-		rgb[0] = 46;	rgb[1] = 139;	rgb[2] = 87;
-	}
-	else if (strncasecmp(x11ColourName,"PaleGreen1",10) == 0) {
-		rgb[0] = 154;	rgb[1] = 255;	rgb[2] = 154;
-	}
-	else if (strncasecmp(x11ColourName,"PaleGreen2",10) == 0) {
-		rgb[0] = 144;	rgb[1] = 238;	rgb[2] = 144;
-	}
-	else if (strncasecmp(x11ColourName,"PaleGreen3",10) == 0) {
-		rgb[0] = 124;	rgb[1] = 205;	rgb[2] = 124;
-	}
-	else if (strncasecmp(x11ColourName,"PaleGreen4",10) == 0) {
-		rgb[0] = 84;	rgb[1] = 139;	rgb[2] = 84;
-	}
-	else if (strncasecmp(x11ColourName,"SpringGreen1",12) == 0) {
-		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 127;
-	}
-	else if (strncasecmp(x11ColourName,"SpringGreen2",12) == 0) {
-		rgb[0] = 0;	rgb[1] = 238;	rgb[2] = 118;
-	}
-	else if (strncasecmp(x11ColourName,"SpringGreen3",12) == 0) {
-		rgb[0] = 0;	rgb[1] = 205;	rgb[2] = 102;
-	}
-	else if (strncasecmp(x11ColourName,"SpringGreen4",12) == 0) {
-		rgb[0] = 0;	rgb[1] = 139;	rgb[2] = 69;
-	}
-	else if (strncasecmp(x11ColourName,"green1",6) == 0) {
-		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"green2",6) == 0) {
-		rgb[0] = 0;	rgb[1] = 238;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"green3",6) == 0) {
-		rgb[0] = 0;	rgb[1] = 205;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"green4",6) == 0) {
-		rgb[0] = 0;	rgb[1] = 139;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"chartreuse1",11) == 0) {
-		rgb[0] = 127;	rgb[1] = 255;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"chartreuse2",11) == 0) {
-		rgb[0] = 118;	rgb[1] = 238;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"chartreuse3",11) == 0) {
-		rgb[0] = 102;	rgb[1] = 205;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"chartreuse4",11) == 0) {
-		rgb[0] = 69;	rgb[1] = 139;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"OliveDrab1",10) == 0) {
-		rgb[0] = 192;	rgb[1] = 255;	rgb[2] = 62;
-	}
-	else if (strncasecmp(x11ColourName,"OliveDrab2",10) == 0) {
-		rgb[0] = 179;	rgb[1] = 238;	rgb[2] = 58;
-	}
-	else if (strncasecmp(x11ColourName,"OliveDrab3",10) == 0) {
-		rgb[0] = 154;	rgb[1] = 205;	rgb[2] = 50;
-	}
-	else if (strncasecmp(x11ColourName,"OliveDrab4",10) == 0) {
-		rgb[0] = 105;	rgb[1] = 139;	rgb[2] = 34;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOliveGreen1",15) == 0) {
-		rgb[0] = 202;	rgb[1] = 255;	rgb[2] = 112;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOliveGreen2",15) == 0) {
-		rgb[0] = 188;	rgb[1] = 238;	rgb[2] = 104;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOliveGreen3",15) == 0) {
-		rgb[0] = 162;	rgb[1] = 205;	rgb[2] = 90;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOliveGreen4",15) == 0) {
-		rgb[0] = 110;	rgb[1] = 139;	rgb[2] = 61;
-	}
-	else if (strncasecmp(x11ColourName,"khaki1",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 246;	rgb[2] = 143;
-	}
-	else if (strncasecmp(x11ColourName,"khaki2",6) == 0) {
-		rgb[0] = 238;	rgb[1] = 230;	rgb[2] = 133;
-	}
-	else if (strncasecmp(x11ColourName,"khaki3",6) == 0) {
-		rgb[0] = 205;	rgb[1] = 198;	rgb[2] = 115;
-	}
-	else if (strncasecmp(x11ColourName,"khaki4",6) == 0) {
-		rgb[0] = 139;	rgb[1] = 134;	rgb[2] = 78;
-	}
-	else if (strncasecmp(x11ColourName,"LightGoldenrod1",15) == 0) {
-		rgb[0] = 255;	rgb[1] = 236;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"LightGoldenrod2",15) == 0) {
-		rgb[0] = 238;	rgb[1] = 220;	rgb[2] = 130;
-	}
-	else if (strncasecmp(x11ColourName,"LightGoldenrod3",15) == 0) {
-		rgb[0] = 205;	rgb[1] = 190;	rgb[2] = 112;
-	}
-	else if (strncasecmp(x11ColourName,"LightGoldenrod4",15) == 0) {
-		rgb[0] = 139;	rgb[1] = 129;	rgb[2] = 76;
-	}
-	else if (strncasecmp(x11ColourName,"LightYellow1",12) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 224;
-	}
-	else if (strncasecmp(x11ColourName,"LightYellow2",12) == 0) {
-		rgb[0] = 238;	rgb[1] = 238;	rgb[2] = 209;
-	}
-	else if (strncasecmp(x11ColourName,"LightYellow3",12) == 0) {
-		rgb[0] = 205;	rgb[1] = 205;	rgb[2] = 180;
-	}
-	else if (strncasecmp(x11ColourName,"LightYellow4",12) == 0) {
-		rgb[0] = 139;	rgb[1] = 139;	rgb[2] = 122;
-	}
-	else if (strncasecmp(x11ColourName,"yellow1",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"yellow2",7) == 0) {
-		rgb[0] = 238;	rgb[1] = 238;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"yellow3",7) == 0) {
-		rgb[0] = 205;	rgb[1] = 205;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"yellow4",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 139;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"gold1",5) == 0) {
-		rgb[0] = 255;	rgb[1] = 215;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"gold2",5) == 0) {
-		rgb[0] = 238;	rgb[1] = 201;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"gold3",5) == 0) {
-		rgb[0] = 205;	rgb[1] = 173;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"gold4",5) == 0) {
-		rgb[0] = 139;	rgb[1] = 117;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"goldenrod1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 193;	rgb[2] = 37;
-	}
-	else if (strncasecmp(x11ColourName,"goldenrod2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 180;	rgb[2] = 34;
-	}
-	else if (strncasecmp(x11ColourName,"goldenrod3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 155;	rgb[2] = 29;
-	}
-	else if (strncasecmp(x11ColourName,"goldenrod4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 105;	rgb[2] = 20;
-	}
-	else if (strncasecmp(x11ColourName,"DarkGoldenrod1",14) == 0) {
-		rgb[0] = 255;	rgb[1] = 185;	rgb[2] = 15;
-	}
-	else if (strncasecmp(x11ColourName,"DarkGoldenrod2",14) == 0) {
-		rgb[0] = 238;	rgb[1] = 173;	rgb[2] = 14;
-	}
-	else if (strncasecmp(x11ColourName,"DarkGoldenrod3",14) == 0) {
-		rgb[0] = 205;	rgb[1] = 149;	rgb[2] = 12;
-	}
-	else if (strncasecmp(x11ColourName,"DarkGoldenrod4",14) == 0) {
-		rgb[0] = 139;	rgb[1] = 101;	rgb[2] = 8;
-	}
-	else if (strncasecmp(x11ColourName,"RosyBrown1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 193;	rgb[2] = 193;
-	}
-	else if (strncasecmp(x11ColourName,"RosyBrown2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 180;	rgb[2] = 180;
-	}
-	else if (strncasecmp(x11ColourName,"RosyBrown3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 155;	rgb[2] = 155;
-	}
-	else if (strncasecmp(x11ColourName,"RosyBrown4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 105;	rgb[2] = 105;
-	}
-	else if (strncasecmp(x11ColourName,"IndianRed1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 106;	rgb[2] = 106;
-	}
-	else if (strncasecmp(x11ColourName,"IndianRed2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 99;	rgb[2] = 99;
-	}
-	else if (strncasecmp(x11ColourName,"IndianRed3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 85;	rgb[2] = 85;
-	}
-	else if (strncasecmp(x11ColourName,"IndianRed4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 58;	rgb[2] = 58;
-	}
-	else if (strncasecmp(x11ColourName,"sienna1",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 130;	rgb[2] = 71;
-	}
-	else if (strncasecmp(x11ColourName,"sienna2",7) == 0) {
-		rgb[0] = 238;	rgb[1] = 121;	rgb[2] = 66;
-	}
-	else if (strncasecmp(x11ColourName,"sienna3",7) == 0) {
-		rgb[0] = 205;	rgb[1] = 104;	rgb[2] = 57;
-	}
-	else if (strncasecmp(x11ColourName,"sienna4",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 71;	rgb[2] = 38;
-	}
-	else if (strncasecmp(x11ColourName,"burlywood1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 211;	rgb[2] = 155;
-	}
-	else if (strncasecmp(x11ColourName,"burlywood2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 197;	rgb[2] = 145;
-	}
-	else if (strncasecmp(x11ColourName,"burlywood3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 170;	rgb[2] = 125;
-	}
-	else if (strncasecmp(x11ColourName,"burlywood4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 115;	rgb[2] = 85;
-	}
-	else if (strncasecmp(x11ColourName,"wheat1",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 231;	rgb[2] = 186;
-	}
-	else if (strncasecmp(x11ColourName,"wheat2",6) == 0) {
-		rgb[0] = 238;	rgb[1] = 216;	rgb[2] = 174;
-	}
-	else if (strncasecmp(x11ColourName,"wheat3",6) == 0) {
-		rgb[0] = 205;	rgb[1] = 186;	rgb[2] = 150;
-	}
-	else if (strncasecmp(x11ColourName,"wheat4",6) == 0) {
-		rgb[0] = 139;	rgb[1] = 126;	rgb[2] = 102;
-	}
-	else if (strncasecmp(x11ColourName,"tan1",4) == 0) {
-		rgb[0] = 255;	rgb[1] = 165;	rgb[2] = 79;
-	}
-	else if (strncasecmp(x11ColourName,"tan2",4) == 0) {
-		rgb[0] = 238;	rgb[1] = 154;	rgb[2] = 73;
-	}
-	else if (strncasecmp(x11ColourName,"tan3",4) == 0) {
-		rgb[0] = 205;	rgb[1] = 133;	rgb[2] = 63;
-	}
-	else if (strncasecmp(x11ColourName,"tan4",4) == 0) {
-		rgb[0] = 139;	rgb[1] = 90;	rgb[2] = 43;
-	}
-	else if (strncasecmp(x11ColourName,"chocolate1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 127;	rgb[2] = 36;
-	}
-	else if (strncasecmp(x11ColourName,"chocolate2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 118;	rgb[2] = 33;
-	}
-	else if (strncasecmp(x11ColourName,"chocolate3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 102;	rgb[2] = 29;
-	}
-	else if (strncasecmp(x11ColourName,"chocolate4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 69;	rgb[2] = 19;
-	}
-	else if (strncasecmp(x11ColourName,"firebrick1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 48;	rgb[2] = 48;
-	}
-	else if (strncasecmp(x11ColourName,"firebrick2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 44;	rgb[2] = 44;
-	}
-	else if (strncasecmp(x11ColourName,"firebrick3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 38;	rgb[2] = 38;
-	}
-	else if (strncasecmp(x11ColourName,"firebrick4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 26;	rgb[2] = 26;
-	}
-	else if (strncasecmp(x11ColourName,"brown1",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 64;	rgb[2] = 64;
-	}
-	else if (strncasecmp(x11ColourName,"brown2",6) == 0) {
-		rgb[0] = 238;	rgb[1] = 59;	rgb[2] = 59;
-	}
-	else if (strncasecmp(x11ColourName,"brown3",6) == 0) {
-		rgb[0] = 205;	rgb[1] = 51;	rgb[2] = 51;
-	}
-	else if (strncasecmp(x11ColourName,"brown4",6) == 0) {
-		rgb[0] = 139;	rgb[1] = 35;	rgb[2] = 35;
-	}
-	else if (strncasecmp(x11ColourName,"salmon1",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 140;	rgb[2] = 105;
-	}
-	else if (strncasecmp(x11ColourName,"salmon2",7) == 0) {
-		rgb[0] = 238;	rgb[1] = 130;	rgb[2] = 98;
-	}
-	else if (strncasecmp(x11ColourName,"salmon3",7) == 0) {
-		rgb[0] = 205;	rgb[1] = 112;	rgb[2] = 84;
-	}
-	else if (strncasecmp(x11ColourName,"salmon4",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 76;	rgb[2] = 57;
-	}
-	else if (strncasecmp(x11ColourName,"LightSalmon1",12) == 0) {
-		rgb[0] = 255;	rgb[1] = 160;	rgb[2] = 122;
-	}
-	else if (strncasecmp(x11ColourName,"LightSalmon2",12) == 0) {
-		rgb[0] = 238;	rgb[1] = 149;	rgb[2] = 114;
-	}
-	else if (strncasecmp(x11ColourName,"LightSalmon3",12) == 0) {
-		rgb[0] = 205;	rgb[1] = 129;	rgb[2] = 98;
-	}
-	else if (strncasecmp(x11ColourName,"LightSalmon4",12) == 0) {
-		rgb[0] = 139;	rgb[1] = 87;	rgb[2] = 66;
-	}
-	else if (strncasecmp(x11ColourName,"orange1",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 165;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"orange2",7) == 0) {
-		rgb[0] = 238;	rgb[1] = 154;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"orange3",7) == 0) {
-		rgb[0] = 205;	rgb[1] = 133;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"orange4",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 90;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrange1",11) == 0) {
-		rgb[0] = 255;	rgb[1] = 127;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrange2",11) == 0) {
-		rgb[0] = 238;	rgb[1] = 118;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrange3",11) == 0) {
-		rgb[0] = 205;	rgb[1] = 102;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrange4",11) == 0) {
-		rgb[0] = 139;	rgb[1] = 69;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"coral1",6) == 0) {
-		rgb[0] = 255;	rgb[1] = 114;	rgb[2] = 86;
-	}
-	else if (strncasecmp(x11ColourName,"coral2",6) == 0) {
-		rgb[0] = 238;	rgb[1] = 106;	rgb[2] = 80;
-	}
-	else if (strncasecmp(x11ColourName,"coral3",6) == 0) {
-		rgb[0] = 205;	rgb[1] = 91;	rgb[2] = 69;
-	}
-	else if (strncasecmp(x11ColourName,"coral4",6) == 0) {
-		rgb[0] = 139;	rgb[1] = 62;	rgb[2] = 47;
-	}
-	else if (strncasecmp(x11ColourName,"tomato1",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 99;	rgb[2] = 71;
-	}
-	else if (strncasecmp(x11ColourName,"tomato2",7) == 0) {
-		rgb[0] = 238;	rgb[1] = 92;	rgb[2] = 66;
-	}
-	else if (strncasecmp(x11ColourName,"tomato3",7) == 0) {
-		rgb[0] = 205;	rgb[1] = 79;	rgb[2] = 57;
-	}
-	else if (strncasecmp(x11ColourName,"tomato4",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 54;	rgb[2] = 38;
-	}
-	else if (strncasecmp(x11ColourName,"OrangeRed1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 69;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"OrangeRed2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 64;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"OrangeRed3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 55;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"OrangeRed4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 37;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"red1",4) == 0) {
-		rgb[0] = 255;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"red2",4) == 0) {
-		rgb[0] = 238;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"red3",4) == 0) {
-		rgb[0] = 205;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"red4",4) == 0) {
-		rgb[0] = 139;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"DeepPink1",9) == 0) {
-		rgb[0] = 255;	rgb[1] = 20;	rgb[2] = 147;
-	}
-	else if (strncasecmp(x11ColourName,"DeepPink2",9) == 0) {
-		rgb[0] = 238;	rgb[1] = 18;	rgb[2] = 137;
-	}
-	else if (strncasecmp(x11ColourName,"DeepPink3",9) == 0) {
-		rgb[0] = 205;	rgb[1] = 16;	rgb[2] = 118;
-	}
-	else if (strncasecmp(x11ColourName,"DeepPink4",9) == 0) {
-		rgb[0] = 139;	rgb[1] = 10;	rgb[2] = 80;
-	}
-	else if (strncasecmp(x11ColourName,"HotPink1",8) == 0) {
-		rgb[0] = 255;	rgb[1] = 110;	rgb[2] = 180;
-	}
-	else if (strncasecmp(x11ColourName,"HotPink2",8) == 0) {
-		rgb[0] = 238;	rgb[1] = 106;	rgb[2] = 167;
-	}
-	else if (strncasecmp(x11ColourName,"HotPink3",8) == 0) {
-		rgb[0] = 205;	rgb[1] = 96;	rgb[2] = 144;
-	}
-	else if (strncasecmp(x11ColourName,"HotPink4",8) == 0) {
-		rgb[0] = 139;	rgb[1] = 58;	rgb[2] = 98;
-	}
-	else if (strncasecmp(x11ColourName,"pink1",5) == 0) {
-		rgb[0] = 255;	rgb[1] = 181;	rgb[2] = 197;
-	}
-	else if (strncasecmp(x11ColourName,"pink2",5) == 0) {
-		rgb[0] = 238;	rgb[1] = 169;	rgb[2] = 184;
-	}
-	else if (strncasecmp(x11ColourName,"pink3",5) == 0) {
-		rgb[0] = 205;	rgb[1] = 145;	rgb[2] = 158;
-	}
-	else if (strncasecmp(x11ColourName,"pink4",5) == 0) {
-		rgb[0] = 139;	rgb[1] = 99;	rgb[2] = 108;
-	}
-	else if (strncasecmp(x11ColourName,"LightPink1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 174;	rgb[2] = 185;
-	}
-	else if (strncasecmp(x11ColourName,"LightPink2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 162;	rgb[2] = 173;
-	}
-	else if (strncasecmp(x11ColourName,"LightPink3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 140;	rgb[2] = 149;
-	}
-	else if (strncasecmp(x11ColourName,"LightPink4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 95;	rgb[2] = 101;
-	}
-	else if (strncasecmp(x11ColourName,"PaleVioletRed1",14) == 0) {
-		rgb[0] = 255;	rgb[1] = 130;	rgb[2] = 171;
-	}
-	else if (strncasecmp(x11ColourName,"PaleVioletRed2",14) == 0) {
-		rgb[0] = 238;	rgb[1] = 121;	rgb[2] = 159;
-	}
-	else if (strncasecmp(x11ColourName,"PaleVioletRed3",14) == 0) {
-		rgb[0] = 205;	rgb[1] = 104;	rgb[2] = 137;
-	}
-	else if (strncasecmp(x11ColourName,"PaleVioletRed4",14) == 0) {
-		rgb[0] = 139;	rgb[1] = 71;	rgb[2] = 93;
-	}
-	else if (strncasecmp(x11ColourName,"maroon1",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 52;	rgb[2] = 179;
-	}
-	else if (strncasecmp(x11ColourName,"maroon2",7) == 0) {
-		rgb[0] = 238;	rgb[1] = 48;	rgb[2] = 167;
-	}
-	else if (strncasecmp(x11ColourName,"maroon3",7) == 0) {
-		rgb[0] = 205;	rgb[1] = 41;	rgb[2] = 144;
-	}
-	else if (strncasecmp(x11ColourName,"maroon4",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 28;	rgb[2] = 98;
-	}
-	else if (strncasecmp(x11ColourName,"VioletRed1",10) == 0) {
-		rgb[0] = 255;	rgb[1] = 62;	rgb[2] = 150;
-	}
-	else if (strncasecmp(x11ColourName,"VioletRed2",10) == 0) {
-		rgb[0] = 238;	rgb[1] = 58;	rgb[2] = 140;
-	}
-	else if (strncasecmp(x11ColourName,"VioletRed3",10) == 0) {
-		rgb[0] = 205;	rgb[1] = 50;	rgb[2] = 120;
-	}
-	else if (strncasecmp(x11ColourName,"VioletRed4",10) == 0) {
-		rgb[0] = 139;	rgb[1] = 34;	rgb[2] = 82;
-	}
-	else if (strncasecmp(x11ColourName,"magenta1",8) == 0) {
-		rgb[0] = 255;	rgb[1] = 0;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"magenta2",8) == 0) {
-		rgb[0] = 238;	rgb[1] = 0;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"magenta3",8) == 0) {
-		rgb[0] = 205;	rgb[1] = 0;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"magenta4",8) == 0) {
-		rgb[0] = 139;	rgb[1] = 0;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"orchid1",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 131;	rgb[2] = 250;
-	}
-	else if (strncasecmp(x11ColourName,"orchid2",7) == 0) {
-		rgb[0] = 238;	rgb[1] = 122;	rgb[2] = 233;
-	}
-	else if (strncasecmp(x11ColourName,"orchid3",7) == 0) {
-		rgb[0] = 205;	rgb[1] = 105;	rgb[2] = 201;
-	}
-	else if (strncasecmp(x11ColourName,"orchid4",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 71;	rgb[2] = 137;
-	}
-	else if (strncasecmp(x11ColourName,"plum1",5) == 0) {
-		rgb[0] = 255;	rgb[1] = 187;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"plum2",5) == 0) {
-		rgb[0] = 238;	rgb[1] = 174;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"plum3",5) == 0) {
-		rgb[0] = 205;	rgb[1] = 150;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"plum4",5) == 0) {
-		rgb[0] = 139;	rgb[1] = 102;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"MediumOrchid1",13) == 0) {
-		rgb[0] = 224;	rgb[1] = 102;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"MediumOrchid2",13) == 0) {
-		rgb[0] = 209;	rgb[1] = 95;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"MediumOrchid3",13) == 0) {
-		rgb[0] = 180;	rgb[1] = 82;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"MediumOrchid4",13) == 0) {
-		rgb[0] = 122;	rgb[1] = 55;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrchid1",11) == 0) {
-		rgb[0] = 191;	rgb[1] = 62;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrchid2",11) == 0) {
-		rgb[0] = 178;	rgb[1] = 58;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrchid3",11) == 0) {
-		rgb[0] = 154;	rgb[1] = 50;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"DarkOrchid4",11) == 0) {
-		rgb[0] = 104;	rgb[1] = 34;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"purple1",7) == 0) {
-		rgb[0] = 155;	rgb[1] = 48;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"purple2",7) == 0) {
-		rgb[0] = 145;	rgb[1] = 44;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"purple3",7) == 0) {
-		rgb[0] = 125;	rgb[1] = 38;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"purple4",7) == 0) {
-		rgb[0] = 85;	rgb[1] = 26;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"MediumPurple1",13) == 0) {
-		rgb[0] = 171;	rgb[1] = 130;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"MediumPurple2",13) == 0) {
-		rgb[0] = 159;	rgb[1] = 121;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"MediumPurple3",13) == 0) {
-		rgb[0] = 137;	rgb[1] = 104;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"MediumPurple4",13) == 0) {
-		rgb[0] = 93;	rgb[1] = 71;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"thistle1",8) == 0) {
-		rgb[0] = 255;	rgb[1] = 225;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"thistle2",8) == 0) {
-		rgb[0] = 238;	rgb[1] = 210;	rgb[2] = 238;
-	}
-	else if (strncasecmp(x11ColourName,"thistle3",8) == 0) {
-		rgb[0] = 205;	rgb[1] = 181;	rgb[2] = 205;
-	}
-	else if (strncasecmp(x11ColourName,"thistle4",8) == 0) {
-		rgb[0] = 139;	rgb[1] = 123;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"gray0",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"grey0",5) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"gray1",5) == 0) {
-		rgb[0] = 3;	rgb[1] = 3;	rgb[2] = 3;
-	}
-	else if (strncasecmp(x11ColourName,"grey1",5) == 0) {
-		rgb[0] = 3;	rgb[1] = 3;	rgb[2] = 3;
-	}
-	else if (strncasecmp(x11ColourName,"gray2",5) == 0) {
-		rgb[0] = 5;	rgb[1] = 5;	rgb[2] = 5;
-	}
-	else if (strncasecmp(x11ColourName,"grey2",5) == 0) {
-		rgb[0] = 5;	rgb[1] = 5;	rgb[2] = 5;
-	}
-	else if (strncasecmp(x11ColourName,"gray3",5) == 0) {
-		rgb[0] = 8;	rgb[1] = 8;	rgb[2] = 8;
-	}
-	else if (strncasecmp(x11ColourName,"grey3",5) == 0) {
-		rgb[0] = 8;	rgb[1] = 8;	rgb[2] = 8;
-	}
-	else if (strncasecmp(x11ColourName,"gray4",5) == 0) {
-		rgb[0] = 10;	rgb[1] = 10;	rgb[2] = 10;
-	}
-	else if (strncasecmp(x11ColourName,"grey4",5) == 0) {
-		rgb[0] = 10;	rgb[1] = 10;	rgb[2] = 10;
-	}
-	else if (strncasecmp(x11ColourName,"gray5",5) == 0) {
-		rgb[0] = 13;	rgb[1] = 13;	rgb[2] = 13;
-	}
-	else if (strncasecmp(x11ColourName,"grey5",5) == 0) {
-		rgb[0] = 13;	rgb[1] = 13;	rgb[2] = 13;
-	}
-	else if (strncasecmp(x11ColourName,"gray6",5) == 0) {
-		rgb[0] = 15;	rgb[1] = 15;	rgb[2] = 15;
-	}
-	else if (strncasecmp(x11ColourName,"grey6",5) == 0) {
-		rgb[0] = 15;	rgb[1] = 15;	rgb[2] = 15;
-	}
-	else if (strncasecmp(x11ColourName,"gray7",5) == 0) {
-		rgb[0] = 18;	rgb[1] = 18;	rgb[2] = 18;
-	}
-	else if (strncasecmp(x11ColourName,"grey7",5) == 0) {
-		rgb[0] = 18;	rgb[1] = 18;	rgb[2] = 18;
-	}
-	else if (strncasecmp(x11ColourName,"gray8",5) == 0) {
-		rgb[0] = 20;	rgb[1] = 20;	rgb[2] = 20;
-	}
-	else if (strncasecmp(x11ColourName,"grey8",5) == 0) {
-		rgb[0] = 20;	rgb[1] = 20;	rgb[2] = 20;
-	}
-	else if (strncasecmp(x11ColourName,"gray9",5) == 0) {
-		rgb[0] = 23;	rgb[1] = 23;	rgb[2] = 23;
-	}
-	else if (strncasecmp(x11ColourName,"grey9",5) == 0) {
-		rgb[0] = 23;	rgb[1] = 23;	rgb[2] = 23;
-	}
-	else if (strncasecmp(x11ColourName,"gray10",6) == 0) {
-		rgb[0] = 26;	rgb[1] = 26;	rgb[2] = 26;
-	}
-	else if (strncasecmp(x11ColourName,"grey10",6) == 0) {
-		rgb[0] = 26;	rgb[1] = 26;	rgb[2] = 26;
-	}
-	else if (strncasecmp(x11ColourName,"gray11",6) == 0) {
-		rgb[0] = 28;	rgb[1] = 28;	rgb[2] = 28;
-	}
-	else if (strncasecmp(x11ColourName,"grey11",6) == 0) {
-		rgb[0] = 28;	rgb[1] = 28;	rgb[2] = 28;
-	}
-	else if (strncasecmp(x11ColourName,"gray12",6) == 0) {
-		rgb[0] = 31;	rgb[1] = 31;	rgb[2] = 31;
-	}
-	else if (strncasecmp(x11ColourName,"grey12",6) == 0) {
-		rgb[0] = 31;	rgb[1] = 31;	rgb[2] = 31;
-	}
-	else if (strncasecmp(x11ColourName,"gray13",6) == 0) {
-		rgb[0] = 33;	rgb[1] = 33;	rgb[2] = 33;
-	}
-	else if (strncasecmp(x11ColourName,"grey13",6) == 0) {
-		rgb[0] = 33;	rgb[1] = 33;	rgb[2] = 33;
-	}
-	else if (strncasecmp(x11ColourName,"gray14",6) == 0) {
-		rgb[0] = 36;	rgb[1] = 36;	rgb[2] = 36;
-	}
-	else if (strncasecmp(x11ColourName,"grey14",6) == 0) {
-		rgb[0] = 36;	rgb[1] = 36;	rgb[2] = 36;
-	}
-	else if (strncasecmp(x11ColourName,"gray15",6) == 0) {
-		rgb[0] = 38;	rgb[1] = 38;	rgb[2] = 38;
-	}
-	else if (strncasecmp(x11ColourName,"grey15",6) == 0) {
-		rgb[0] = 38;	rgb[1] = 38;	rgb[2] = 38;
-	}
-	else if (strncasecmp(x11ColourName,"gray16",6) == 0) {
-		rgb[0] = 41;	rgb[1] = 41;	rgb[2] = 41;
-	}
-	else if (strncasecmp(x11ColourName,"grey16",6) == 0) {
-		rgb[0] = 41;	rgb[1] = 41;	rgb[2] = 41;
-	}
-	else if (strncasecmp(x11ColourName,"gray17",6) == 0) {
-		rgb[0] = 43;	rgb[1] = 43;	rgb[2] = 43;
-	}
-	else if (strncasecmp(x11ColourName,"grey17",6) == 0) {
-		rgb[0] = 43;	rgb[1] = 43;	rgb[2] = 43;
-	}
-	else if (strncasecmp(x11ColourName,"gray18",6) == 0) {
-		rgb[0] = 46;	rgb[1] = 46;	rgb[2] = 46;
-	}
-	else if (strncasecmp(x11ColourName,"grey18",6) == 0) {
-		rgb[0] = 46;	rgb[1] = 46;	rgb[2] = 46;
-	}
-	else if (strncasecmp(x11ColourName,"gray19",6) == 0) {
-		rgb[0] = 48;	rgb[1] = 48;	rgb[2] = 48;
-	}
-	else if (strncasecmp(x11ColourName,"grey19",6) == 0) {
-		rgb[0] = 48;	rgb[1] = 48;	rgb[2] = 48;
-	}
-	else if (strncasecmp(x11ColourName,"gray20",6) == 0) {
-		rgb[0] = 51;	rgb[1] = 51;	rgb[2] = 51;
-	}
-	else if (strncasecmp(x11ColourName,"grey20",6) == 0) {
-		rgb[0] = 51;	rgb[1] = 51;	rgb[2] = 51;
-	}
-	else if (strncasecmp(x11ColourName,"gray21",6) == 0) {
-		rgb[0] = 54;	rgb[1] = 54;	rgb[2] = 54;
-	}
-	else if (strncasecmp(x11ColourName,"grey21",6) == 0) {
-		rgb[0] = 54;	rgb[1] = 54;	rgb[2] = 54;
-	}
-	else if (strncasecmp(x11ColourName,"gray22",6) == 0) {
-		rgb[0] = 56;	rgb[1] = 56;	rgb[2] = 56;
-	}
-	else if (strncasecmp(x11ColourName,"grey22",6) == 0) {
-		rgb[0] = 56;	rgb[1] = 56;	rgb[2] = 56;
-	}
-	else if (strncasecmp(x11ColourName,"gray23",6) == 0) {
-		rgb[0] = 59;	rgb[1] = 59;	rgb[2] = 59;
-	}
-	else if (strncasecmp(x11ColourName,"grey23",6) == 0) {
-		rgb[0] = 59;	rgb[1] = 59;	rgb[2] = 59;
-	}
-	else if (strncasecmp(x11ColourName,"gray24",6) == 0) {
-		rgb[0] = 61;	rgb[1] = 61;	rgb[2] = 61;
-	}
-	else if (strncasecmp(x11ColourName,"grey24",6) == 0) {
-		rgb[0] = 61;	rgb[1] = 61;	rgb[2] = 61;
-	}
-	else if (strncasecmp(x11ColourName,"gray25",6) == 0) {
-		rgb[0] = 64;	rgb[1] = 64;	rgb[2] = 64;
-	}
-	else if (strncasecmp(x11ColourName,"grey25",6) == 0) {
-		rgb[0] = 64;	rgb[1] = 64;	rgb[2] = 64;
-	}
-	else if (strncasecmp(x11ColourName,"gray26",6) == 0) {
-		rgb[0] = 66;	rgb[1] = 66;	rgb[2] = 66;
-	}
-	else if (strncasecmp(x11ColourName,"grey26",6) == 0) {
-		rgb[0] = 66;	rgb[1] = 66;	rgb[2] = 66;
-	}
-	else if (strncasecmp(x11ColourName,"gray27",6) == 0) {
-		rgb[0] = 69;	rgb[1] = 69;	rgb[2] = 69;
-	}
-	else if (strncasecmp(x11ColourName,"grey27",6) == 0) {
-		rgb[0] = 69;	rgb[1] = 69;	rgb[2] = 69;
-	}
-	else if (strncasecmp(x11ColourName,"gray28",6) == 0) {
-		rgb[0] = 71;	rgb[1] = 71;	rgb[2] = 71;
-	}
-	else if (strncasecmp(x11ColourName,"grey28",6) == 0) {
-		rgb[0] = 71;	rgb[1] = 71;	rgb[2] = 71;
-	}
-	else if (strncasecmp(x11ColourName,"gray29",6) == 0) {
-		rgb[0] = 74;	rgb[1] = 74;	rgb[2] = 74;
-	}
-	else if (strncasecmp(x11ColourName,"grey29",6) == 0) {
-		rgb[0] = 74;	rgb[1] = 74;	rgb[2] = 74;
-	}
-	else if (strncasecmp(x11ColourName,"gray30",6) == 0) {
-		rgb[0] = 77;	rgb[1] = 77;	rgb[2] = 77;
-	}
-	else if (strncasecmp(x11ColourName,"grey30",6) == 0) {
-		rgb[0] = 77;	rgb[1] = 77;	rgb[2] = 77;
-	}
-	else if (strncasecmp(x11ColourName,"gray31",6) == 0) {
-		rgb[0] = 79;	rgb[1] = 79;	rgb[2] = 79;
-	}
-	else if (strncasecmp(x11ColourName,"grey31",6) == 0) {
-		rgb[0] = 79;	rgb[1] = 79;	rgb[2] = 79;
-	}
-	else if (strncasecmp(x11ColourName,"gray32",6) == 0) {
-		rgb[0] = 82;	rgb[1] = 82;	rgb[2] = 82;
-	}
-	else if (strncasecmp(x11ColourName,"grey32",6) == 0) {
-		rgb[0] = 82;	rgb[1] = 82;	rgb[2] = 82;
-	}
-	else if (strncasecmp(x11ColourName,"gray33",6) == 0) {
-		rgb[0] = 84;	rgb[1] = 84;	rgb[2] = 84;
-	}
-	else if (strncasecmp(x11ColourName,"grey33",6) == 0) {
-		rgb[0] = 84;	rgb[1] = 84;	rgb[2] = 84;
-	}
-	else if (strncasecmp(x11ColourName,"gray34",6) == 0) {
-		rgb[0] = 87;	rgb[1] = 87;	rgb[2] = 87;
-	}
-	else if (strncasecmp(x11ColourName,"grey34",6) == 0) {
-		rgb[0] = 87;	rgb[1] = 87;	rgb[2] = 87;
-	}
-	else if (strncasecmp(x11ColourName,"gray35",6) == 0) {
-		rgb[0] = 89;	rgb[1] = 89;	rgb[2] = 89;
-	}
-	else if (strncasecmp(x11ColourName,"grey35",6) == 0) {
-		rgb[0] = 89;	rgb[1] = 89;	rgb[2] = 89;
-	}
-	else if (strncasecmp(x11ColourName,"gray36",6) == 0) {
-		rgb[0] = 92;	rgb[1] = 92;	rgb[2] = 92;
-	}
-	else if (strncasecmp(x11ColourName,"grey36",6) == 0) {
-		rgb[0] = 92;	rgb[1] = 92;	rgb[2] = 92;
-	}
-	else if (strncasecmp(x11ColourName,"gray37",6) == 0) {
-		rgb[0] = 94;	rgb[1] = 94;	rgb[2] = 94;
-	}
-	else if (strncasecmp(x11ColourName,"grey37",6) == 0) {
-		rgb[0] = 94;	rgb[1] = 94;	rgb[2] = 94;
-	}
-	else if (strncasecmp(x11ColourName,"gray38",6) == 0) {
-		rgb[0] = 97;	rgb[1] = 97;	rgb[2] = 97;
-	}
-	else if (strncasecmp(x11ColourName,"grey38",6) == 0) {
-		rgb[0] = 97;	rgb[1] = 97;	rgb[2] = 97;
-	}
-	else if (strncasecmp(x11ColourName,"gray39",6) == 0) {
-		rgb[0] = 99;	rgb[1] = 99;	rgb[2] = 99;
-	}
-	else if (strncasecmp(x11ColourName,"grey39",6) == 0) {
-		rgb[0] = 99;	rgb[1] = 99;	rgb[2] = 99;
-	}
-	else if (strncasecmp(x11ColourName,"gray40",6) == 0) {
-		rgb[0] = 102;	rgb[1] = 102;	rgb[2] = 102;
-	}
-	else if (strncasecmp(x11ColourName,"grey40",6) == 0) {
-		rgb[0] = 102;	rgb[1] = 102;	rgb[2] = 102;
-	}
-	else if (strncasecmp(x11ColourName,"gray41",6) == 0) {
-		rgb[0] = 105;	rgb[1] = 105;	rgb[2] = 105;
-	}
-	else if (strncasecmp(x11ColourName,"grey41",6) == 0) {
-		rgb[0] = 105;	rgb[1] = 105;	rgb[2] = 105;
-	}
-	else if (strncasecmp(x11ColourName,"gray42",6) == 0) {
-		rgb[0] = 107;	rgb[1] = 107;	rgb[2] = 107;
-	}
-	else if (strncasecmp(x11ColourName,"grey42",6) == 0) {
-		rgb[0] = 107;	rgb[1] = 107;	rgb[2] = 107;
-	}
-	else if (strncasecmp(x11ColourName,"gray43",6) == 0) {
-		rgb[0] = 110;	rgb[1] = 110;	rgb[2] = 110;
-	}
-	else if (strncasecmp(x11ColourName,"grey43",6) == 0) {
-		rgb[0] = 110;	rgb[1] = 110;	rgb[2] = 110;
-	}
-	else if (strncasecmp(x11ColourName,"gray44",6) == 0) {
-		rgb[0] = 112;	rgb[1] = 112;	rgb[2] = 112;
-	}
-	else if (strncasecmp(x11ColourName,"grey44",6) == 0) {
-		rgb[0] = 112;	rgb[1] = 112;	rgb[2] = 112;
-	}
-	else if (strncasecmp(x11ColourName,"gray45",6) == 0) {
-		rgb[0] = 115;	rgb[1] = 115;	rgb[2] = 115;
-	}
-	else if (strncasecmp(x11ColourName,"grey45",6) == 0) {
-		rgb[0] = 115;	rgb[1] = 115;	rgb[2] = 115;
-	}
-	else if (strncasecmp(x11ColourName,"gray46",6) == 0) {
-		rgb[0] = 117;	rgb[1] = 117;	rgb[2] = 117;
-	}
-	else if (strncasecmp(x11ColourName,"grey46",6) == 0) {
-		rgb[0] = 117;	rgb[1] = 117;	rgb[2] = 117;
-	}
-	else if (strncasecmp(x11ColourName,"gray47",6) == 0) {
-		rgb[0] = 120;	rgb[1] = 120;	rgb[2] = 120;
-	}
-	else if (strncasecmp(x11ColourName,"grey47",6) == 0) {
-		rgb[0] = 120;	rgb[1] = 120;	rgb[2] = 120;
-	}
-	else if (strncasecmp(x11ColourName,"gray48",6) == 0) {
-		rgb[0] = 122;	rgb[1] = 122;	rgb[2] = 122;
-	}
-	else if (strncasecmp(x11ColourName,"grey48",6) == 0) {
-		rgb[0] = 122;	rgb[1] = 122;	rgb[2] = 122;
-	}
-	else if (strncasecmp(x11ColourName,"gray49",6) == 0) {
-		rgb[0] = 125;	rgb[1] = 125;	rgb[2] = 125;
-	}
-	else if (strncasecmp(x11ColourName,"grey49",6) == 0) {
-		rgb[0] = 125;	rgb[1] = 125;	rgb[2] = 125;
-	}
-	else if (strncasecmp(x11ColourName,"gray50",6) == 0) {
-		rgb[0] = 127;	rgb[1] = 127;	rgb[2] = 127;
-	}
-	else if (strncasecmp(x11ColourName,"grey50",6) == 0) {
-		rgb[0] = 127;	rgb[1] = 127;	rgb[2] = 127;
-	}
-	else if (strncasecmp(x11ColourName,"gray51",6) == 0) {
-		rgb[0] = 130;	rgb[1] = 130;	rgb[2] = 130;
-	}
-	else if (strncasecmp(x11ColourName,"grey51",6) == 0) {
-		rgb[0] = 130;	rgb[1] = 130;	rgb[2] = 130;
-	}
-	else if (strncasecmp(x11ColourName,"gray52",6) == 0) {
-		rgb[0] = 133;	rgb[1] = 133;	rgb[2] = 133;
-	}
-	else if (strncasecmp(x11ColourName,"grey52",6) == 0) {
-		rgb[0] = 133;	rgb[1] = 133;	rgb[2] = 133;
-	}
-	else if (strncasecmp(x11ColourName,"gray53",6) == 0) {
-		rgb[0] = 135;	rgb[1] = 135;	rgb[2] = 135;
-	}
-	else if (strncasecmp(x11ColourName,"grey53",6) == 0) {
-		rgb[0] = 135;	rgb[1] = 135;	rgb[2] = 135;
-	}
-	else if (strncasecmp(x11ColourName,"gray54",6) == 0) {
-		rgb[0] = 138;	rgb[1] = 138;	rgb[2] = 138;
-	}
-	else if (strncasecmp(x11ColourName,"grey54",6) == 0) {
-		rgb[0] = 138;	rgb[1] = 138;	rgb[2] = 138;
-	}
-	else if (strncasecmp(x11ColourName,"gray55",6) == 0) {
-		rgb[0] = 140;	rgb[1] = 140;	rgb[2] = 140;
-	}
-	else if (strncasecmp(x11ColourName,"grey55",6) == 0) {
-		rgb[0] = 140;	rgb[1] = 140;	rgb[2] = 140;
-	}
-	else if (strncasecmp(x11ColourName,"gray56",6) == 0) {
-		rgb[0] = 143;	rgb[1] = 143;	rgb[2] = 143;
-	}
-	else if (strncasecmp(x11ColourName,"grey56",6) == 0) {
-		rgb[0] = 143;	rgb[1] = 143;	rgb[2] = 143;
-	}
-	else if (strncasecmp(x11ColourName,"gray57",6) == 0) {
-		rgb[0] = 145;	rgb[1] = 145;	rgb[2] = 145;
-	}
-	else if (strncasecmp(x11ColourName,"grey57",6) == 0) {
-		rgb[0] = 145;	rgb[1] = 145;	rgb[2] = 145;
-	}
-	else if (strncasecmp(x11ColourName,"gray58",6) == 0) {
-		rgb[0] = 148;	rgb[1] = 148;	rgb[2] = 148;
-	}
-	else if (strncasecmp(x11ColourName,"grey58",6) == 0) {
-		rgb[0] = 148;	rgb[1] = 148;	rgb[2] = 148;
-	}
-	else if (strncasecmp(x11ColourName,"gray59",6) == 0) {
-		rgb[0] = 150;	rgb[1] = 150;	rgb[2] = 150;
-	}
-	else if (strncasecmp(x11ColourName,"grey59",6) == 0) {
-		rgb[0] = 150;	rgb[1] = 150;	rgb[2] = 150;
-	}
-	else if (strncasecmp(x11ColourName,"gray60",6) == 0) {
-		rgb[0] = 153;	rgb[1] = 153;	rgb[2] = 153;
-	}
-	else if (strncasecmp(x11ColourName,"grey60",6) == 0) {
-		rgb[0] = 153;	rgb[1] = 153;	rgb[2] = 153;
-	}
-	else if (strncasecmp(x11ColourName,"gray61",6) == 0) {
-		rgb[0] = 156;	rgb[1] = 156;	rgb[2] = 156;
-	}
-	else if (strncasecmp(x11ColourName,"grey61",6) == 0) {
-		rgb[0] = 156;	rgb[1] = 156;	rgb[2] = 156;
-	}
-	else if (strncasecmp(x11ColourName,"gray62",6) == 0) {
-		rgb[0] = 158;	rgb[1] = 158;	rgb[2] = 158;
-	}
-	else if (strncasecmp(x11ColourName,"grey62",6) == 0) {
-		rgb[0] = 158;	rgb[1] = 158;	rgb[2] = 158;
-	}
-	else if (strncasecmp(x11ColourName,"gray63",6) == 0) {
-		rgb[0] = 161;	rgb[1] = 161;	rgb[2] = 161;
-	}
-	else if (strncasecmp(x11ColourName,"grey63",6) == 0) {
-		rgb[0] = 161;	rgb[1] = 161;	rgb[2] = 161;
-	}
-	else if (strncasecmp(x11ColourName,"gray64",6) == 0) {
-		rgb[0] = 163;	rgb[1] = 163;	rgb[2] = 163;
-	}
-	else if (strncasecmp(x11ColourName,"grey64",6) == 0) {
-		rgb[0] = 163;	rgb[1] = 163;	rgb[2] = 163;
-	}
-	else if (strncasecmp(x11ColourName,"gray65",6) == 0) {
-		rgb[0] = 166;	rgb[1] = 166;	rgb[2] = 166;
-	}
-	else if (strncasecmp(x11ColourName,"grey65",6) == 0) {
-		rgb[0] = 166;	rgb[1] = 166;	rgb[2] = 166;
-	}
-	else if (strncasecmp(x11ColourName,"gray66",6) == 0) {
-		rgb[0] = 168;	rgb[1] = 168;	rgb[2] = 168;
-	}
-	else if (strncasecmp(x11ColourName,"grey66",6) == 0) {
-		rgb[0] = 168;	rgb[1] = 168;	rgb[2] = 168;
-	}
-	else if (strncasecmp(x11ColourName,"gray67",6) == 0) {
-		rgb[0] = 171;	rgb[1] = 171;	rgb[2] = 171;
-	}
-	else if (strncasecmp(x11ColourName,"grey67",6) == 0) {
-		rgb[0] = 171;	rgb[1] = 171;	rgb[2] = 171;
-	}
-	else if (strncasecmp(x11ColourName,"gray68",6) == 0) {
-		rgb[0] = 173;	rgb[1] = 173;	rgb[2] = 173;
-	}
-	else if (strncasecmp(x11ColourName,"grey68",6) == 0) {
-		rgb[0] = 173;	rgb[1] = 173;	rgb[2] = 173;
-	}
-	else if (strncasecmp(x11ColourName,"gray69",6) == 0) {
-		rgb[0] = 176;	rgb[1] = 176;	rgb[2] = 176;
-	}
-	else if (strncasecmp(x11ColourName,"grey69",6) == 0) {
-		rgb[0] = 176;	rgb[1] = 176;	rgb[2] = 176;
-	}
-	else if (strncasecmp(x11ColourName,"gray70",6) == 0) {
-		rgb[0] = 179;	rgb[1] = 179;	rgb[2] = 179;
-	}
-	else if (strncasecmp(x11ColourName,"grey70",6) == 0) {
-		rgb[0] = 179;	rgb[1] = 179;	rgb[2] = 179;
-	}
-	else if (strncasecmp(x11ColourName,"gray71",6) == 0) {
-		rgb[0] = 181;	rgb[1] = 181;	rgb[2] = 181;
-	}
-	else if (strncasecmp(x11ColourName,"grey71",6) == 0) {
-		rgb[0] = 181;	rgb[1] = 181;	rgb[2] = 181;
-	}
-	else if (strncasecmp(x11ColourName,"gray72",6) == 0) {
-		rgb[0] = 184;	rgb[1] = 184;	rgb[2] = 184;
-	}
-	else if (strncasecmp(x11ColourName,"grey72",6) == 0) {
-		rgb[0] = 184;	rgb[1] = 184;	rgb[2] = 184;
-	}
-	else if (strncasecmp(x11ColourName,"gray73",6) == 0) {
-		rgb[0] = 186;	rgb[1] = 186;	rgb[2] = 186;
-	}
-	else if (strncasecmp(x11ColourName,"grey73",6) == 0) {
-		rgb[0] = 186;	rgb[1] = 186;	rgb[2] = 186;
-	}
-	else if (strncasecmp(x11ColourName,"gray74",6) == 0) {
-		rgb[0] = 189;	rgb[1] = 189;	rgb[2] = 189;
-	}
-	else if (strncasecmp(x11ColourName,"grey74",6) == 0) {
-		rgb[0] = 189;	rgb[1] = 189;	rgb[2] = 189;
-	}
-	else if (strncasecmp(x11ColourName,"gray75",6) == 0) {
-		rgb[0] = 191;	rgb[1] = 191;	rgb[2] = 191;
-	}
-	else if (strncasecmp(x11ColourName,"grey75",6) == 0) {
-		rgb[0] = 191;	rgb[1] = 191;	rgb[2] = 191;
-	}
-	else if (strncasecmp(x11ColourName,"gray76",6) == 0) {
-		rgb[0] = 194;	rgb[1] = 194;	rgb[2] = 194;
-	}
-	else if (strncasecmp(x11ColourName,"grey76",6) == 0) {
-		rgb[0] = 194;	rgb[1] = 194;	rgb[2] = 194;
-	}
-	else if (strncasecmp(x11ColourName,"gray77",6) == 0) {
-		rgb[0] = 196;	rgb[1] = 196;	rgb[2] = 196;
-	}
-	else if (strncasecmp(x11ColourName,"grey77",6) == 0) {
-		rgb[0] = 196;	rgb[1] = 196;	rgb[2] = 196;
-	}
-	else if (strncasecmp(x11ColourName,"gray78",6) == 0) {
-		rgb[0] = 199;	rgb[1] = 199;	rgb[2] = 199;
-	}
-	else if (strncasecmp(x11ColourName,"grey78",6) == 0) {
-		rgb[0] = 199;	rgb[1] = 199;	rgb[2] = 199;
-	}
-	else if (strncasecmp(x11ColourName,"gray79",6) == 0) {
-		rgb[0] = 201;	rgb[1] = 201;	rgb[2] = 201;
-	}
-	else if (strncasecmp(x11ColourName,"grey79",6) == 0) {
-		rgb[0] = 201;	rgb[1] = 201;	rgb[2] = 201;
-	}
-	else if (strncasecmp(x11ColourName,"gray80",6) == 0) {
-		rgb[0] = 204;	rgb[1] = 204;	rgb[2] = 204;
-	}
-	else if (strncasecmp(x11ColourName,"grey80",6) == 0) {
-		rgb[0] = 204;	rgb[1] = 204;	rgb[2] = 204;
-	}
-	else if (strncasecmp(x11ColourName,"gray81",6) == 0) {
-		rgb[0] = 207;	rgb[1] = 207;	rgb[2] = 207;
-	}
-	else if (strncasecmp(x11ColourName,"grey81",6) == 0) {
-		rgb[0] = 207;	rgb[1] = 207;	rgb[2] = 207;
-	}
-	else if (strncasecmp(x11ColourName,"gray82",6) == 0) {
-		rgb[0] = 209;	rgb[1] = 209;	rgb[2] = 209;
-	}
-	else if (strncasecmp(x11ColourName,"grey82",6) == 0) {
-		rgb[0] = 209;	rgb[1] = 209;	rgb[2] = 209;
-	}
-	else if (strncasecmp(x11ColourName,"gray83",6) == 0) {
-		rgb[0] = 212;	rgb[1] = 212;	rgb[2] = 212;
-	}
-	else if (strncasecmp(x11ColourName,"grey83",6) == 0) {
-		rgb[0] = 212;	rgb[1] = 212;	rgb[2] = 212;
-	}
-	else if (strncasecmp(x11ColourName,"gray84",6) == 0) {
-		rgb[0] = 214;	rgb[1] = 214;	rgb[2] = 214;
-	}
-	else if (strncasecmp(x11ColourName,"grey84",6) == 0) {
-		rgb[0] = 214;	rgb[1] = 214;	rgb[2] = 214;
-	}
-	else if (strncasecmp(x11ColourName,"gray85",6) == 0) {
-		rgb[0] = 217;	rgb[1] = 217;	rgb[2] = 217;
-	}
-	else if (strncasecmp(x11ColourName,"grey85",6) == 0) {
-		rgb[0] = 217;	rgb[1] = 217;	rgb[2] = 217;
-	}
-	else if (strncasecmp(x11ColourName,"gray86",6) == 0) {
-		rgb[0] = 219;	rgb[1] = 219;	rgb[2] = 219;
-	}
-	else if (strncasecmp(x11ColourName,"grey86",6) == 0) {
-		rgb[0] = 219;	rgb[1] = 219;	rgb[2] = 219;
-	}
-	else if (strncasecmp(x11ColourName,"gray87",6) == 0) {
-		rgb[0] = 222;	rgb[1] = 222;	rgb[2] = 222;
-	}
-	else if (strncasecmp(x11ColourName,"grey87",6) == 0) {
-		rgb[0] = 222;	rgb[1] = 222;	rgb[2] = 222;
-	}
-	else if (strncasecmp(x11ColourName,"gray88",6) == 0) {
-		rgb[0] = 224;	rgb[1] = 224;	rgb[2] = 224;
-	}
-	else if (strncasecmp(x11ColourName,"grey88",6) == 0) {
-		rgb[0] = 224;	rgb[1] = 224;	rgb[2] = 224;
-	}
-	else if (strncasecmp(x11ColourName,"gray89",6) == 0) {
-		rgb[0] = 227;	rgb[1] = 227;	rgb[2] = 227;
-	}
-	else if (strncasecmp(x11ColourName,"grey89",6) == 0) {
-		rgb[0] = 227;	rgb[1] = 227;	rgb[2] = 227;
-	}
-	else if (strncasecmp(x11ColourName,"gray90",6) == 0) {
-		rgb[0] = 229;	rgb[1] = 229;	rgb[2] = 229;
-	}
-	else if (strncasecmp(x11ColourName,"grey90",6) == 0) {
-		rgb[0] = 229;	rgb[1] = 229;	rgb[2] = 229;
-	}
-	else if (strncasecmp(x11ColourName,"gray91",6) == 0) {
-		rgb[0] = 232;	rgb[1] = 232;	rgb[2] = 232;
-	}
-	else if (strncasecmp(x11ColourName,"grey91",6) == 0) {
-		rgb[0] = 232;	rgb[1] = 232;	rgb[2] = 232;
-	}
-	else if (strncasecmp(x11ColourName,"gray92",6) == 0) {
-		rgb[0] = 235;	rgb[1] = 235;	rgb[2] = 235;
-	}
-	else if (strncasecmp(x11ColourName,"grey92",6) == 0) {
-		rgb[0] = 235;	rgb[1] = 235;	rgb[2] = 235;
-	}
-	else if (strncasecmp(x11ColourName,"gray93",6) == 0) {
-		rgb[0] = 237;	rgb[1] = 237;	rgb[2] = 237;
-	}
-	else if (strncasecmp(x11ColourName,"grey93",6) == 0) {
-		rgb[0] = 237;	rgb[1] = 237;	rgb[2] = 237;
-	}
-	else if (strncasecmp(x11ColourName,"gray94",6) == 0) {
-		rgb[0] = 240;	rgb[1] = 240;	rgb[2] = 240;
-	}
-	else if (strncasecmp(x11ColourName,"grey94",6) == 0) {
-		rgb[0] = 240;	rgb[1] = 240;	rgb[2] = 240;
-	}
-	else if (strncasecmp(x11ColourName,"gray95",6) == 0) {
-		rgb[0] = 242;	rgb[1] = 242;	rgb[2] = 242;
-	}
-	else if (strncasecmp(x11ColourName,"grey95",6) == 0) {
-		rgb[0] = 242;	rgb[1] = 242;	rgb[2] = 242;
-	}
-	else if (strncasecmp(x11ColourName,"gray96",6) == 0) {
-		rgb[0] = 245;	rgb[1] = 245;	rgb[2] = 245;
-	}
-	else if (strncasecmp(x11ColourName,"grey96",6) == 0) {
-		rgb[0] = 245;	rgb[1] = 245;	rgb[2] = 245;
-	}
-	else if (strncasecmp(x11ColourName,"gray97",6) == 0) {
-		rgb[0] = 247;	rgb[1] = 247;	rgb[2] = 247;
-	}
-	else if (strncasecmp(x11ColourName,"grey97",6) == 0) {
-		rgb[0] = 247;	rgb[1] = 247;	rgb[2] = 247;
-	}
-	else if (strncasecmp(x11ColourName,"gray98",6) == 0) {
-		rgb[0] = 250;	rgb[1] = 250;	rgb[2] = 250;
-	}
-	else if (strncasecmp(x11ColourName,"grey98",6) == 0) {
-		rgb[0] = 250;	rgb[1] = 250;	rgb[2] = 250;
-	}
-	else if (strncasecmp(x11ColourName,"gray99",6) == 0) {
-		rgb[0] = 252;	rgb[1] = 252;	rgb[2] = 252;
-	}
-	else if (strncasecmp(x11ColourName,"grey99",6) == 0) {
-		rgb[0] = 252;	rgb[1] = 252;	rgb[2] = 252;
-	}
-	else if (strncasecmp(x11ColourName,"gray100",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"grey100",7) == 0) {
-		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 255;
-	}
-	else if (strncasecmp(x11ColourName,"DarkGrey",8) == 0) {
-		rgb[0] = 169;	rgb[1] = 169;	rgb[2] = 169;
-	}
-	else if (strncasecmp(x11ColourName,"DarkGray",8) == 0) {
-		rgb[0] = 169;	rgb[1] = 169;	rgb[2] = 169;
-	}
-	else if (strncasecmp(x11ColourName,"DarkBlue",8) == 0) {
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"DarkCyan",8) == 0) {
-		rgb[0] = 0;	rgb[1] = 139;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"DarkMagenta",11) == 0) {
-		rgb[0] = 139;	rgb[1] = 0;	rgb[2] = 139;
-	}
-	else if (strncasecmp(x11ColourName,"DarkRed",7) == 0) {
-		rgb[0] = 139;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	else if (strncasecmp(x11ColourName,"LightGreen",10) == 0) {
-		rgb[0] = 144;	rgb[1] = 238;	rgb[2] = 144;
-	}
-	else {		/* Default is Black */
-		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 0;
-	}
-	
-	/* Convert from int to float */
-	self->red   = (float) rgb[0]/255.0;
-	self->green = (float) rgb[1]/255.0;
-	self->blue  = (float) rgb[2]/255.0;
-	self->opacity = 1.0;
-}
-
-void lucColour_FromHexName( lucColour* self, Name hexName ) {
-	char* red;
-	char* green;
-	char* blue;
-	int i;
-	int rgb[3];
-	
-	/* Check to make sure colour is valid */
-	if (hexName[0] != '#') {
-		lucColour_FromX11ColourName( self, "black" );
-		printf( "Cannot recognise hex colour %s.\n", hexName);
-		return;
-	}
-	for (i = 1 ; i <= 6 ; i++) {
-		if (isxdigit(hexName[i]) == 0) {
-			lucColour_FromX11ColourName( self, "black" );
-			printf( "Cannot recognise hex colour %s.\n", hexName);
-			return;
-		}
-	}
-	
-	/* Seperate colours */
-	red = StG_Strdup(&hexName[1]);
-	red[2] = '\0';
-	green = StG_Strdup(&hexName[3]);
-	green[2] = '\0';
-	blue = StG_Strdup(&hexName[5]);
-	blue[2] = '\0';
-	
-	/* Read colours */
-	sscanf(red,   "%x", &rgb[0]);
-	sscanf(green, "%x", &rgb[1]);
-	sscanf(blue,  "%x", &rgb[2]);
-
-	Memory_Free( blue );
-	Memory_Free( green );
-	Memory_Free( red );
-	
-	self->red   = (float) rgb[0]/255.0;
-	self->green = (float) rgb[1]/255.0;
-	self->blue  = (float) rgb[2]/255.0;
-	self->opacity = 1.0;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/src/X11Colours.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/src/X11Colours.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,2090 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: X11Colours.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "types.h"
+#include "ColourMap.h"
+#include "X11Colours.h"
+#include <ctype.h>
+#include <string.h>
+
+/* Reads hex or colour from X11 Colour Chart */
+/* Defaults to black if anything else */
+void lucColour_FromX11ColourName( lucColour* self, Name x11ColourName ) {
+	int rgb[3];
+
+	if (strncmp(x11ColourName,"#",1) == 0) {
+		lucColour_FromHexName( self, x11ColourName );
+		return;
+	}
+	else if (strncasecmp(x11ColourName,"snow",4) == 0) {
+		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 250;
+	}
+	else if (strncasecmp(x11ColourName,"GhostWhite",10) == 0) {
+		rgb[0] = 248;	rgb[1] = 248;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"WhiteSmoke",10) == 0) {
+		rgb[0] = 245;	rgb[1] = 245;	rgb[2] = 245;
+	}
+	else if (strncasecmp(x11ColourName,"gainsboro",9) == 0) {
+		rgb[0] = 220;	rgb[1] = 220;	rgb[2] = 220;
+	}
+	else if (strncasecmp(x11ColourName,"FloralWhite",11) == 0) {
+		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 240;
+	}
+	else if (strncasecmp(x11ColourName,"OldLace",7) == 0) {
+		rgb[0] = 253;	rgb[1] = 245;	rgb[2] = 230;
+	}
+	else if (strncasecmp(x11ColourName,"linen",5) == 0) {
+		rgb[0] = 250;	rgb[1] = 240;	rgb[2] = 230;
+	}
+	else if (strncasecmp(x11ColourName,"AntiqueWhite",12) == 0) {
+		rgb[0] = 250;	rgb[1] = 235;	rgb[2] = 215;
+	}
+	else if (strncasecmp(x11ColourName,"PapayaWhip",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 239;	rgb[2] = 213;
+	}
+	else if (strncasecmp(x11ColourName,"BlanchedAlmond",14) == 0) {
+		rgb[0] = 255;	rgb[1] = 235;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"bisque",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 196;
+	}
+	else if (strncasecmp(x11ColourName,"PeachPuff",9) == 0) {
+		rgb[0] = 255;	rgb[1] = 218;	rgb[2] = 185;
+	}
+	else if (strncasecmp(x11ColourName,"NavajoWhite",11) == 0) {
+		rgb[0] = 255;	rgb[1] = 222;	rgb[2] = 173;
+	}
+	else if (strncasecmp(x11ColourName,"moccasin",8) == 0) {
+		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 181;
+	}
+	else if (strncasecmp(x11ColourName,"cornsilk",8) == 0) {
+		rgb[0] = 255;	rgb[1] = 248;	rgb[2] = 220;
+	}
+	else if (strncasecmp(x11ColourName,"ivory",5) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 240;
+	}
+	else if (strncasecmp(x11ColourName,"LemonChiffon",12) == 0) {
+		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"seashell",8) == 0) {
+		rgb[0] = 255;	rgb[1] = 245;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"honeydew",8) == 0) {
+		rgb[0] = 240;	rgb[1] = 255;	rgb[2] = 240;
+	}
+	else if (strncasecmp(x11ColourName,"MintCream",9) == 0) {
+		rgb[0] = 245;	rgb[1] = 255;	rgb[2] = 250;
+	}
+	else if (strncasecmp(x11ColourName,"azure",5) == 0) {
+		rgb[0] = 240;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"AliceBlue",9) == 0) {
+		rgb[0] = 240;	rgb[1] = 248;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"lavender",8) == 0) {
+		rgb[0] = 230;	rgb[1] = 230;	rgb[2] = 250;
+	}
+	else if (strncasecmp(x11ColourName,"LavenderBlush",13) == 0) {
+		rgb[0] = 255;	rgb[1] = 240;	rgb[2] = 245;
+	}
+	else if (strncasecmp(x11ColourName,"MistyRose",9) == 0) {
+		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 225;
+	}
+	else if (strncasecmp(x11ColourName,"white",5) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"black",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSlateGray",13) == 0) {
+		rgb[0] = 47;	rgb[1] = 79;	rgb[2] = 79;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSlateGrey",13) == 0) {
+		rgb[0] = 47;	rgb[1] = 79;	rgb[2] = 79;
+	}
+	else if (strncasecmp(x11ColourName,"DimGray",7) == 0) {
+		rgb[0] = 105;	rgb[1] = 105;	rgb[2] = 105;
+	}
+	else if (strncasecmp(x11ColourName,"DimGrey",7) == 0) {
+		rgb[0] = 105;	rgb[1] = 105;	rgb[2] = 105;
+	}
+	else if (strncasecmp(x11ColourName,"SlateGray",9) == 0) {
+		rgb[0] = 112;	rgb[1] = 128;	rgb[2] = 144;
+	}
+	else if (strncasecmp(x11ColourName,"SlateGrey",9) == 0) {
+		rgb[0] = 112;	rgb[1] = 128;	rgb[2] = 144;
+	}
+	else if (strncasecmp(x11ColourName,"LightSlateGray",14) == 0) {
+		rgb[0] = 119;	rgb[1] = 136;	rgb[2] = 153;
+	}
+	else if (strncasecmp(x11ColourName,"LightSlateGrey",14) == 0) {
+		rgb[0] = 119;	rgb[1] = 136;	rgb[2] = 153;
+	}
+	else if (strncasecmp(x11ColourName,"gray",4) == 0) {
+		rgb[0] = 190;	rgb[1] = 190;	rgb[2] = 190;
+	}
+	else if (strncasecmp(x11ColourName,"grey",4) == 0) {
+		rgb[0] = 190;	rgb[1] = 190;	rgb[2] = 190;
+	}
+	else if (strncasecmp(x11ColourName,"LightGrey",9) == 0) {
+		rgb[0] = 211;	rgb[1] = 211;	rgb[2] = 211;
+	}
+	else if (strncasecmp(x11ColourName,"LightGray",9) == 0) {
+		rgb[0] = 211;	rgb[1] = 211;	rgb[2] = 211;
+	}
+	else if (strncasecmp(x11ColourName,"MidnightBlue",12) == 0) {
+		rgb[0] = 25;	rgb[1] = 25;	rgb[2] = 112;
+	}
+	else if (strncasecmp(x11ColourName,"navy",4) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 128;
+	}
+	else if (strncasecmp(x11ColourName,"NavyBlue",8) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 128;
+	}
+	else if (strncasecmp(x11ColourName,"CornflowerBlue",14) == 0) {
+		rgb[0] = 100;	rgb[1] = 149;	rgb[2] = 237;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSlateBlue",13) == 0) {
+		rgb[0] = 72;	rgb[1] = 61;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"SlateBlue",9) == 0) {
+		rgb[0] = 106;	rgb[1] = 90;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"MediumSlateBlue",15) == 0) {
+		rgb[0] = 123;	rgb[1] = 104;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"LightSlateBlue",14) == 0) {
+		rgb[0] = 132;	rgb[1] = 112;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"MediumBlue",10) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"RoyalBlue",9) == 0) {
+		rgb[0] = 65;	rgb[1] = 105;	rgb[2] = 225;
+	}
+	else if (strncasecmp(x11ColourName,"blue",4) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"DodgerBlue",10) == 0) {
+		rgb[0] = 30;	rgb[1] = 144;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"DeepSkyBlue",11) == 0) {
+		rgb[0] = 0;	rgb[1] = 191;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"SkyBlue",7) == 0) {
+		rgb[0] = 135;	rgb[1] = 206;	rgb[2] = 235;
+	}
+	else if (strncasecmp(x11ColourName,"LightSkyBlue",12) == 0) {
+		rgb[0] = 135;	rgb[1] = 206;	rgb[2] = 250;
+	}
+	else if (strncasecmp(x11ColourName,"SteelBlue",9) == 0) {
+		rgb[0] = 70;	rgb[1] = 130;	rgb[2] = 180;
+	}
+	else if (strncasecmp(x11ColourName,"LightSteelBlue",14) == 0) {
+		rgb[0] = 176;	rgb[1] = 196;	rgb[2] = 222;
+	}
+	else if (strncasecmp(x11ColourName,"LightBlue",9) == 0) {
+		rgb[0] = 173;	rgb[1] = 216;	rgb[2] = 230;
+	}
+	else if (strncasecmp(x11ColourName,"PowderBlue",10) == 0) {
+		rgb[0] = 176;	rgb[1] = 224;	rgb[2] = 230;
+	}
+	else if (strncasecmp(x11ColourName,"PaleTurquoise",13) == 0) {
+		rgb[0] = 175;	rgb[1] = 238;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"DarkTurquoise",13) == 0) {
+		rgb[0] = 0;	rgb[1] = 206;	rgb[2] = 209;
+	}
+	else if (strncasecmp(x11ColourName,"MediumTurquoise",15) == 0) {
+		rgb[0] = 72;	rgb[1] = 209;	rgb[2] = 204;
+	}
+	else if (strncasecmp(x11ColourName,"turquoise",9) == 0) {
+		rgb[0] = 64;	rgb[1] = 224;	rgb[2] = 208;
+	}
+	else if (strncasecmp(x11ColourName,"cyan",4) == 0) {
+		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"LightCyan",9) == 0) {
+		rgb[0] = 224;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"CadetBlue",9) == 0) {
+		rgb[0] = 95;	rgb[1] = 158;	rgb[2] = 160;
+	}
+	else if (strncasecmp(x11ColourName,"MediumAquamarine",16) == 0) {
+		rgb[0] = 102;	rgb[1] = 205;	rgb[2] = 170;
+	}
+	else if (strncasecmp(x11ColourName,"aquamarine",10) == 0) {
+		rgb[0] = 127;	rgb[1] = 255;	rgb[2] = 212;
+	}
+	else if (strncasecmp(x11ColourName,"DarkGreen",9) == 0) {
+		rgb[0] = 0;	rgb[1] = 100;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOliveGreen",14) == 0) {
+		rgb[0] = 85;	rgb[1] = 107;	rgb[2] = 47;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSeaGreen",12) == 0) {
+		rgb[0] = 143;	rgb[1] = 188;	rgb[2] = 143;
+	}
+	else if (strncasecmp(x11ColourName,"SeaGreen",8) == 0) {
+		rgb[0] = 46;	rgb[1] = 139;	rgb[2] = 87;
+	}
+	else if (strncasecmp(x11ColourName,"MediumSeaGreen",14) == 0) {
+		rgb[0] = 60;	rgb[1] = 179;	rgb[2] = 113;
+	}
+	else if (strncasecmp(x11ColourName,"LightSeaGreen",13) == 0) {
+		rgb[0] = 32;	rgb[1] = 178;	rgb[2] = 170;
+	}
+	else if (strncasecmp(x11ColourName,"PaleGreen",9) == 0) {
+		rgb[0] = 152;	rgb[1] = 251;	rgb[2] = 152;
+	}
+	else if (strncasecmp(x11ColourName,"SpringGreen",11) == 0) {
+		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 127;
+	}
+	else if (strncasecmp(x11ColourName,"LawnGreen",9) == 0) {
+		rgb[0] = 124;	rgb[1] = 252;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"green",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"chartreuse",10) == 0) {
+		rgb[0] = 127;	rgb[1] = 255;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"MediumSpringGreen",17) == 0) {
+		rgb[0] = 0;	rgb[1] = 250;	rgb[2] = 154;
+	}
+	else if (strncasecmp(x11ColourName,"GreenYellow",11) == 0) {
+		rgb[0] = 173;	rgb[1] = 255;	rgb[2] = 47;
+	}
+	else if (strncasecmp(x11ColourName,"LimeGreen",9) == 0) {
+		rgb[0] = 50;	rgb[1] = 205;	rgb[2] = 50;
+	}
+	else if (strncasecmp(x11ColourName,"YellowGreen",11) == 0) {
+		rgb[0] = 154;	rgb[1] = 205;	rgb[2] = 50;
+	}
+	else if (strncasecmp(x11ColourName,"ForestGreen",11) == 0) {
+		rgb[0] = 34;	rgb[1] = 139;	rgb[2] = 34;
+	}
+	else if (strncasecmp(x11ColourName,"OliveDrab",9) == 0) {
+		rgb[0] = 107;	rgb[1] = 142;	rgb[2] = 35;
+	}
+	else if (strncasecmp(x11ColourName,"DarkKhaki",9) == 0) {
+		rgb[0] = 189;	rgb[1] = 183;	rgb[2] = 107;
+	}
+	else if (strncasecmp(x11ColourName,"khaki",5) == 0) {
+		rgb[0] = 240;	rgb[1] = 230;	rgb[2] = 140;
+	}
+	else if (strncasecmp(x11ColourName,"PaleGoldenrod",13) == 0) {
+		rgb[0] = 238;	rgb[1] = 232;	rgb[2] = 170;
+	}
+	else if (strncasecmp(x11ColourName,"LightGoldenrodYellow",20) == 0) {
+		rgb[0] = 250;	rgb[1] = 250;	rgb[2] = 210;
+	}
+	else if (strncasecmp(x11ColourName,"LightYellow",11) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 224;
+	}
+	else if (strncasecmp(x11ColourName,"yellow",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"gold",4) == 0) {
+		rgb[0] = 255;	rgb[1] = 215;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"LightGoldenrod",14) == 0) {
+		rgb[0] = 238;	rgb[1] = 221;	rgb[2] = 130;
+	}
+	else if (strncasecmp(x11ColourName,"goldenrod",9) == 0) {
+		rgb[0] = 218;	rgb[1] = 165;	rgb[2] = 32;
+	}
+	else if (strncasecmp(x11ColourName,"DarkGoldenrod",13) == 0) {
+		rgb[0] = 184;	rgb[1] = 134;	rgb[2] = 11;
+	}
+	else if (strncasecmp(x11ColourName,"RosyBrown",9) == 0) {
+		rgb[0] = 188;	rgb[1] = 143;	rgb[2] = 143;
+	}
+	else if (strncasecmp(x11ColourName,"IndianRed",9) == 0) {
+		rgb[0] = 205;	rgb[1] = 92;	rgb[2] = 92;
+	}
+	else if (strncasecmp(x11ColourName,"SaddleBrown",11) == 0) {
+		rgb[0] = 139;	rgb[1] = 69;	rgb[2] = 19;
+	}
+	else if (strncasecmp(x11ColourName,"sienna",6) == 0) {
+		rgb[0] = 160;	rgb[1] = 82;	rgb[2] = 45;
+	}
+	else if (strncasecmp(x11ColourName,"peru",4) == 0) {
+		rgb[0] = 205;	rgb[1] = 133;	rgb[2] = 63;
+	}
+	else if (strncasecmp(x11ColourName,"burlywood",9) == 0) {
+		rgb[0] = 222;	rgb[1] = 184;	rgb[2] = 135;
+	}
+	else if (strncasecmp(x11ColourName,"beige",5) == 0) {
+		rgb[0] = 245;	rgb[1] = 245;	rgb[2] = 220;
+	}
+	else if (strncasecmp(x11ColourName,"wheat",5) == 0) {
+		rgb[0] = 245;	rgb[1] = 222;	rgb[2] = 179;
+	}
+	else if (strncasecmp(x11ColourName,"SandyBrown",10) == 0) {
+		rgb[0] = 244;	rgb[1] = 164;	rgb[2] = 96;
+	}
+	else if (strncasecmp(x11ColourName,"tan",3) == 0) {
+		rgb[0] = 210;	rgb[1] = 180;	rgb[2] = 140;
+	}
+	else if (strncasecmp(x11ColourName,"chocolate",9) == 0) {
+		rgb[0] = 210;	rgb[1] = 105;	rgb[2] = 30;
+	}
+	else if (strncasecmp(x11ColourName,"firebrick",9) == 0) {
+		rgb[0] = 178;	rgb[1] = 34;	rgb[2] = 34;
+	}
+	else if (strncasecmp(x11ColourName,"brown",5) == 0) {
+		rgb[0] = 165;	rgb[1] = 42;	rgb[2] = 42;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSalmon",10) == 0) {
+		rgb[0] = 233;	rgb[1] = 150;	rgb[2] = 122;
+	}
+	else if (strncasecmp(x11ColourName,"salmon",6) == 0) {
+		rgb[0] = 250;	rgb[1] = 128;	rgb[2] = 114;
+	}
+	else if (strncasecmp(x11ColourName,"LightSalmon",11) == 0) {
+		rgb[0] = 255;	rgb[1] = 160;	rgb[2] = 122;
+	}
+	else if (strncasecmp(x11ColourName,"orange",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 165;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrange",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 140;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"coral",5) == 0) {
+		rgb[0] = 255;	rgb[1] = 127;	rgb[2] = 80;
+	}
+	else if (strncasecmp(x11ColourName,"LightCoral",10) == 0) {
+		rgb[0] = 240;	rgb[1] = 128;	rgb[2] = 128;
+	}
+	else if (strncasecmp(x11ColourName,"tomato",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 99;	rgb[2] = 71;
+	}
+	else if (strncasecmp(x11ColourName,"OrangeRed",9) == 0) {
+		rgb[0] = 255;	rgb[1] = 69;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"red",3) == 0) {
+		rgb[0] = 255;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"HotPink",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 105;	rgb[2] = 180;
+	}
+	else if (strncasecmp(x11ColourName,"DeepPink",8) == 0) {
+		rgb[0] = 255;	rgb[1] = 20;	rgb[2] = 147;
+	}
+	else if (strncasecmp(x11ColourName,"pink",4) == 0) {
+		rgb[0] = 255;	rgb[1] = 192;	rgb[2] = 203;
+	}
+	else if (strncasecmp(x11ColourName,"LightPink",9) == 0) {
+		rgb[0] = 255;	rgb[1] = 182;	rgb[2] = 193;
+	}
+	else if (strncasecmp(x11ColourName,"PaleVioletRed",13) == 0) {
+		rgb[0] = 219;	rgb[1] = 112;	rgb[2] = 147;
+	}
+	else if (strncasecmp(x11ColourName,"maroon",6) == 0) {
+		rgb[0] = 176;	rgb[1] = 48;	rgb[2] = 96;
+	}
+	else if (strncasecmp(x11ColourName,"MediumVioletRed",15) == 0) {
+		rgb[0] = 199;	rgb[1] = 21;	rgb[2] = 133;
+	}
+	else if (strncasecmp(x11ColourName,"VioletRed",9) == 0) {
+		rgb[0] = 208;	rgb[1] = 32;	rgb[2] = 144;
+	}
+	else if (strncasecmp(x11ColourName,"magenta",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 0;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"violet",6) == 0) {
+		rgb[0] = 238;	rgb[1] = 130;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"plum",4) == 0) {
+		rgb[0] = 221;	rgb[1] = 160;	rgb[2] = 221;
+	}
+	else if (strncasecmp(x11ColourName,"orchid",6) == 0) {
+		rgb[0] = 218;	rgb[1] = 112;	rgb[2] = 214;
+	}
+	else if (strncasecmp(x11ColourName,"MediumOrchid",12) == 0) {
+		rgb[0] = 186;	rgb[1] = 85;	rgb[2] = 211;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrchid",10) == 0) {
+		rgb[0] = 153;	rgb[1] = 50;	rgb[2] = 204;
+	}
+	else if (strncasecmp(x11ColourName,"DarkViolet",10) == 0) {
+		rgb[0] = 148;	rgb[1] = 0;	rgb[2] = 211;
+	}
+	else if (strncasecmp(x11ColourName,"BlueViolet",10) == 0) {
+		rgb[0] = 138;	rgb[1] = 43;	rgb[2] = 226;
+	}
+	else if (strncasecmp(x11ColourName,"purple",6) == 0) {
+		rgb[0] = 160;	rgb[1] = 32;	rgb[2] = 240;
+	}
+	else if (strncasecmp(x11ColourName,"MediumPurple",12) == 0) {
+		rgb[0] = 147;	rgb[1] = 112;	rgb[2] = 219;
+	}
+	else if (strncasecmp(x11ColourName,"thistle",7) == 0) {
+		rgb[0] = 216;	rgb[1] = 191;	rgb[2] = 216;
+	}
+	else if (strncasecmp(x11ColourName,"snow1",5) == 0) {
+		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 250;
+	}
+	else if (strncasecmp(x11ColourName,"snow2",5) == 0) {
+		rgb[0] = 238;	rgb[1] = 233;	rgb[2] = 233;
+	}
+	else if (strncasecmp(x11ColourName,"snow3",5) == 0) {
+		rgb[0] = 205;	rgb[1] = 201;	rgb[2] = 201;
+	}
+	else if (strncasecmp(x11ColourName,"snow4",5) == 0) {
+		rgb[0] = 139;	rgb[1] = 137;	rgb[2] = 137;
+	}
+	else if (strncasecmp(x11ColourName,"seashell1",9) == 0) {
+		rgb[0] = 255;	rgb[1] = 245;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"seashell2",9) == 0) {
+		rgb[0] = 238;	rgb[1] = 229;	rgb[2] = 222;
+	}
+	else if (strncasecmp(x11ColourName,"seashell3",9) == 0) {
+		rgb[0] = 205;	rgb[1] = 197;	rgb[2] = 191;
+	}
+	else if (strncasecmp(x11ColourName,"seashell4",9) == 0) {
+		rgb[0] = 139;	rgb[1] = 134;	rgb[2] = 130;
+	}
+	else if (strncasecmp(x11ColourName,"AntiqueWhite1",13) == 0) {
+		rgb[0] = 255;	rgb[1] = 239;	rgb[2] = 219;
+	}
+	else if (strncasecmp(x11ColourName,"AntiqueWhite2",13) == 0) {
+		rgb[0] = 238;	rgb[1] = 223;	rgb[2] = 204;
+	}
+	else if (strncasecmp(x11ColourName,"AntiqueWhite3",13) == 0) {
+		rgb[0] = 205;	rgb[1] = 192;	rgb[2] = 176;
+	}
+	else if (strncasecmp(x11ColourName,"AntiqueWhite4",13) == 0) {
+		rgb[0] = 139;	rgb[1] = 131;	rgb[2] = 120;
+	}
+	else if (strncasecmp(x11ColourName,"bisque1",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 196;
+	}
+	else if (strncasecmp(x11ColourName,"bisque2",7) == 0) {
+		rgb[0] = 238;	rgb[1] = 213;	rgb[2] = 183;
+	}
+	else if (strncasecmp(x11ColourName,"bisque3",7) == 0) {
+		rgb[0] = 205;	rgb[1] = 183;	rgb[2] = 158;
+	}
+	else if (strncasecmp(x11ColourName,"bisque4",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 125;	rgb[2] = 107;
+	}
+	else if (strncasecmp(x11ColourName,"PeachPuff1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 218;	rgb[2] = 185;
+	}
+	else if (strncasecmp(x11ColourName,"PeachPuff2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 203;	rgb[2] = 173;
+	}
+	else if (strncasecmp(x11ColourName,"PeachPuff3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 175;	rgb[2] = 149;
+	}
+	else if (strncasecmp(x11ColourName,"PeachPuff4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 119;	rgb[2] = 101;
+	}
+	else if (strncasecmp(x11ColourName,"NavajoWhite1",12) == 0) {
+		rgb[0] = 255;	rgb[1] = 222;	rgb[2] = 173;
+	}
+	else if (strncasecmp(x11ColourName,"NavajoWhite2",12) == 0) {
+		rgb[0] = 238;	rgb[1] = 207;	rgb[2] = 161;
+	}
+	else if (strncasecmp(x11ColourName,"NavajoWhite3",12) == 0) {
+		rgb[0] = 205;	rgb[1] = 179;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"NavajoWhite4",12) == 0) {
+		rgb[0] = 139;	rgb[1] = 121;	rgb[2] = 94;
+	}
+	else if (strncasecmp(x11ColourName,"LemonChiffon1",13) == 0) {
+		rgb[0] = 255;	rgb[1] = 250;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"LemonChiffon2",13) == 0) {
+		rgb[0] = 238;	rgb[1] = 233;	rgb[2] = 191;
+	}
+	else if (strncasecmp(x11ColourName,"LemonChiffon3",13) == 0) {
+		rgb[0] = 205;	rgb[1] = 201;	rgb[2] = 165;
+	}
+	else if (strncasecmp(x11ColourName,"LemonChiffon4",13) == 0) {
+		rgb[0] = 139;	rgb[1] = 137;	rgb[2] = 112;
+	}
+	else if (strncasecmp(x11ColourName,"cornsilk1",9) == 0) {
+		rgb[0] = 255;	rgb[1] = 248;	rgb[2] = 220;
+	}
+	else if (strncasecmp(x11ColourName,"cornsilk2",9) == 0) {
+		rgb[0] = 238;	rgb[1] = 232;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"cornsilk3",9) == 0) {
+		rgb[0] = 205;	rgb[1] = 200;	rgb[2] = 177;
+	}
+	else if (strncasecmp(x11ColourName,"cornsilk4",9) == 0) {
+		rgb[0] = 139;	rgb[1] = 136;	rgb[2] = 120;
+	}
+	else if (strncasecmp(x11ColourName,"ivory1",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 240;
+	}
+	else if (strncasecmp(x11ColourName,"ivory2",6) == 0) {
+		rgb[0] = 238;	rgb[1] = 238;	rgb[2] = 224;
+	}
+	else if (strncasecmp(x11ColourName,"ivory3",6) == 0) {
+		rgb[0] = 205;	rgb[1] = 205;	rgb[2] = 193;
+	}
+	else if (strncasecmp(x11ColourName,"ivory4",6) == 0) {
+		rgb[0] = 139;	rgb[1] = 139;	rgb[2] = 131;
+	}
+	else if (strncasecmp(x11ColourName,"honeydew1",9) == 0) {
+		rgb[0] = 240;	rgb[1] = 255;	rgb[2] = 240;
+	}
+	else if (strncasecmp(x11ColourName,"honeydew2",9) == 0) {
+		rgb[0] = 224;	rgb[1] = 238;	rgb[2] = 224;
+	}
+	else if (strncasecmp(x11ColourName,"honeydew3",9) == 0) {
+		rgb[0] = 193;	rgb[1] = 205;	rgb[2] = 193;
+	}
+	else if (strncasecmp(x11ColourName,"honeydew4",9) == 0) {
+		rgb[0] = 131;	rgb[1] = 139;	rgb[2] = 131;
+	}
+	else if (strncasecmp(x11ColourName,"LavenderBlush1",14) == 0) {
+		rgb[0] = 255;	rgb[1] = 240;	rgb[2] = 245;
+	}
+	else if (strncasecmp(x11ColourName,"LavenderBlush2",14) == 0) {
+		rgb[0] = 238;	rgb[1] = 224;	rgb[2] = 229;
+	}
+	else if (strncasecmp(x11ColourName,"LavenderBlush3",14) == 0) {
+		rgb[0] = 205;	rgb[1] = 193;	rgb[2] = 197;
+	}
+	else if (strncasecmp(x11ColourName,"LavenderBlush4",14) == 0) {
+		rgb[0] = 139;	rgb[1] = 131;	rgb[2] = 134;
+	}
+	else if (strncasecmp(x11ColourName,"MistyRose1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 228;	rgb[2] = 225;
+	}
+	else if (strncasecmp(x11ColourName,"MistyRose2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 213;	rgb[2] = 210;
+	}
+	else if (strncasecmp(x11ColourName,"MistyRose3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 183;	rgb[2] = 181;
+	}
+	else if (strncasecmp(x11ColourName,"MistyRose4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 125;	rgb[2] = 123;
+	}
+	else if (strncasecmp(x11ColourName,"azure1",6) == 0) {
+		rgb[0] = 240;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"azure2",6) == 0) {
+		rgb[0] = 224;	rgb[1] = 238;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"azure3",6) == 0) {
+		rgb[0] = 193;	rgb[1] = 205;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"azure4",6) == 0) {
+		rgb[0] = 131;	rgb[1] = 139;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"SlateBlue1",10) == 0) {
+		rgb[0] = 131;	rgb[1] = 111;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"SlateBlue2",10) == 0) {
+		rgb[0] = 122;	rgb[1] = 103;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"SlateBlue3",10) == 0) {
+		rgb[0] = 105;	rgb[1] = 89;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"SlateBlue4",10) == 0) {
+		rgb[0] = 71;	rgb[1] = 60;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"RoyalBlue1",10) == 0) {
+		rgb[0] = 72;	rgb[1] = 118;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"RoyalBlue2",10) == 0) {
+		rgb[0] = 67;	rgb[1] = 110;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"RoyalBlue3",10) == 0) {
+		rgb[0] = 58;	rgb[1] = 95;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"RoyalBlue4",10) == 0) {
+		rgb[0] = 39;	rgb[1] = 64;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"blue1",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"blue2",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"blue3",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"blue4",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"DodgerBlue1",11) == 0) {
+		rgb[0] = 30;	rgb[1] = 144;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"DodgerBlue2",11) == 0) {
+		rgb[0] = 28;	rgb[1] = 134;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"DodgerBlue3",11) == 0) {
+		rgb[0] = 24;	rgb[1] = 116;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"DodgerBlue4",11) == 0) {
+		rgb[0] = 16;	rgb[1] = 78;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"SteelBlue1",10) == 0) {
+		rgb[0] = 99;	rgb[1] = 184;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"SteelBlue2",10) == 0) {
+		rgb[0] = 92;	rgb[1] = 172;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"SteelBlue3",10) == 0) {
+		rgb[0] = 79;	rgb[1] = 148;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"SteelBlue4",10) == 0) {
+		rgb[0] = 54;	rgb[1] = 100;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"DeepSkyBlue1",12) == 0) {
+		rgb[0] = 0;	rgb[1] = 191;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"DeepSkyBlue2",12) == 0) {
+		rgb[0] = 0;	rgb[1] = 178;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"DeepSkyBlue3",12) == 0) {
+		rgb[0] = 0;	rgb[1] = 154;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"DeepSkyBlue4",12) == 0) {
+		rgb[0] = 0;	rgb[1] = 104;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"SkyBlue1",8) == 0) {
+		rgb[0] = 135;	rgb[1] = 206;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"SkyBlue2",8) == 0) {
+		rgb[0] = 126;	rgb[1] = 192;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"SkyBlue3",8) == 0) {
+		rgb[0] = 108;	rgb[1] = 166;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"SkyBlue4",8) == 0) {
+		rgb[0] = 74;	rgb[1] = 112;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"LightSkyBlue1",13) == 0) {
+		rgb[0] = 176;	rgb[1] = 226;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"LightSkyBlue2",13) == 0) {
+		rgb[0] = 164;	rgb[1] = 211;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"LightSkyBlue3",13) == 0) {
+		rgb[0] = 141;	rgb[1] = 182;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"LightSkyBlue4",13) == 0) {
+		rgb[0] = 96;	rgb[1] = 123;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"SlateGray1",10) == 0) {
+		rgb[0] = 198;	rgb[1] = 226;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"SlateGray2",10) == 0) {
+		rgb[0] = 185;	rgb[1] = 211;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"SlateGray3",10) == 0) {
+		rgb[0] = 159;	rgb[1] = 182;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"SlateGray4",10) == 0) {
+		rgb[0] = 108;	rgb[1] = 123;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"LightSteelBlue1",15) == 0) {
+		rgb[0] = 202;	rgb[1] = 225;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"LightSteelBlue2",15) == 0) {
+		rgb[0] = 188;	rgb[1] = 210;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"LightSteelBlue3",15) == 0) {
+		rgb[0] = 162;	rgb[1] = 181;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"LightSteelBlue4",15) == 0) {
+		rgb[0] = 110;	rgb[1] = 123;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"LightBlue1",10) == 0) {
+		rgb[0] = 191;	rgb[1] = 239;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"LightBlue2",10) == 0) {
+		rgb[0] = 178;	rgb[1] = 223;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"LightBlue3",10) == 0) {
+		rgb[0] = 154;	rgb[1] = 192;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"LightBlue4",10) == 0) {
+		rgb[0] = 104;	rgb[1] = 131;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"LightCyan1",10) == 0) {
+		rgb[0] = 224;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"LightCyan2",10) == 0) {
+		rgb[0] = 209;	rgb[1] = 238;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"LightCyan3",10) == 0) {
+		rgb[0] = 180;	rgb[1] = 205;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"LightCyan4",10) == 0) {
+		rgb[0] = 122;	rgb[1] = 139;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"PaleTurquoise1",14) == 0) {
+		rgb[0] = 187;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"PaleTurquoise2",14) == 0) {
+		rgb[0] = 174;	rgb[1] = 238;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"PaleTurquoise3",14) == 0) {
+		rgb[0] = 150;	rgb[1] = 205;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"PaleTurquoise4",14) == 0) {
+		rgb[0] = 102;	rgb[1] = 139;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"CadetBlue1",10) == 0) {
+		rgb[0] = 152;	rgb[1] = 245;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"CadetBlue2",10) == 0) {
+		rgb[0] = 142;	rgb[1] = 229;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"CadetBlue3",10) == 0) {
+		rgb[0] = 122;	rgb[1] = 197;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"CadetBlue4",10) == 0) {
+		rgb[0] = 83;	rgb[1] = 134;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"turquoise1",10) == 0) {
+		rgb[0] = 0;	rgb[1] = 245;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"turquoise2",10) == 0) {
+		rgb[0] = 0;	rgb[1] = 229;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"turquoise3",10) == 0) {
+		rgb[0] = 0;	rgb[1] = 197;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"turquoise4",10) == 0) {
+		rgb[0] = 0;	rgb[1] = 134;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"cyan1",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"cyan2",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 238;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"cyan3",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 205;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"cyan4",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 139;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSlateGray1",14) == 0) {
+		rgb[0] = 151;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSlateGray2",14) == 0) {
+		rgb[0] = 141;	rgb[1] = 238;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSlateGray3",14) == 0) {
+		rgb[0] = 121;	rgb[1] = 205;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSlateGray4",14) == 0) {
+		rgb[0] = 82;	rgb[1] = 139;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"aquamarine1",11) == 0) {
+		rgb[0] = 127;	rgb[1] = 255;	rgb[2] = 212;
+	}
+	else if (strncasecmp(x11ColourName,"aquamarine2",11) == 0) {
+		rgb[0] = 118;	rgb[1] = 238;	rgb[2] = 198;
+	}
+	else if (strncasecmp(x11ColourName,"aquamarine3",11) == 0) {
+		rgb[0] = 102;	rgb[1] = 205;	rgb[2] = 170;
+	}
+	else if (strncasecmp(x11ColourName,"aquamarine4",11) == 0) {
+		rgb[0] = 69;	rgb[1] = 139;	rgb[2] = 116;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSeaGreen1",13) == 0) {
+		rgb[0] = 193;	rgb[1] = 255;	rgb[2] = 193;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSeaGreen2",13) == 0) {
+		rgb[0] = 180;	rgb[1] = 238;	rgb[2] = 180;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSeaGreen3",13) == 0) {
+		rgb[0] = 155;	rgb[1] = 205;	rgb[2] = 155;
+	}
+	else if (strncasecmp(x11ColourName,"DarkSeaGreen4",13) == 0) {
+		rgb[0] = 105;	rgb[1] = 139;	rgb[2] = 105;
+	}
+	else if (strncasecmp(x11ColourName,"SeaGreen1",9) == 0) {
+		rgb[0] = 84;	rgb[1] = 255;	rgb[2] = 159;
+	}
+	else if (strncasecmp(x11ColourName,"SeaGreen2",9) == 0) {
+		rgb[0] = 78;	rgb[1] = 238;	rgb[2] = 148;
+	}
+	else if (strncasecmp(x11ColourName,"SeaGreen3",9) == 0) {
+		rgb[0] = 67;	rgb[1] = 205;	rgb[2] = 128;
+	}
+	else if (strncasecmp(x11ColourName,"SeaGreen4",9) == 0) {
+		rgb[0] = 46;	rgb[1] = 139;	rgb[2] = 87;
+	}
+	else if (strncasecmp(x11ColourName,"PaleGreen1",10) == 0) {
+		rgb[0] = 154;	rgb[1] = 255;	rgb[2] = 154;
+	}
+	else if (strncasecmp(x11ColourName,"PaleGreen2",10) == 0) {
+		rgb[0] = 144;	rgb[1] = 238;	rgb[2] = 144;
+	}
+	else if (strncasecmp(x11ColourName,"PaleGreen3",10) == 0) {
+		rgb[0] = 124;	rgb[1] = 205;	rgb[2] = 124;
+	}
+	else if (strncasecmp(x11ColourName,"PaleGreen4",10) == 0) {
+		rgb[0] = 84;	rgb[1] = 139;	rgb[2] = 84;
+	}
+	else if (strncasecmp(x11ColourName,"SpringGreen1",12) == 0) {
+		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 127;
+	}
+	else if (strncasecmp(x11ColourName,"SpringGreen2",12) == 0) {
+		rgb[0] = 0;	rgb[1] = 238;	rgb[2] = 118;
+	}
+	else if (strncasecmp(x11ColourName,"SpringGreen3",12) == 0) {
+		rgb[0] = 0;	rgb[1] = 205;	rgb[2] = 102;
+	}
+	else if (strncasecmp(x11ColourName,"SpringGreen4",12) == 0) {
+		rgb[0] = 0;	rgb[1] = 139;	rgb[2] = 69;
+	}
+	else if (strncasecmp(x11ColourName,"green1",6) == 0) {
+		rgb[0] = 0;	rgb[1] = 255;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"green2",6) == 0) {
+		rgb[0] = 0;	rgb[1] = 238;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"green3",6) == 0) {
+		rgb[0] = 0;	rgb[1] = 205;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"green4",6) == 0) {
+		rgb[0] = 0;	rgb[1] = 139;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"chartreuse1",11) == 0) {
+		rgb[0] = 127;	rgb[1] = 255;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"chartreuse2",11) == 0) {
+		rgb[0] = 118;	rgb[1] = 238;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"chartreuse3",11) == 0) {
+		rgb[0] = 102;	rgb[1] = 205;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"chartreuse4",11) == 0) {
+		rgb[0] = 69;	rgb[1] = 139;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"OliveDrab1",10) == 0) {
+		rgb[0] = 192;	rgb[1] = 255;	rgb[2] = 62;
+	}
+	else if (strncasecmp(x11ColourName,"OliveDrab2",10) == 0) {
+		rgb[0] = 179;	rgb[1] = 238;	rgb[2] = 58;
+	}
+	else if (strncasecmp(x11ColourName,"OliveDrab3",10) == 0) {
+		rgb[0] = 154;	rgb[1] = 205;	rgb[2] = 50;
+	}
+	else if (strncasecmp(x11ColourName,"OliveDrab4",10) == 0) {
+		rgb[0] = 105;	rgb[1] = 139;	rgb[2] = 34;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOliveGreen1",15) == 0) {
+		rgb[0] = 202;	rgb[1] = 255;	rgb[2] = 112;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOliveGreen2",15) == 0) {
+		rgb[0] = 188;	rgb[1] = 238;	rgb[2] = 104;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOliveGreen3",15) == 0) {
+		rgb[0] = 162;	rgb[1] = 205;	rgb[2] = 90;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOliveGreen4",15) == 0) {
+		rgb[0] = 110;	rgb[1] = 139;	rgb[2] = 61;
+	}
+	else if (strncasecmp(x11ColourName,"khaki1",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 246;	rgb[2] = 143;
+	}
+	else if (strncasecmp(x11ColourName,"khaki2",6) == 0) {
+		rgb[0] = 238;	rgb[1] = 230;	rgb[2] = 133;
+	}
+	else if (strncasecmp(x11ColourName,"khaki3",6) == 0) {
+		rgb[0] = 205;	rgb[1] = 198;	rgb[2] = 115;
+	}
+	else if (strncasecmp(x11ColourName,"khaki4",6) == 0) {
+		rgb[0] = 139;	rgb[1] = 134;	rgb[2] = 78;
+	}
+	else if (strncasecmp(x11ColourName,"LightGoldenrod1",15) == 0) {
+		rgb[0] = 255;	rgb[1] = 236;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"LightGoldenrod2",15) == 0) {
+		rgb[0] = 238;	rgb[1] = 220;	rgb[2] = 130;
+	}
+	else if (strncasecmp(x11ColourName,"LightGoldenrod3",15) == 0) {
+		rgb[0] = 205;	rgb[1] = 190;	rgb[2] = 112;
+	}
+	else if (strncasecmp(x11ColourName,"LightGoldenrod4",15) == 0) {
+		rgb[0] = 139;	rgb[1] = 129;	rgb[2] = 76;
+	}
+	else if (strncasecmp(x11ColourName,"LightYellow1",12) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 224;
+	}
+	else if (strncasecmp(x11ColourName,"LightYellow2",12) == 0) {
+		rgb[0] = 238;	rgb[1] = 238;	rgb[2] = 209;
+	}
+	else if (strncasecmp(x11ColourName,"LightYellow3",12) == 0) {
+		rgb[0] = 205;	rgb[1] = 205;	rgb[2] = 180;
+	}
+	else if (strncasecmp(x11ColourName,"LightYellow4",12) == 0) {
+		rgb[0] = 139;	rgb[1] = 139;	rgb[2] = 122;
+	}
+	else if (strncasecmp(x11ColourName,"yellow1",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"yellow2",7) == 0) {
+		rgb[0] = 238;	rgb[1] = 238;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"yellow3",7) == 0) {
+		rgb[0] = 205;	rgb[1] = 205;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"yellow4",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 139;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"gold1",5) == 0) {
+		rgb[0] = 255;	rgb[1] = 215;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"gold2",5) == 0) {
+		rgb[0] = 238;	rgb[1] = 201;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"gold3",5) == 0) {
+		rgb[0] = 205;	rgb[1] = 173;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"gold4",5) == 0) {
+		rgb[0] = 139;	rgb[1] = 117;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"goldenrod1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 193;	rgb[2] = 37;
+	}
+	else if (strncasecmp(x11ColourName,"goldenrod2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 180;	rgb[2] = 34;
+	}
+	else if (strncasecmp(x11ColourName,"goldenrod3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 155;	rgb[2] = 29;
+	}
+	else if (strncasecmp(x11ColourName,"goldenrod4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 105;	rgb[2] = 20;
+	}
+	else if (strncasecmp(x11ColourName,"DarkGoldenrod1",14) == 0) {
+		rgb[0] = 255;	rgb[1] = 185;	rgb[2] = 15;
+	}
+	else if (strncasecmp(x11ColourName,"DarkGoldenrod2",14) == 0) {
+		rgb[0] = 238;	rgb[1] = 173;	rgb[2] = 14;
+	}
+	else if (strncasecmp(x11ColourName,"DarkGoldenrod3",14) == 0) {
+		rgb[0] = 205;	rgb[1] = 149;	rgb[2] = 12;
+	}
+	else if (strncasecmp(x11ColourName,"DarkGoldenrod4",14) == 0) {
+		rgb[0] = 139;	rgb[1] = 101;	rgb[2] = 8;
+	}
+	else if (strncasecmp(x11ColourName,"RosyBrown1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 193;	rgb[2] = 193;
+	}
+	else if (strncasecmp(x11ColourName,"RosyBrown2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 180;	rgb[2] = 180;
+	}
+	else if (strncasecmp(x11ColourName,"RosyBrown3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 155;	rgb[2] = 155;
+	}
+	else if (strncasecmp(x11ColourName,"RosyBrown4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 105;	rgb[2] = 105;
+	}
+	else if (strncasecmp(x11ColourName,"IndianRed1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 106;	rgb[2] = 106;
+	}
+	else if (strncasecmp(x11ColourName,"IndianRed2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 99;	rgb[2] = 99;
+	}
+	else if (strncasecmp(x11ColourName,"IndianRed3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 85;	rgb[2] = 85;
+	}
+	else if (strncasecmp(x11ColourName,"IndianRed4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 58;	rgb[2] = 58;
+	}
+	else if (strncasecmp(x11ColourName,"sienna1",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 130;	rgb[2] = 71;
+	}
+	else if (strncasecmp(x11ColourName,"sienna2",7) == 0) {
+		rgb[0] = 238;	rgb[1] = 121;	rgb[2] = 66;
+	}
+	else if (strncasecmp(x11ColourName,"sienna3",7) == 0) {
+		rgb[0] = 205;	rgb[1] = 104;	rgb[2] = 57;
+	}
+	else if (strncasecmp(x11ColourName,"sienna4",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 71;	rgb[2] = 38;
+	}
+	else if (strncasecmp(x11ColourName,"burlywood1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 211;	rgb[2] = 155;
+	}
+	else if (strncasecmp(x11ColourName,"burlywood2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 197;	rgb[2] = 145;
+	}
+	else if (strncasecmp(x11ColourName,"burlywood3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 170;	rgb[2] = 125;
+	}
+	else if (strncasecmp(x11ColourName,"burlywood4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 115;	rgb[2] = 85;
+	}
+	else if (strncasecmp(x11ColourName,"wheat1",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 231;	rgb[2] = 186;
+	}
+	else if (strncasecmp(x11ColourName,"wheat2",6) == 0) {
+		rgb[0] = 238;	rgb[1] = 216;	rgb[2] = 174;
+	}
+	else if (strncasecmp(x11ColourName,"wheat3",6) == 0) {
+		rgb[0] = 205;	rgb[1] = 186;	rgb[2] = 150;
+	}
+	else if (strncasecmp(x11ColourName,"wheat4",6) == 0) {
+		rgb[0] = 139;	rgb[1] = 126;	rgb[2] = 102;
+	}
+	else if (strncasecmp(x11ColourName,"tan1",4) == 0) {
+		rgb[0] = 255;	rgb[1] = 165;	rgb[2] = 79;
+	}
+	else if (strncasecmp(x11ColourName,"tan2",4) == 0) {
+		rgb[0] = 238;	rgb[1] = 154;	rgb[2] = 73;
+	}
+	else if (strncasecmp(x11ColourName,"tan3",4) == 0) {
+		rgb[0] = 205;	rgb[1] = 133;	rgb[2] = 63;
+	}
+	else if (strncasecmp(x11ColourName,"tan4",4) == 0) {
+		rgb[0] = 139;	rgb[1] = 90;	rgb[2] = 43;
+	}
+	else if (strncasecmp(x11ColourName,"chocolate1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 127;	rgb[2] = 36;
+	}
+	else if (strncasecmp(x11ColourName,"chocolate2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 118;	rgb[2] = 33;
+	}
+	else if (strncasecmp(x11ColourName,"chocolate3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 102;	rgb[2] = 29;
+	}
+	else if (strncasecmp(x11ColourName,"chocolate4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 69;	rgb[2] = 19;
+	}
+	else if (strncasecmp(x11ColourName,"firebrick1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 48;	rgb[2] = 48;
+	}
+	else if (strncasecmp(x11ColourName,"firebrick2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 44;	rgb[2] = 44;
+	}
+	else if (strncasecmp(x11ColourName,"firebrick3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 38;	rgb[2] = 38;
+	}
+	else if (strncasecmp(x11ColourName,"firebrick4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 26;	rgb[2] = 26;
+	}
+	else if (strncasecmp(x11ColourName,"brown1",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 64;	rgb[2] = 64;
+	}
+	else if (strncasecmp(x11ColourName,"brown2",6) == 0) {
+		rgb[0] = 238;	rgb[1] = 59;	rgb[2] = 59;
+	}
+	else if (strncasecmp(x11ColourName,"brown3",6) == 0) {
+		rgb[0] = 205;	rgb[1] = 51;	rgb[2] = 51;
+	}
+	else if (strncasecmp(x11ColourName,"brown4",6) == 0) {
+		rgb[0] = 139;	rgb[1] = 35;	rgb[2] = 35;
+	}
+	else if (strncasecmp(x11ColourName,"salmon1",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 140;	rgb[2] = 105;
+	}
+	else if (strncasecmp(x11ColourName,"salmon2",7) == 0) {
+		rgb[0] = 238;	rgb[1] = 130;	rgb[2] = 98;
+	}
+	else if (strncasecmp(x11ColourName,"salmon3",7) == 0) {
+		rgb[0] = 205;	rgb[1] = 112;	rgb[2] = 84;
+	}
+	else if (strncasecmp(x11ColourName,"salmon4",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 76;	rgb[2] = 57;
+	}
+	else if (strncasecmp(x11ColourName,"LightSalmon1",12) == 0) {
+		rgb[0] = 255;	rgb[1] = 160;	rgb[2] = 122;
+	}
+	else if (strncasecmp(x11ColourName,"LightSalmon2",12) == 0) {
+		rgb[0] = 238;	rgb[1] = 149;	rgb[2] = 114;
+	}
+	else if (strncasecmp(x11ColourName,"LightSalmon3",12) == 0) {
+		rgb[0] = 205;	rgb[1] = 129;	rgb[2] = 98;
+	}
+	else if (strncasecmp(x11ColourName,"LightSalmon4",12) == 0) {
+		rgb[0] = 139;	rgb[1] = 87;	rgb[2] = 66;
+	}
+	else if (strncasecmp(x11ColourName,"orange1",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 165;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"orange2",7) == 0) {
+		rgb[0] = 238;	rgb[1] = 154;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"orange3",7) == 0) {
+		rgb[0] = 205;	rgb[1] = 133;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"orange4",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 90;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrange1",11) == 0) {
+		rgb[0] = 255;	rgb[1] = 127;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrange2",11) == 0) {
+		rgb[0] = 238;	rgb[1] = 118;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrange3",11) == 0) {
+		rgb[0] = 205;	rgb[1] = 102;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrange4",11) == 0) {
+		rgb[0] = 139;	rgb[1] = 69;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"coral1",6) == 0) {
+		rgb[0] = 255;	rgb[1] = 114;	rgb[2] = 86;
+	}
+	else if (strncasecmp(x11ColourName,"coral2",6) == 0) {
+		rgb[0] = 238;	rgb[1] = 106;	rgb[2] = 80;
+	}
+	else if (strncasecmp(x11ColourName,"coral3",6) == 0) {
+		rgb[0] = 205;	rgb[1] = 91;	rgb[2] = 69;
+	}
+	else if (strncasecmp(x11ColourName,"coral4",6) == 0) {
+		rgb[0] = 139;	rgb[1] = 62;	rgb[2] = 47;
+	}
+	else if (strncasecmp(x11ColourName,"tomato1",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 99;	rgb[2] = 71;
+	}
+	else if (strncasecmp(x11ColourName,"tomato2",7) == 0) {
+		rgb[0] = 238;	rgb[1] = 92;	rgb[2] = 66;
+	}
+	else if (strncasecmp(x11ColourName,"tomato3",7) == 0) {
+		rgb[0] = 205;	rgb[1] = 79;	rgb[2] = 57;
+	}
+	else if (strncasecmp(x11ColourName,"tomato4",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 54;	rgb[2] = 38;
+	}
+	else if (strncasecmp(x11ColourName,"OrangeRed1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 69;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"OrangeRed2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 64;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"OrangeRed3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 55;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"OrangeRed4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 37;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"red1",4) == 0) {
+		rgb[0] = 255;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"red2",4) == 0) {
+		rgb[0] = 238;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"red3",4) == 0) {
+		rgb[0] = 205;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"red4",4) == 0) {
+		rgb[0] = 139;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"DeepPink1",9) == 0) {
+		rgb[0] = 255;	rgb[1] = 20;	rgb[2] = 147;
+	}
+	else if (strncasecmp(x11ColourName,"DeepPink2",9) == 0) {
+		rgb[0] = 238;	rgb[1] = 18;	rgb[2] = 137;
+	}
+	else if (strncasecmp(x11ColourName,"DeepPink3",9) == 0) {
+		rgb[0] = 205;	rgb[1] = 16;	rgb[2] = 118;
+	}
+	else if (strncasecmp(x11ColourName,"DeepPink4",9) == 0) {
+		rgb[0] = 139;	rgb[1] = 10;	rgb[2] = 80;
+	}
+	else if (strncasecmp(x11ColourName,"HotPink1",8) == 0) {
+		rgb[0] = 255;	rgb[1] = 110;	rgb[2] = 180;
+	}
+	else if (strncasecmp(x11ColourName,"HotPink2",8) == 0) {
+		rgb[0] = 238;	rgb[1] = 106;	rgb[2] = 167;
+	}
+	else if (strncasecmp(x11ColourName,"HotPink3",8) == 0) {
+		rgb[0] = 205;	rgb[1] = 96;	rgb[2] = 144;
+	}
+	else if (strncasecmp(x11ColourName,"HotPink4",8) == 0) {
+		rgb[0] = 139;	rgb[1] = 58;	rgb[2] = 98;
+	}
+	else if (strncasecmp(x11ColourName,"pink1",5) == 0) {
+		rgb[0] = 255;	rgb[1] = 181;	rgb[2] = 197;
+	}
+	else if (strncasecmp(x11ColourName,"pink2",5) == 0) {
+		rgb[0] = 238;	rgb[1] = 169;	rgb[2] = 184;
+	}
+	else if (strncasecmp(x11ColourName,"pink3",5) == 0) {
+		rgb[0] = 205;	rgb[1] = 145;	rgb[2] = 158;
+	}
+	else if (strncasecmp(x11ColourName,"pink4",5) == 0) {
+		rgb[0] = 139;	rgb[1] = 99;	rgb[2] = 108;
+	}
+	else if (strncasecmp(x11ColourName,"LightPink1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 174;	rgb[2] = 185;
+	}
+	else if (strncasecmp(x11ColourName,"LightPink2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 162;	rgb[2] = 173;
+	}
+	else if (strncasecmp(x11ColourName,"LightPink3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 140;	rgb[2] = 149;
+	}
+	else if (strncasecmp(x11ColourName,"LightPink4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 95;	rgb[2] = 101;
+	}
+	else if (strncasecmp(x11ColourName,"PaleVioletRed1",14) == 0) {
+		rgb[0] = 255;	rgb[1] = 130;	rgb[2] = 171;
+	}
+	else if (strncasecmp(x11ColourName,"PaleVioletRed2",14) == 0) {
+		rgb[0] = 238;	rgb[1] = 121;	rgb[2] = 159;
+	}
+	else if (strncasecmp(x11ColourName,"PaleVioletRed3",14) == 0) {
+		rgb[0] = 205;	rgb[1] = 104;	rgb[2] = 137;
+	}
+	else if (strncasecmp(x11ColourName,"PaleVioletRed4",14) == 0) {
+		rgb[0] = 139;	rgb[1] = 71;	rgb[2] = 93;
+	}
+	else if (strncasecmp(x11ColourName,"maroon1",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 52;	rgb[2] = 179;
+	}
+	else if (strncasecmp(x11ColourName,"maroon2",7) == 0) {
+		rgb[0] = 238;	rgb[1] = 48;	rgb[2] = 167;
+	}
+	else if (strncasecmp(x11ColourName,"maroon3",7) == 0) {
+		rgb[0] = 205;	rgb[1] = 41;	rgb[2] = 144;
+	}
+	else if (strncasecmp(x11ColourName,"maroon4",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 28;	rgb[2] = 98;
+	}
+	else if (strncasecmp(x11ColourName,"VioletRed1",10) == 0) {
+		rgb[0] = 255;	rgb[1] = 62;	rgb[2] = 150;
+	}
+	else if (strncasecmp(x11ColourName,"VioletRed2",10) == 0) {
+		rgb[0] = 238;	rgb[1] = 58;	rgb[2] = 140;
+	}
+	else if (strncasecmp(x11ColourName,"VioletRed3",10) == 0) {
+		rgb[0] = 205;	rgb[1] = 50;	rgb[2] = 120;
+	}
+	else if (strncasecmp(x11ColourName,"VioletRed4",10) == 0) {
+		rgb[0] = 139;	rgb[1] = 34;	rgb[2] = 82;
+	}
+	else if (strncasecmp(x11ColourName,"magenta1",8) == 0) {
+		rgb[0] = 255;	rgb[1] = 0;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"magenta2",8) == 0) {
+		rgb[0] = 238;	rgb[1] = 0;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"magenta3",8) == 0) {
+		rgb[0] = 205;	rgb[1] = 0;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"magenta4",8) == 0) {
+		rgb[0] = 139;	rgb[1] = 0;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"orchid1",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 131;	rgb[2] = 250;
+	}
+	else if (strncasecmp(x11ColourName,"orchid2",7) == 0) {
+		rgb[0] = 238;	rgb[1] = 122;	rgb[2] = 233;
+	}
+	else if (strncasecmp(x11ColourName,"orchid3",7) == 0) {
+		rgb[0] = 205;	rgb[1] = 105;	rgb[2] = 201;
+	}
+	else if (strncasecmp(x11ColourName,"orchid4",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 71;	rgb[2] = 137;
+	}
+	else if (strncasecmp(x11ColourName,"plum1",5) == 0) {
+		rgb[0] = 255;	rgb[1] = 187;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"plum2",5) == 0) {
+		rgb[0] = 238;	rgb[1] = 174;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"plum3",5) == 0) {
+		rgb[0] = 205;	rgb[1] = 150;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"plum4",5) == 0) {
+		rgb[0] = 139;	rgb[1] = 102;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"MediumOrchid1",13) == 0) {
+		rgb[0] = 224;	rgb[1] = 102;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"MediumOrchid2",13) == 0) {
+		rgb[0] = 209;	rgb[1] = 95;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"MediumOrchid3",13) == 0) {
+		rgb[0] = 180;	rgb[1] = 82;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"MediumOrchid4",13) == 0) {
+		rgb[0] = 122;	rgb[1] = 55;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrchid1",11) == 0) {
+		rgb[0] = 191;	rgb[1] = 62;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrchid2",11) == 0) {
+		rgb[0] = 178;	rgb[1] = 58;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrchid3",11) == 0) {
+		rgb[0] = 154;	rgb[1] = 50;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"DarkOrchid4",11) == 0) {
+		rgb[0] = 104;	rgb[1] = 34;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"purple1",7) == 0) {
+		rgb[0] = 155;	rgb[1] = 48;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"purple2",7) == 0) {
+		rgb[0] = 145;	rgb[1] = 44;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"purple3",7) == 0) {
+		rgb[0] = 125;	rgb[1] = 38;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"purple4",7) == 0) {
+		rgb[0] = 85;	rgb[1] = 26;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"MediumPurple1",13) == 0) {
+		rgb[0] = 171;	rgb[1] = 130;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"MediumPurple2",13) == 0) {
+		rgb[0] = 159;	rgb[1] = 121;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"MediumPurple3",13) == 0) {
+		rgb[0] = 137;	rgb[1] = 104;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"MediumPurple4",13) == 0) {
+		rgb[0] = 93;	rgb[1] = 71;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"thistle1",8) == 0) {
+		rgb[0] = 255;	rgb[1] = 225;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"thistle2",8) == 0) {
+		rgb[0] = 238;	rgb[1] = 210;	rgb[2] = 238;
+	}
+	else if (strncasecmp(x11ColourName,"thistle3",8) == 0) {
+		rgb[0] = 205;	rgb[1] = 181;	rgb[2] = 205;
+	}
+	else if (strncasecmp(x11ColourName,"thistle4",8) == 0) {
+		rgb[0] = 139;	rgb[1] = 123;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"gray0",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"grey0",5) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"gray1",5) == 0) {
+		rgb[0] = 3;	rgb[1] = 3;	rgb[2] = 3;
+	}
+	else if (strncasecmp(x11ColourName,"grey1",5) == 0) {
+		rgb[0] = 3;	rgb[1] = 3;	rgb[2] = 3;
+	}
+	else if (strncasecmp(x11ColourName,"gray2",5) == 0) {
+		rgb[0] = 5;	rgb[1] = 5;	rgb[2] = 5;
+	}
+	else if (strncasecmp(x11ColourName,"grey2",5) == 0) {
+		rgb[0] = 5;	rgb[1] = 5;	rgb[2] = 5;
+	}
+	else if (strncasecmp(x11ColourName,"gray3",5) == 0) {
+		rgb[0] = 8;	rgb[1] = 8;	rgb[2] = 8;
+	}
+	else if (strncasecmp(x11ColourName,"grey3",5) == 0) {
+		rgb[0] = 8;	rgb[1] = 8;	rgb[2] = 8;
+	}
+	else if (strncasecmp(x11ColourName,"gray4",5) == 0) {
+		rgb[0] = 10;	rgb[1] = 10;	rgb[2] = 10;
+	}
+	else if (strncasecmp(x11ColourName,"grey4",5) == 0) {
+		rgb[0] = 10;	rgb[1] = 10;	rgb[2] = 10;
+	}
+	else if (strncasecmp(x11ColourName,"gray5",5) == 0) {
+		rgb[0] = 13;	rgb[1] = 13;	rgb[2] = 13;
+	}
+	else if (strncasecmp(x11ColourName,"grey5",5) == 0) {
+		rgb[0] = 13;	rgb[1] = 13;	rgb[2] = 13;
+	}
+	else if (strncasecmp(x11ColourName,"gray6",5) == 0) {
+		rgb[0] = 15;	rgb[1] = 15;	rgb[2] = 15;
+	}
+	else if (strncasecmp(x11ColourName,"grey6",5) == 0) {
+		rgb[0] = 15;	rgb[1] = 15;	rgb[2] = 15;
+	}
+	else if (strncasecmp(x11ColourName,"gray7",5) == 0) {
+		rgb[0] = 18;	rgb[1] = 18;	rgb[2] = 18;
+	}
+	else if (strncasecmp(x11ColourName,"grey7",5) == 0) {
+		rgb[0] = 18;	rgb[1] = 18;	rgb[2] = 18;
+	}
+	else if (strncasecmp(x11ColourName,"gray8",5) == 0) {
+		rgb[0] = 20;	rgb[1] = 20;	rgb[2] = 20;
+	}
+	else if (strncasecmp(x11ColourName,"grey8",5) == 0) {
+		rgb[0] = 20;	rgb[1] = 20;	rgb[2] = 20;
+	}
+	else if (strncasecmp(x11ColourName,"gray9",5) == 0) {
+		rgb[0] = 23;	rgb[1] = 23;	rgb[2] = 23;
+	}
+	else if (strncasecmp(x11ColourName,"grey9",5) == 0) {
+		rgb[0] = 23;	rgb[1] = 23;	rgb[2] = 23;
+	}
+	else if (strncasecmp(x11ColourName,"gray10",6) == 0) {
+		rgb[0] = 26;	rgb[1] = 26;	rgb[2] = 26;
+	}
+	else if (strncasecmp(x11ColourName,"grey10",6) == 0) {
+		rgb[0] = 26;	rgb[1] = 26;	rgb[2] = 26;
+	}
+	else if (strncasecmp(x11ColourName,"gray11",6) == 0) {
+		rgb[0] = 28;	rgb[1] = 28;	rgb[2] = 28;
+	}
+	else if (strncasecmp(x11ColourName,"grey11",6) == 0) {
+		rgb[0] = 28;	rgb[1] = 28;	rgb[2] = 28;
+	}
+	else if (strncasecmp(x11ColourName,"gray12",6) == 0) {
+		rgb[0] = 31;	rgb[1] = 31;	rgb[2] = 31;
+	}
+	else if (strncasecmp(x11ColourName,"grey12",6) == 0) {
+		rgb[0] = 31;	rgb[1] = 31;	rgb[2] = 31;
+	}
+	else if (strncasecmp(x11ColourName,"gray13",6) == 0) {
+		rgb[0] = 33;	rgb[1] = 33;	rgb[2] = 33;
+	}
+	else if (strncasecmp(x11ColourName,"grey13",6) == 0) {
+		rgb[0] = 33;	rgb[1] = 33;	rgb[2] = 33;
+	}
+	else if (strncasecmp(x11ColourName,"gray14",6) == 0) {
+		rgb[0] = 36;	rgb[1] = 36;	rgb[2] = 36;
+	}
+	else if (strncasecmp(x11ColourName,"grey14",6) == 0) {
+		rgb[0] = 36;	rgb[1] = 36;	rgb[2] = 36;
+	}
+	else if (strncasecmp(x11ColourName,"gray15",6) == 0) {
+		rgb[0] = 38;	rgb[1] = 38;	rgb[2] = 38;
+	}
+	else if (strncasecmp(x11ColourName,"grey15",6) == 0) {
+		rgb[0] = 38;	rgb[1] = 38;	rgb[2] = 38;
+	}
+	else if (strncasecmp(x11ColourName,"gray16",6) == 0) {
+		rgb[0] = 41;	rgb[1] = 41;	rgb[2] = 41;
+	}
+	else if (strncasecmp(x11ColourName,"grey16",6) == 0) {
+		rgb[0] = 41;	rgb[1] = 41;	rgb[2] = 41;
+	}
+	else if (strncasecmp(x11ColourName,"gray17",6) == 0) {
+		rgb[0] = 43;	rgb[1] = 43;	rgb[2] = 43;
+	}
+	else if (strncasecmp(x11ColourName,"grey17",6) == 0) {
+		rgb[0] = 43;	rgb[1] = 43;	rgb[2] = 43;
+	}
+	else if (strncasecmp(x11ColourName,"gray18",6) == 0) {
+		rgb[0] = 46;	rgb[1] = 46;	rgb[2] = 46;
+	}
+	else if (strncasecmp(x11ColourName,"grey18",6) == 0) {
+		rgb[0] = 46;	rgb[1] = 46;	rgb[2] = 46;
+	}
+	else if (strncasecmp(x11ColourName,"gray19",6) == 0) {
+		rgb[0] = 48;	rgb[1] = 48;	rgb[2] = 48;
+	}
+	else if (strncasecmp(x11ColourName,"grey19",6) == 0) {
+		rgb[0] = 48;	rgb[1] = 48;	rgb[2] = 48;
+	}
+	else if (strncasecmp(x11ColourName,"gray20",6) == 0) {
+		rgb[0] = 51;	rgb[1] = 51;	rgb[2] = 51;
+	}
+	else if (strncasecmp(x11ColourName,"grey20",6) == 0) {
+		rgb[0] = 51;	rgb[1] = 51;	rgb[2] = 51;
+	}
+	else if (strncasecmp(x11ColourName,"gray21",6) == 0) {
+		rgb[0] = 54;	rgb[1] = 54;	rgb[2] = 54;
+	}
+	else if (strncasecmp(x11ColourName,"grey21",6) == 0) {
+		rgb[0] = 54;	rgb[1] = 54;	rgb[2] = 54;
+	}
+	else if (strncasecmp(x11ColourName,"gray22",6) == 0) {
+		rgb[0] = 56;	rgb[1] = 56;	rgb[2] = 56;
+	}
+	else if (strncasecmp(x11ColourName,"grey22",6) == 0) {
+		rgb[0] = 56;	rgb[1] = 56;	rgb[2] = 56;
+	}
+	else if (strncasecmp(x11ColourName,"gray23",6) == 0) {
+		rgb[0] = 59;	rgb[1] = 59;	rgb[2] = 59;
+	}
+	else if (strncasecmp(x11ColourName,"grey23",6) == 0) {
+		rgb[0] = 59;	rgb[1] = 59;	rgb[2] = 59;
+	}
+	else if (strncasecmp(x11ColourName,"gray24",6) == 0) {
+		rgb[0] = 61;	rgb[1] = 61;	rgb[2] = 61;
+	}
+	else if (strncasecmp(x11ColourName,"grey24",6) == 0) {
+		rgb[0] = 61;	rgb[1] = 61;	rgb[2] = 61;
+	}
+	else if (strncasecmp(x11ColourName,"gray25",6) == 0) {
+		rgb[0] = 64;	rgb[1] = 64;	rgb[2] = 64;
+	}
+	else if (strncasecmp(x11ColourName,"grey25",6) == 0) {
+		rgb[0] = 64;	rgb[1] = 64;	rgb[2] = 64;
+	}
+	else if (strncasecmp(x11ColourName,"gray26",6) == 0) {
+		rgb[0] = 66;	rgb[1] = 66;	rgb[2] = 66;
+	}
+	else if (strncasecmp(x11ColourName,"grey26",6) == 0) {
+		rgb[0] = 66;	rgb[1] = 66;	rgb[2] = 66;
+	}
+	else if (strncasecmp(x11ColourName,"gray27",6) == 0) {
+		rgb[0] = 69;	rgb[1] = 69;	rgb[2] = 69;
+	}
+	else if (strncasecmp(x11ColourName,"grey27",6) == 0) {
+		rgb[0] = 69;	rgb[1] = 69;	rgb[2] = 69;
+	}
+	else if (strncasecmp(x11ColourName,"gray28",6) == 0) {
+		rgb[0] = 71;	rgb[1] = 71;	rgb[2] = 71;
+	}
+	else if (strncasecmp(x11ColourName,"grey28",6) == 0) {
+		rgb[0] = 71;	rgb[1] = 71;	rgb[2] = 71;
+	}
+	else if (strncasecmp(x11ColourName,"gray29",6) == 0) {
+		rgb[0] = 74;	rgb[1] = 74;	rgb[2] = 74;
+	}
+	else if (strncasecmp(x11ColourName,"grey29",6) == 0) {
+		rgb[0] = 74;	rgb[1] = 74;	rgb[2] = 74;
+	}
+	else if (strncasecmp(x11ColourName,"gray30",6) == 0) {
+		rgb[0] = 77;	rgb[1] = 77;	rgb[2] = 77;
+	}
+	else if (strncasecmp(x11ColourName,"grey30",6) == 0) {
+		rgb[0] = 77;	rgb[1] = 77;	rgb[2] = 77;
+	}
+	else if (strncasecmp(x11ColourName,"gray31",6) == 0) {
+		rgb[0] = 79;	rgb[1] = 79;	rgb[2] = 79;
+	}
+	else if (strncasecmp(x11ColourName,"grey31",6) == 0) {
+		rgb[0] = 79;	rgb[1] = 79;	rgb[2] = 79;
+	}
+	else if (strncasecmp(x11ColourName,"gray32",6) == 0) {
+		rgb[0] = 82;	rgb[1] = 82;	rgb[2] = 82;
+	}
+	else if (strncasecmp(x11ColourName,"grey32",6) == 0) {
+		rgb[0] = 82;	rgb[1] = 82;	rgb[2] = 82;
+	}
+	else if (strncasecmp(x11ColourName,"gray33",6) == 0) {
+		rgb[0] = 84;	rgb[1] = 84;	rgb[2] = 84;
+	}
+	else if (strncasecmp(x11ColourName,"grey33",6) == 0) {
+		rgb[0] = 84;	rgb[1] = 84;	rgb[2] = 84;
+	}
+	else if (strncasecmp(x11ColourName,"gray34",6) == 0) {
+		rgb[0] = 87;	rgb[1] = 87;	rgb[2] = 87;
+	}
+	else if (strncasecmp(x11ColourName,"grey34",6) == 0) {
+		rgb[0] = 87;	rgb[1] = 87;	rgb[2] = 87;
+	}
+	else if (strncasecmp(x11ColourName,"gray35",6) == 0) {
+		rgb[0] = 89;	rgb[1] = 89;	rgb[2] = 89;
+	}
+	else if (strncasecmp(x11ColourName,"grey35",6) == 0) {
+		rgb[0] = 89;	rgb[1] = 89;	rgb[2] = 89;
+	}
+	else if (strncasecmp(x11ColourName,"gray36",6) == 0) {
+		rgb[0] = 92;	rgb[1] = 92;	rgb[2] = 92;
+	}
+	else if (strncasecmp(x11ColourName,"grey36",6) == 0) {
+		rgb[0] = 92;	rgb[1] = 92;	rgb[2] = 92;
+	}
+	else if (strncasecmp(x11ColourName,"gray37",6) == 0) {
+		rgb[0] = 94;	rgb[1] = 94;	rgb[2] = 94;
+	}
+	else if (strncasecmp(x11ColourName,"grey37",6) == 0) {
+		rgb[0] = 94;	rgb[1] = 94;	rgb[2] = 94;
+	}
+	else if (strncasecmp(x11ColourName,"gray38",6) == 0) {
+		rgb[0] = 97;	rgb[1] = 97;	rgb[2] = 97;
+	}
+	else if (strncasecmp(x11ColourName,"grey38",6) == 0) {
+		rgb[0] = 97;	rgb[1] = 97;	rgb[2] = 97;
+	}
+	else if (strncasecmp(x11ColourName,"gray39",6) == 0) {
+		rgb[0] = 99;	rgb[1] = 99;	rgb[2] = 99;
+	}
+	else if (strncasecmp(x11ColourName,"grey39",6) == 0) {
+		rgb[0] = 99;	rgb[1] = 99;	rgb[2] = 99;
+	}
+	else if (strncasecmp(x11ColourName,"gray40",6) == 0) {
+		rgb[0] = 102;	rgb[1] = 102;	rgb[2] = 102;
+	}
+	else if (strncasecmp(x11ColourName,"grey40",6) == 0) {
+		rgb[0] = 102;	rgb[1] = 102;	rgb[2] = 102;
+	}
+	else if (strncasecmp(x11ColourName,"gray41",6) == 0) {
+		rgb[0] = 105;	rgb[1] = 105;	rgb[2] = 105;
+	}
+	else if (strncasecmp(x11ColourName,"grey41",6) == 0) {
+		rgb[0] = 105;	rgb[1] = 105;	rgb[2] = 105;
+	}
+	else if (strncasecmp(x11ColourName,"gray42",6) == 0) {
+		rgb[0] = 107;	rgb[1] = 107;	rgb[2] = 107;
+	}
+	else if (strncasecmp(x11ColourName,"grey42",6) == 0) {
+		rgb[0] = 107;	rgb[1] = 107;	rgb[2] = 107;
+	}
+	else if (strncasecmp(x11ColourName,"gray43",6) == 0) {
+		rgb[0] = 110;	rgb[1] = 110;	rgb[2] = 110;
+	}
+	else if (strncasecmp(x11ColourName,"grey43",6) == 0) {
+		rgb[0] = 110;	rgb[1] = 110;	rgb[2] = 110;
+	}
+	else if (strncasecmp(x11ColourName,"gray44",6) == 0) {
+		rgb[0] = 112;	rgb[1] = 112;	rgb[2] = 112;
+	}
+	else if (strncasecmp(x11ColourName,"grey44",6) == 0) {
+		rgb[0] = 112;	rgb[1] = 112;	rgb[2] = 112;
+	}
+	else if (strncasecmp(x11ColourName,"gray45",6) == 0) {
+		rgb[0] = 115;	rgb[1] = 115;	rgb[2] = 115;
+	}
+	else if (strncasecmp(x11ColourName,"grey45",6) == 0) {
+		rgb[0] = 115;	rgb[1] = 115;	rgb[2] = 115;
+	}
+	else if (strncasecmp(x11ColourName,"gray46",6) == 0) {
+		rgb[0] = 117;	rgb[1] = 117;	rgb[2] = 117;
+	}
+	else if (strncasecmp(x11ColourName,"grey46",6) == 0) {
+		rgb[0] = 117;	rgb[1] = 117;	rgb[2] = 117;
+	}
+	else if (strncasecmp(x11ColourName,"gray47",6) == 0) {
+		rgb[0] = 120;	rgb[1] = 120;	rgb[2] = 120;
+	}
+	else if (strncasecmp(x11ColourName,"grey47",6) == 0) {
+		rgb[0] = 120;	rgb[1] = 120;	rgb[2] = 120;
+	}
+	else if (strncasecmp(x11ColourName,"gray48",6) == 0) {
+		rgb[0] = 122;	rgb[1] = 122;	rgb[2] = 122;
+	}
+	else if (strncasecmp(x11ColourName,"grey48",6) == 0) {
+		rgb[0] = 122;	rgb[1] = 122;	rgb[2] = 122;
+	}
+	else if (strncasecmp(x11ColourName,"gray49",6) == 0) {
+		rgb[0] = 125;	rgb[1] = 125;	rgb[2] = 125;
+	}
+	else if (strncasecmp(x11ColourName,"grey49",6) == 0) {
+		rgb[0] = 125;	rgb[1] = 125;	rgb[2] = 125;
+	}
+	else if (strncasecmp(x11ColourName,"gray50",6) == 0) {
+		rgb[0] = 127;	rgb[1] = 127;	rgb[2] = 127;
+	}
+	else if (strncasecmp(x11ColourName,"grey50",6) == 0) {
+		rgb[0] = 127;	rgb[1] = 127;	rgb[2] = 127;
+	}
+	else if (strncasecmp(x11ColourName,"gray51",6) == 0) {
+		rgb[0] = 130;	rgb[1] = 130;	rgb[2] = 130;
+	}
+	else if (strncasecmp(x11ColourName,"grey51",6) == 0) {
+		rgb[0] = 130;	rgb[1] = 130;	rgb[2] = 130;
+	}
+	else if (strncasecmp(x11ColourName,"gray52",6) == 0) {
+		rgb[0] = 133;	rgb[1] = 133;	rgb[2] = 133;
+	}
+	else if (strncasecmp(x11ColourName,"grey52",6) == 0) {
+		rgb[0] = 133;	rgb[1] = 133;	rgb[2] = 133;
+	}
+	else if (strncasecmp(x11ColourName,"gray53",6) == 0) {
+		rgb[0] = 135;	rgb[1] = 135;	rgb[2] = 135;
+	}
+	else if (strncasecmp(x11ColourName,"grey53",6) == 0) {
+		rgb[0] = 135;	rgb[1] = 135;	rgb[2] = 135;
+	}
+	else if (strncasecmp(x11ColourName,"gray54",6) == 0) {
+		rgb[0] = 138;	rgb[1] = 138;	rgb[2] = 138;
+	}
+	else if (strncasecmp(x11ColourName,"grey54",6) == 0) {
+		rgb[0] = 138;	rgb[1] = 138;	rgb[2] = 138;
+	}
+	else if (strncasecmp(x11ColourName,"gray55",6) == 0) {
+		rgb[0] = 140;	rgb[1] = 140;	rgb[2] = 140;
+	}
+	else if (strncasecmp(x11ColourName,"grey55",6) == 0) {
+		rgb[0] = 140;	rgb[1] = 140;	rgb[2] = 140;
+	}
+	else if (strncasecmp(x11ColourName,"gray56",6) == 0) {
+		rgb[0] = 143;	rgb[1] = 143;	rgb[2] = 143;
+	}
+	else if (strncasecmp(x11ColourName,"grey56",6) == 0) {
+		rgb[0] = 143;	rgb[1] = 143;	rgb[2] = 143;
+	}
+	else if (strncasecmp(x11ColourName,"gray57",6) == 0) {
+		rgb[0] = 145;	rgb[1] = 145;	rgb[2] = 145;
+	}
+	else if (strncasecmp(x11ColourName,"grey57",6) == 0) {
+		rgb[0] = 145;	rgb[1] = 145;	rgb[2] = 145;
+	}
+	else if (strncasecmp(x11ColourName,"gray58",6) == 0) {
+		rgb[0] = 148;	rgb[1] = 148;	rgb[2] = 148;
+	}
+	else if (strncasecmp(x11ColourName,"grey58",6) == 0) {
+		rgb[0] = 148;	rgb[1] = 148;	rgb[2] = 148;
+	}
+	else if (strncasecmp(x11ColourName,"gray59",6) == 0) {
+		rgb[0] = 150;	rgb[1] = 150;	rgb[2] = 150;
+	}
+	else if (strncasecmp(x11ColourName,"grey59",6) == 0) {
+		rgb[0] = 150;	rgb[1] = 150;	rgb[2] = 150;
+	}
+	else if (strncasecmp(x11ColourName,"gray60",6) == 0) {
+		rgb[0] = 153;	rgb[1] = 153;	rgb[2] = 153;
+	}
+	else if (strncasecmp(x11ColourName,"grey60",6) == 0) {
+		rgb[0] = 153;	rgb[1] = 153;	rgb[2] = 153;
+	}
+	else if (strncasecmp(x11ColourName,"gray61",6) == 0) {
+		rgb[0] = 156;	rgb[1] = 156;	rgb[2] = 156;
+	}
+	else if (strncasecmp(x11ColourName,"grey61",6) == 0) {
+		rgb[0] = 156;	rgb[1] = 156;	rgb[2] = 156;
+	}
+	else if (strncasecmp(x11ColourName,"gray62",6) == 0) {
+		rgb[0] = 158;	rgb[1] = 158;	rgb[2] = 158;
+	}
+	else if (strncasecmp(x11ColourName,"grey62",6) == 0) {
+		rgb[0] = 158;	rgb[1] = 158;	rgb[2] = 158;
+	}
+	else if (strncasecmp(x11ColourName,"gray63",6) == 0) {
+		rgb[0] = 161;	rgb[1] = 161;	rgb[2] = 161;
+	}
+	else if (strncasecmp(x11ColourName,"grey63",6) == 0) {
+		rgb[0] = 161;	rgb[1] = 161;	rgb[2] = 161;
+	}
+	else if (strncasecmp(x11ColourName,"gray64",6) == 0) {
+		rgb[0] = 163;	rgb[1] = 163;	rgb[2] = 163;
+	}
+	else if (strncasecmp(x11ColourName,"grey64",6) == 0) {
+		rgb[0] = 163;	rgb[1] = 163;	rgb[2] = 163;
+	}
+	else if (strncasecmp(x11ColourName,"gray65",6) == 0) {
+		rgb[0] = 166;	rgb[1] = 166;	rgb[2] = 166;
+	}
+	else if (strncasecmp(x11ColourName,"grey65",6) == 0) {
+		rgb[0] = 166;	rgb[1] = 166;	rgb[2] = 166;
+	}
+	else if (strncasecmp(x11ColourName,"gray66",6) == 0) {
+		rgb[0] = 168;	rgb[1] = 168;	rgb[2] = 168;
+	}
+	else if (strncasecmp(x11ColourName,"grey66",6) == 0) {
+		rgb[0] = 168;	rgb[1] = 168;	rgb[2] = 168;
+	}
+	else if (strncasecmp(x11ColourName,"gray67",6) == 0) {
+		rgb[0] = 171;	rgb[1] = 171;	rgb[2] = 171;
+	}
+	else if (strncasecmp(x11ColourName,"grey67",6) == 0) {
+		rgb[0] = 171;	rgb[1] = 171;	rgb[2] = 171;
+	}
+	else if (strncasecmp(x11ColourName,"gray68",6) == 0) {
+		rgb[0] = 173;	rgb[1] = 173;	rgb[2] = 173;
+	}
+	else if (strncasecmp(x11ColourName,"grey68",6) == 0) {
+		rgb[0] = 173;	rgb[1] = 173;	rgb[2] = 173;
+	}
+	else if (strncasecmp(x11ColourName,"gray69",6) == 0) {
+		rgb[0] = 176;	rgb[1] = 176;	rgb[2] = 176;
+	}
+	else if (strncasecmp(x11ColourName,"grey69",6) == 0) {
+		rgb[0] = 176;	rgb[1] = 176;	rgb[2] = 176;
+	}
+	else if (strncasecmp(x11ColourName,"gray70",6) == 0) {
+		rgb[0] = 179;	rgb[1] = 179;	rgb[2] = 179;
+	}
+	else if (strncasecmp(x11ColourName,"grey70",6) == 0) {
+		rgb[0] = 179;	rgb[1] = 179;	rgb[2] = 179;
+	}
+	else if (strncasecmp(x11ColourName,"gray71",6) == 0) {
+		rgb[0] = 181;	rgb[1] = 181;	rgb[2] = 181;
+	}
+	else if (strncasecmp(x11ColourName,"grey71",6) == 0) {
+		rgb[0] = 181;	rgb[1] = 181;	rgb[2] = 181;
+	}
+	else if (strncasecmp(x11ColourName,"gray72",6) == 0) {
+		rgb[0] = 184;	rgb[1] = 184;	rgb[2] = 184;
+	}
+	else if (strncasecmp(x11ColourName,"grey72",6) == 0) {
+		rgb[0] = 184;	rgb[1] = 184;	rgb[2] = 184;
+	}
+	else if (strncasecmp(x11ColourName,"gray73",6) == 0) {
+		rgb[0] = 186;	rgb[1] = 186;	rgb[2] = 186;
+	}
+	else if (strncasecmp(x11ColourName,"grey73",6) == 0) {
+		rgb[0] = 186;	rgb[1] = 186;	rgb[2] = 186;
+	}
+	else if (strncasecmp(x11ColourName,"gray74",6) == 0) {
+		rgb[0] = 189;	rgb[1] = 189;	rgb[2] = 189;
+	}
+	else if (strncasecmp(x11ColourName,"grey74",6) == 0) {
+		rgb[0] = 189;	rgb[1] = 189;	rgb[2] = 189;
+	}
+	else if (strncasecmp(x11ColourName,"gray75",6) == 0) {
+		rgb[0] = 191;	rgb[1] = 191;	rgb[2] = 191;
+	}
+	else if (strncasecmp(x11ColourName,"grey75",6) == 0) {
+		rgb[0] = 191;	rgb[1] = 191;	rgb[2] = 191;
+	}
+	else if (strncasecmp(x11ColourName,"gray76",6) == 0) {
+		rgb[0] = 194;	rgb[1] = 194;	rgb[2] = 194;
+	}
+	else if (strncasecmp(x11ColourName,"grey76",6) == 0) {
+		rgb[0] = 194;	rgb[1] = 194;	rgb[2] = 194;
+	}
+	else if (strncasecmp(x11ColourName,"gray77",6) == 0) {
+		rgb[0] = 196;	rgb[1] = 196;	rgb[2] = 196;
+	}
+	else if (strncasecmp(x11ColourName,"grey77",6) == 0) {
+		rgb[0] = 196;	rgb[1] = 196;	rgb[2] = 196;
+	}
+	else if (strncasecmp(x11ColourName,"gray78",6) == 0) {
+		rgb[0] = 199;	rgb[1] = 199;	rgb[2] = 199;
+	}
+	else if (strncasecmp(x11ColourName,"grey78",6) == 0) {
+		rgb[0] = 199;	rgb[1] = 199;	rgb[2] = 199;
+	}
+	else if (strncasecmp(x11ColourName,"gray79",6) == 0) {
+		rgb[0] = 201;	rgb[1] = 201;	rgb[2] = 201;
+	}
+	else if (strncasecmp(x11ColourName,"grey79",6) == 0) {
+		rgb[0] = 201;	rgb[1] = 201;	rgb[2] = 201;
+	}
+	else if (strncasecmp(x11ColourName,"gray80",6) == 0) {
+		rgb[0] = 204;	rgb[1] = 204;	rgb[2] = 204;
+	}
+	else if (strncasecmp(x11ColourName,"grey80",6) == 0) {
+		rgb[0] = 204;	rgb[1] = 204;	rgb[2] = 204;
+	}
+	else if (strncasecmp(x11ColourName,"gray81",6) == 0) {
+		rgb[0] = 207;	rgb[1] = 207;	rgb[2] = 207;
+	}
+	else if (strncasecmp(x11ColourName,"grey81",6) == 0) {
+		rgb[0] = 207;	rgb[1] = 207;	rgb[2] = 207;
+	}
+	else if (strncasecmp(x11ColourName,"gray82",6) == 0) {
+		rgb[0] = 209;	rgb[1] = 209;	rgb[2] = 209;
+	}
+	else if (strncasecmp(x11ColourName,"grey82",6) == 0) {
+		rgb[0] = 209;	rgb[1] = 209;	rgb[2] = 209;
+	}
+	else if (strncasecmp(x11ColourName,"gray83",6) == 0) {
+		rgb[0] = 212;	rgb[1] = 212;	rgb[2] = 212;
+	}
+	else if (strncasecmp(x11ColourName,"grey83",6) == 0) {
+		rgb[0] = 212;	rgb[1] = 212;	rgb[2] = 212;
+	}
+	else if (strncasecmp(x11ColourName,"gray84",6) == 0) {
+		rgb[0] = 214;	rgb[1] = 214;	rgb[2] = 214;
+	}
+	else if (strncasecmp(x11ColourName,"grey84",6) == 0) {
+		rgb[0] = 214;	rgb[1] = 214;	rgb[2] = 214;
+	}
+	else if (strncasecmp(x11ColourName,"gray85",6) == 0) {
+		rgb[0] = 217;	rgb[1] = 217;	rgb[2] = 217;
+	}
+	else if (strncasecmp(x11ColourName,"grey85",6) == 0) {
+		rgb[0] = 217;	rgb[1] = 217;	rgb[2] = 217;
+	}
+	else if (strncasecmp(x11ColourName,"gray86",6) == 0) {
+		rgb[0] = 219;	rgb[1] = 219;	rgb[2] = 219;
+	}
+	else if (strncasecmp(x11ColourName,"grey86",6) == 0) {
+		rgb[0] = 219;	rgb[1] = 219;	rgb[2] = 219;
+	}
+	else if (strncasecmp(x11ColourName,"gray87",6) == 0) {
+		rgb[0] = 222;	rgb[1] = 222;	rgb[2] = 222;
+	}
+	else if (strncasecmp(x11ColourName,"grey87",6) == 0) {
+		rgb[0] = 222;	rgb[1] = 222;	rgb[2] = 222;
+	}
+	else if (strncasecmp(x11ColourName,"gray88",6) == 0) {
+		rgb[0] = 224;	rgb[1] = 224;	rgb[2] = 224;
+	}
+	else if (strncasecmp(x11ColourName,"grey88",6) == 0) {
+		rgb[0] = 224;	rgb[1] = 224;	rgb[2] = 224;
+	}
+	else if (strncasecmp(x11ColourName,"gray89",6) == 0) {
+		rgb[0] = 227;	rgb[1] = 227;	rgb[2] = 227;
+	}
+	else if (strncasecmp(x11ColourName,"grey89",6) == 0) {
+		rgb[0] = 227;	rgb[1] = 227;	rgb[2] = 227;
+	}
+	else if (strncasecmp(x11ColourName,"gray90",6) == 0) {
+		rgb[0] = 229;	rgb[1] = 229;	rgb[2] = 229;
+	}
+	else if (strncasecmp(x11ColourName,"grey90",6) == 0) {
+		rgb[0] = 229;	rgb[1] = 229;	rgb[2] = 229;
+	}
+	else if (strncasecmp(x11ColourName,"gray91",6) == 0) {
+		rgb[0] = 232;	rgb[1] = 232;	rgb[2] = 232;
+	}
+	else if (strncasecmp(x11ColourName,"grey91",6) == 0) {
+		rgb[0] = 232;	rgb[1] = 232;	rgb[2] = 232;
+	}
+	else if (strncasecmp(x11ColourName,"gray92",6) == 0) {
+		rgb[0] = 235;	rgb[1] = 235;	rgb[2] = 235;
+	}
+	else if (strncasecmp(x11ColourName,"grey92",6) == 0) {
+		rgb[0] = 235;	rgb[1] = 235;	rgb[2] = 235;
+	}
+	else if (strncasecmp(x11ColourName,"gray93",6) == 0) {
+		rgb[0] = 237;	rgb[1] = 237;	rgb[2] = 237;
+	}
+	else if (strncasecmp(x11ColourName,"grey93",6) == 0) {
+		rgb[0] = 237;	rgb[1] = 237;	rgb[2] = 237;
+	}
+	else if (strncasecmp(x11ColourName,"gray94",6) == 0) {
+		rgb[0] = 240;	rgb[1] = 240;	rgb[2] = 240;
+	}
+	else if (strncasecmp(x11ColourName,"grey94",6) == 0) {
+		rgb[0] = 240;	rgb[1] = 240;	rgb[2] = 240;
+	}
+	else if (strncasecmp(x11ColourName,"gray95",6) == 0) {
+		rgb[0] = 242;	rgb[1] = 242;	rgb[2] = 242;
+	}
+	else if (strncasecmp(x11ColourName,"grey95",6) == 0) {
+		rgb[0] = 242;	rgb[1] = 242;	rgb[2] = 242;
+	}
+	else if (strncasecmp(x11ColourName,"gray96",6) == 0) {
+		rgb[0] = 245;	rgb[1] = 245;	rgb[2] = 245;
+	}
+	else if (strncasecmp(x11ColourName,"grey96",6) == 0) {
+		rgb[0] = 245;	rgb[1] = 245;	rgb[2] = 245;
+	}
+	else if (strncasecmp(x11ColourName,"gray97",6) == 0) {
+		rgb[0] = 247;	rgb[1] = 247;	rgb[2] = 247;
+	}
+	else if (strncasecmp(x11ColourName,"grey97",6) == 0) {
+		rgb[0] = 247;	rgb[1] = 247;	rgb[2] = 247;
+	}
+	else if (strncasecmp(x11ColourName,"gray98",6) == 0) {
+		rgb[0] = 250;	rgb[1] = 250;	rgb[2] = 250;
+	}
+	else if (strncasecmp(x11ColourName,"grey98",6) == 0) {
+		rgb[0] = 250;	rgb[1] = 250;	rgb[2] = 250;
+	}
+	else if (strncasecmp(x11ColourName,"gray99",6) == 0) {
+		rgb[0] = 252;	rgb[1] = 252;	rgb[2] = 252;
+	}
+	else if (strncasecmp(x11ColourName,"grey99",6) == 0) {
+		rgb[0] = 252;	rgb[1] = 252;	rgb[2] = 252;
+	}
+	else if (strncasecmp(x11ColourName,"gray100",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"grey100",7) == 0) {
+		rgb[0] = 255;	rgb[1] = 255;	rgb[2] = 255;
+	}
+	else if (strncasecmp(x11ColourName,"DarkGrey",8) == 0) {
+		rgb[0] = 169;	rgb[1] = 169;	rgb[2] = 169;
+	}
+	else if (strncasecmp(x11ColourName,"DarkGray",8) == 0) {
+		rgb[0] = 169;	rgb[1] = 169;	rgb[2] = 169;
+	}
+	else if (strncasecmp(x11ColourName,"DarkBlue",8) == 0) {
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"DarkCyan",8) == 0) {
+		rgb[0] = 0;	rgb[1] = 139;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"DarkMagenta",11) == 0) {
+		rgb[0] = 139;	rgb[1] = 0;	rgb[2] = 139;
+	}
+	else if (strncasecmp(x11ColourName,"DarkRed",7) == 0) {
+		rgb[0] = 139;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	else if (strncasecmp(x11ColourName,"LightGreen",10) == 0) {
+		rgb[0] = 144;	rgb[1] = 238;	rgb[2] = 144;
+	}
+	else {		/* Default is Black */
+		rgb[0] = 0;	rgb[1] = 0;	rgb[2] = 0;
+	}
+	
+	/* Convert from int to float */
+	self->red   = (float) rgb[0]/255.0;
+	self->green = (float) rgb[1]/255.0;
+	self->blue  = (float) rgb[2]/255.0;
+	self->opacity = 1.0;
+}
+
+void lucColour_FromHexName( lucColour* self, Name hexName ) {
+	char* red;
+	char* green;
+	char* blue;
+	int i;
+	int rgb[3];
+	
+	/* Check to make sure colour is valid */
+	if (hexName[0] != '#') {
+		lucColour_FromX11ColourName( self, "black" );
+		printf( "Cannot recognise hex colour %s.\n", hexName);
+		return;
+	}
+	for (i = 1 ; i <= 6 ; i++) {
+		if (isxdigit(hexName[i]) == 0) {
+			lucColour_FromX11ColourName( self, "black" );
+			printf( "Cannot recognise hex colour %s.\n", hexName);
+			return;
+		}
+	}
+	
+	/* Seperate colours */
+	red = StG_Strdup(&hexName[1]);
+	red[2] = '\0';
+	green = StG_Strdup(&hexName[3]);
+	green[2] = '\0';
+	blue = StG_Strdup(&hexName[5]);
+	blue[2] = '\0';
+	
+	/* Read colours */
+	sscanf(red,   "%x", &rgb[0]);
+	sscanf(green, "%x", &rgb[1]);
+	sscanf(blue,  "%x", &rgb[2]);
+
+	Memory_Free( blue );
+	Memory_Free( green );
+	Memory_Free( red );
+	
+	self->red   = (float) rgb[0]/255.0;
+	self->green = (float) rgb[1]/255.0;
+	self->blue  = (float) rgb[2]/255.0;
+	self->opacity = 1.0;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/Others/lucTestColourMaps.c
--- a/Base/tests/plugins/Others/lucTestColourMaps.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: lucTestColourMaps.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-void lucTestColourMaps( void* _context, void* _buffer ) {
-	AbstractContext* context = (AbstractContext*) _context;
-	lucBaseContextExtension* contextExt = ExtensionManager_Get( context->extensionMgr, context, lucBaseContextExtensionHandle );
-	Stream* stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
-
-	Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "colourMap.txt" );
-
-	lucColourMap_Register_PrintAllObjects( contextExt->colourMap_Register, stream );
-}
-
-void lucTestColourMaps_Register( void* _context ) {
-	ContextEP_Append( _context, AbstractContext_EP_AssignFromXMLExtensions, lucTestColourMaps );
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/Others/lucTestColourMaps.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/tests/plugins/Others/lucTestColourMaps.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,66 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: lucTestColourMaps.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+void lucTestColourMaps( void* _context, void* _buffer ) {
+	AbstractContext* context = (AbstractContext*) _context;
+	lucBaseContextExtension* contextExt = ExtensionManager_Get( context->extensionMgr, context, lucBaseContextExtensionHandle );
+	Stream* stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
+
+	Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "colourMap.txt" );
+
+	lucColourMap_Register_PrintAllObjects( contextExt->colourMap_Register, stream );
+}
+
+void lucTestColourMaps_Register( void* _context ) {
+	ContextEP_Append( _context, AbstractContext_EP_AssignFromXMLExtensions, lucTestColourMaps );
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/Others/lucTestOutputing.c
--- a/Base/tests/plugins/Others/lucTestOutputing.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: lucTestOutputing.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-void lucTestOutputing( lucWindow* window, unsigned char* buffer, AbstractContext* context ) {
-	Pixel_Index    width          = window->width;
-	Pixel_Index    height         = window->height;
-	Pixel_Index    vertical_I;
-	Pixel_Index    horizontal_I;
-	unsigned char* pixel;
-	
-	/* Draw Picture */
-	for ( vertical_I = 0 ; vertical_I < height ; vertical_I++ ) {
-		for ( horizontal_I = 0 ; horizontal_I < width ; horizontal_I++ ) {
-			pixel = &buffer[3 * ( horizontal_I + vertical_I * width )];
-
-			pixel[0] = (unsigned char) (255.0/(double)height * (double)vertical_I);
-			pixel[1] = (unsigned char) (255.0 - 255.0/(double)width * (double)horizontal_I);
-			pixel[2] = (unsigned char) (255.0/(double)width * (double)horizontal_I);
-		}
-	}
-}
-
-void lucTestOutputing_Register( void* context ) {
-	ContextEP_Append( context, luc_EP_ImageBuffer, lucTestOutputing );
-	ContextEP_Append( context, AbstractContext_EP_Dump, lucBase_DumpAllWindows );
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/Others/lucTestOutputing.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/tests/plugins/Others/lucTestOutputing.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,76 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: lucTestOutputing.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+void lucTestOutputing( lucWindow* window, unsigned char* buffer, AbstractContext* context ) {
+	Pixel_Index    width          = window->width;
+	Pixel_Index    height         = window->height;
+	Pixel_Index    vertical_I;
+	Pixel_Index    horizontal_I;
+	unsigned char* pixel;
+	
+	/* Draw Picture */
+	for ( vertical_I = 0 ; vertical_I < height ; vertical_I++ ) {
+		for ( horizontal_I = 0 ; horizontal_I < width ; horizontal_I++ ) {
+			pixel = &buffer[3 * ( horizontal_I + vertical_I * width )];
+
+			pixel[0] = (unsigned char) (255.0/(double)height * (double)vertical_I);
+			pixel[1] = (unsigned char) (255.0 - 255.0/(double)width * (double)horizontal_I);
+			pixel[2] = (unsigned char) (255.0/(double)width * (double)horizontal_I);
+		}
+	}
+}
+
+void lucTestOutputing_Register( void* context ) {
+	ContextEP_Append( context, luc_EP_ImageBuffer, lucTestOutputing );
+	ContextEP_Append( context, AbstractContext_EP_Dump, lucBase_DumpAllWindows );
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/Others/lucTestPlottingObjects.c
--- a/Base/tests/plugins/Others/lucTestPlottingObjects.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: lucTestPlottingObjects.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-
-void lucTestCalculate( AbstractContext* context, lucWindow* window, lucViewport* viewport, lucPlottingObject* object ) {
-	Stream* stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
-
-	Journal_Printf( stream, "In func '%s' for object %s\n", __func__, object->name );
-}
-
-void lucTestDraw( AbstractContext* context, lucWindow* window, lucViewport* viewport, lucPlottingObject* object ) {
-	Stream* stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
-
-	Journal_Printf( stream, "In func '%s' for object %s\n", __func__, object->name );
-}
-
-void lucTestPlottingObjects( AbstractContext* context ) {
-	lucBaseContextExtension* contextExt = ExtensionManager_Get( context->extensionMgr, context, lucBaseContextExtensionHandle );
-	lucPlottingObject*            plottingObject;
-	PlottingObject_Index          plottingObject_I;
-	Stream*                       stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
-
-	Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "plottingObject.txt" );
-	lucPlottingObject_Register_PrintAllObjects( contextExt->plottingObject_Register, stream );
-
-	for ( plottingObject_I = 0 ; plottingObject_I < lucPlottingObject_Register_GetCount( contextExt->plottingObject_Register ) ; plottingObject_I++ ) {
-		plottingObject = lucPlottingObject_Register_GetByIndex( contextExt->plottingObject_Register, plottingObject_I );
-
-		EP_Append( plottingObject->CalculateEP, lucTestCalculate );
-		EP_Append( plottingObject->DrawEP, lucTestDraw );
-		
-	}
-	
-}
-
-void lucTestPlottingObjects_Draw( AbstractContext* context ) {
-	lucBaseContextExtension* contextExt = ExtensionManager_Get( context->extensionMgr, context, lucBaseContextExtensionHandle );
-	lucPlottingObject_Register_DrawAll( contextExt->plottingObject_Register, NULL, NULL, context );
-}
-
-void lucTestPlottingObjects_Register( void* context ) {
-	ContextEP_Append( context, AbstractContext_EP_AssignFromXMLExtensions, lucTestPlottingObjects );
-	ContextEP_Append( context, AbstractContext_EP_Dump, lucTestPlottingObjects_Draw );
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/Others/lucTestPlottingObjects.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/tests/plugins/Others/lucTestPlottingObjects.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,94 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: lucTestPlottingObjects.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+
+void lucTestCalculate( AbstractContext* context, lucWindow* window, lucViewport* viewport, lucPlottingObject* object ) {
+	Stream* stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
+
+	Journal_Printf( stream, "In func '%s' for object %s\n", __func__, object->name );
+}
+
+void lucTestDraw( AbstractContext* context, lucWindow* window, lucViewport* viewport, lucPlottingObject* object ) {
+	Stream* stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
+
+	Journal_Printf( stream, "In func '%s' for object %s\n", __func__, object->name );
+}
+
+void lucTestPlottingObjects( AbstractContext* context ) {
+	lucBaseContextExtension* contextExt = ExtensionManager_Get( context->extensionMgr, context, lucBaseContextExtensionHandle );
+	lucPlottingObject*            plottingObject;
+	PlottingObject_Index          plottingObject_I;
+	Stream*                       stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
+
+	Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "plottingObject.txt" );
+	lucPlottingObject_Register_PrintAllObjects( contextExt->plottingObject_Register, stream );
+
+	for ( plottingObject_I = 0 ; plottingObject_I < lucPlottingObject_Register_GetCount( contextExt->plottingObject_Register ) ; plottingObject_I++ ) {
+		plottingObject = lucPlottingObject_Register_GetByIndex( contextExt->plottingObject_Register, plottingObject_I );
+
+		EP_Append( plottingObject->CalculateEP, lucTestCalculate );
+		EP_Append( plottingObject->DrawEP, lucTestDraw );
+		
+	}
+	
+}
+
+void lucTestPlottingObjects_Draw( AbstractContext* context ) {
+	lucBaseContextExtension* contextExt = ExtensionManager_Get( context->extensionMgr, context, lucBaseContextExtensionHandle );
+	lucPlottingObject_Register_DrawAll( contextExt->plottingObject_Register, NULL, NULL, context );
+}
+
+void lucTestPlottingObjects_Register( void* context ) {
+	ContextEP_Append( context, AbstractContext_EP_AssignFromXMLExtensions, lucTestPlottingObjects );
+	ContextEP_Append( context, AbstractContext_EP_Dump, lucTestPlottingObjects_Draw );
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/RenderingEngineTest.c
--- a/Base/tests/plugins/RenderingEngineTest.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: RenderingEngineTest.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include <assert.h>
-#include <string.h>
-#include "RenderingEngineTest.h"
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucRenderingEngineTest_Type = "lucRenderingEngineTest";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucRenderingEngineTest* _lucRenderingEngineTest_New(  LUCRENDERINGENGINETEST_DEFARGS  ) 
-{
-	lucRenderingEngineTest*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucRenderingEngineTest) );
-	self = (lucRenderingEngineTest*) _lucRenderingEngine_New(  LUCRENDERINGENGINE_PASSARGS  );
-	
-	return self;
-}
-
-void _lucRenderingEngineTest_Init( 
-		lucRenderingEngineTest*                                      self  ) 
-{
-	/* Initial malloc of memory */
-	self->buffer = Memory_Alloc_Array( lucPixel, 1, "buffer" );
-}
-
-void _lucRenderingEngineTest_Delete( void* renderingEngine ) {
-	lucRenderingEngineTest*  self = (lucRenderingEngineTest*)renderingEngine;
-
-	_lucRenderingEngine_Delete( self );
-}
-
-void _lucRenderingEngineTest_Print( void* renderingEngine, Stream* stream ) {
-	lucRenderingEngineTest*  self = (lucRenderingEngineTest*)renderingEngine;
-
-	_lucRenderingEngine_Print( self, stream );
-}
-
-void* _lucRenderingEngineTest_Copy( void* renderingEngine, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucRenderingEngineTest*  self = (lucRenderingEngineTest*)renderingEngine;
-	lucRenderingEngineTest* newRenderingEngine;
-
-	newRenderingEngine = _lucRenderingEngine_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newRenderingEngine;
-}
-
-
-void* _lucRenderingEngineTest_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                  _sizeOfSelf = sizeof(lucRenderingEngineTest);
-	Type                                                          type = lucRenderingEngineTest_Type;
-	Stg_Class_DeleteFunction*                                  _delete = _lucRenderingEngineTest_Delete;
-	Stg_Class_PrintFunction*                                    _print = _lucRenderingEngineTest_Print;
-	Stg_Class_CopyFunction*                                      _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucRenderingEngineTest_DefaultNew;
-	Stg_Component_ConstructFunction*                        _construct = _lucRenderingEngineTest_AssignFromXML;
-	Stg_Component_BuildFunction*                                _build = _lucRenderingEngineTest_Build;
-	Stg_Component_InitialiseFunction*                      _initialise = _lucRenderingEngineTest_Initialise;
-	Stg_Component_ExecuteFunction*                            _execute = _lucRenderingEngineTest_Execute;
-	Stg_Component_DestroyFunction*                            _destroy = _lucRenderingEngineTest_Destroy;
-	lucRenderingEngine_RenderFunction*                         _render = _lucRenderingEngineTest_Render;
-	lucRenderingEngine_GetPixelDataFunction*             _getPixelData = _lucRenderingEngineTest_GetPixelData;
-	lucRenderingEngine_CompositeViewportFunction*   _compositeViewport = _lucRenderingEngineTest_CompositeViewport;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType                     nameAllocationType = ZERO;
-	lucRenderingEngine_ClearFunction*              _clear = ZERO;
-
-	return (void*) _lucRenderingEngineTest_New(  LUCRENDERINGENGINETEST_PASSARGS  );
-}
-
-void _lucRenderingEngineTest_AssignFromXML( void* renderingEngine, Stg_ComponentFactory* cf, void* data ){
-	lucRenderingEngineTest*  self = (lucRenderingEngineTest*)renderingEngine;
-
-	/* Construct Parent */
-	_lucRenderingEngine_AssignFromXML( self, cf, data );
-	
-	_lucRenderingEngineTest_Init( self );
-}
-
-void _lucRenderingEngineTest_Build( void* renderingEngine, void* data ) {}
-void _lucRenderingEngineTest_Initialise( void* renderingEngine, void* data ) {}
-void _lucRenderingEngineTest_Execute( void* renderingEngine, void* data ) {}
-void _lucRenderingEngineTest_Destroy( void* renderingEngine, void* data ) {}
-
-
-void _lucRenderingEngineTest_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) {
-	lucRenderingEngineTest* self              = (lucRenderingEngineTest*) renderingEngine;
-	Pixel_Index           width  = window->width;
-	Pixel_Index           height = window->height;
-	Pixel_Index           horizontal_I;
-	Pixel_Index           vertical_I;
-	unsigned char*        pixel;
-
-	Journal_DPrintfL( lucDebug, 2, "In func: %s for %s '%s'\n", __func__, self->type, self->name );
-	Stream_Indent( lucDebug );
-
-	self->buffer = Memory_Realloc_Array( self->buffer, lucPixel, width * height );
-	memset( self->buffer, 0, width * height * sizeof(lucPixel) );
-	
-	for ( vertical_I = 0 ; vertical_I < height ; vertical_I++ ) {
-		for ( horizontal_I = 0 ; horizontal_I < width ; horizontal_I++ ) {
-			pixel = (unsigned char*) &self->buffer[ horizontal_I + vertical_I * width ];
-
-			pixel[0] = (unsigned char) (255.0/(double)height * (double)vertical_I);
-			pixel[1] = (unsigned char) (255.0 - 255.0/(double)width * (double)horizontal_I);
-			pixel[2] = (unsigned char) (255.0/(double)width * (double)horizontal_I);
-		}
-	}
-	
-	Stream_UnIndent( lucDebug );
-	Journal_DPrintfL( lucDebug, 2, "Leaving func %s\n", __func__ );
-}
-
-void _lucRenderingEngineTest_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* buffer ) {
-	lucRenderingEngineTest* self              = (lucRenderingEngineTest*) renderingEngine;
-	Pixel_Index             width             = window->width;
-	Pixel_Index             height            = window->height;
-
-	memcpy( buffer, self->buffer, sizeof(lucPixel) * width * height );
-}
-
-void _lucRenderingEngineTest_CompositeViewport( 
-		void*                                              renderingEngine, 
-		lucViewportInfo*                                   viewportInfo, 
-		AbstractContext*                                   context, 
-		Bool                                               broadcast ) 
-{
-}
-
-void RenderingEngineTest_Register( AbstractContext* context ) {
-	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-	Stg_ComponentRegister_Add( componentRegister, lucRenderingEngineTest_Type, (Name)"0", _lucRenderingEngineTest_DefaultNew  );
-	RegisterParent( lucRenderingEngineTest_Type, lucRenderingEngine_Type );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/RenderingEngineTest.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/tests/plugins/RenderingEngineTest.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,193 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: RenderingEngineTest.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include <assert.h>
+#include <string.h>
+#include "RenderingEngineTest.h"
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucRenderingEngineTest_Type = "lucRenderingEngineTest";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucRenderingEngineTest* _lucRenderingEngineTest_New(  LUCRENDERINGENGINETEST_DEFARGS  ) 
+{
+	lucRenderingEngineTest*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucRenderingEngineTest) );
+	self = (lucRenderingEngineTest*) _lucRenderingEngine_New(  LUCRENDERINGENGINE_PASSARGS  );
+	
+	return self;
+}
+
+void _lucRenderingEngineTest_Init( 
+		lucRenderingEngineTest*                                      self  ) 
+{
+	/* Initial malloc of memory */
+	self->buffer = Memory_Alloc_Array( lucPixel, 1, "buffer" );
+}
+
+void _lucRenderingEngineTest_Delete( void* renderingEngine ) {
+	lucRenderingEngineTest*  self = (lucRenderingEngineTest*)renderingEngine;
+
+	_lucRenderingEngine_Delete( self );
+}
+
+void _lucRenderingEngineTest_Print( void* renderingEngine, Stream* stream ) {
+	lucRenderingEngineTest*  self = (lucRenderingEngineTest*)renderingEngine;
+
+	_lucRenderingEngine_Print( self, stream );
+}
+
+void* _lucRenderingEngineTest_Copy( void* renderingEngine, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucRenderingEngineTest*  self = (lucRenderingEngineTest*)renderingEngine;
+	lucRenderingEngineTest* newRenderingEngine;
+
+	newRenderingEngine = _lucRenderingEngine_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newRenderingEngine;
+}
+
+
+void* _lucRenderingEngineTest_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                  _sizeOfSelf = sizeof(lucRenderingEngineTest);
+	Type                                                          type = lucRenderingEngineTest_Type;
+	Stg_Class_DeleteFunction*                                  _delete = _lucRenderingEngineTest_Delete;
+	Stg_Class_PrintFunction*                                    _print = _lucRenderingEngineTest_Print;
+	Stg_Class_CopyFunction*                                      _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucRenderingEngineTest_DefaultNew;
+	Stg_Component_ConstructFunction*                        _construct = _lucRenderingEngineTest_AssignFromXML;
+	Stg_Component_BuildFunction*                                _build = _lucRenderingEngineTest_Build;
+	Stg_Component_InitialiseFunction*                      _initialise = _lucRenderingEngineTest_Initialise;
+	Stg_Component_ExecuteFunction*                            _execute = _lucRenderingEngineTest_Execute;
+	Stg_Component_DestroyFunction*                            _destroy = _lucRenderingEngineTest_Destroy;
+	lucRenderingEngine_RenderFunction*                         _render = _lucRenderingEngineTest_Render;
+	lucRenderingEngine_GetPixelDataFunction*             _getPixelData = _lucRenderingEngineTest_GetPixelData;
+	lucRenderingEngine_CompositeViewportFunction*   _compositeViewport = _lucRenderingEngineTest_CompositeViewport;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType                     nameAllocationType = ZERO;
+	lucRenderingEngine_ClearFunction*              _clear = ZERO;
+
+	return (void*) _lucRenderingEngineTest_New(  LUCRENDERINGENGINETEST_PASSARGS  );
+}
+
+void _lucRenderingEngineTest_AssignFromXML( void* renderingEngine, Stg_ComponentFactory* cf, void* data ){
+	lucRenderingEngineTest*  self = (lucRenderingEngineTest*)renderingEngine;
+
+	/* Construct Parent */
+	_lucRenderingEngine_AssignFromXML( self, cf, data );
+	
+	_lucRenderingEngineTest_Init( self );
+}
+
+void _lucRenderingEngineTest_Build( void* renderingEngine, void* data ) {}
+void _lucRenderingEngineTest_Initialise( void* renderingEngine, void* data ) {}
+void _lucRenderingEngineTest_Execute( void* renderingEngine, void* data ) {}
+void _lucRenderingEngineTest_Destroy( void* renderingEngine, void* data ) {}
+
+
+void _lucRenderingEngineTest_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) {
+	lucRenderingEngineTest* self              = (lucRenderingEngineTest*) renderingEngine;
+	Pixel_Index           width  = window->width;
+	Pixel_Index           height = window->height;
+	Pixel_Index           horizontal_I;
+	Pixel_Index           vertical_I;
+	unsigned char*        pixel;
+
+	Journal_DPrintfL( lucDebug, 2, "In func: %s for %s '%s'\n", __func__, self->type, self->name );
+	Stream_Indent( lucDebug );
+
+	self->buffer = Memory_Realloc_Array( self->buffer, lucPixel, width * height );
+	memset( self->buffer, 0, width * height * sizeof(lucPixel) );
+	
+	for ( vertical_I = 0 ; vertical_I < height ; vertical_I++ ) {
+		for ( horizontal_I = 0 ; horizontal_I < width ; horizontal_I++ ) {
+			pixel = (unsigned char*) &self->buffer[ horizontal_I + vertical_I * width ];
+
+			pixel[0] = (unsigned char) (255.0/(double)height * (double)vertical_I);
+			pixel[1] = (unsigned char) (255.0 - 255.0/(double)width * (double)horizontal_I);
+			pixel[2] = (unsigned char) (255.0/(double)width * (double)horizontal_I);
+		}
+	}
+	
+	Stream_UnIndent( lucDebug );
+	Journal_DPrintfL( lucDebug, 2, "Leaving func %s\n", __func__ );
+}
+
+void _lucRenderingEngineTest_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* buffer ) {
+	lucRenderingEngineTest* self              = (lucRenderingEngineTest*) renderingEngine;
+	Pixel_Index             width             = window->width;
+	Pixel_Index             height            = window->height;
+
+	memcpy( buffer, self->buffer, sizeof(lucPixel) * width * height );
+}
+
+void _lucRenderingEngineTest_CompositeViewport( 
+		void*                                              renderingEngine, 
+		lucViewportInfo*                                   viewportInfo, 
+		AbstractContext*                                   context, 
+		Bool                                               broadcast ) 
+{
+}
+
+void RenderingEngineTest_Register( AbstractContext* context ) {
+	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+	Stg_ComponentRegister_Add( componentRegister, lucRenderingEngineTest_Type, (Name)"0", _lucRenderingEngineTest_DefaultNew  );
+	RegisterParent( lucRenderingEngineTest_Type, lucRenderingEngine_Type );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/lucTestCameras.c
--- a/Base/tests/plugins/lucTestCameras.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: lucTestCameras.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-void lucTestLeftDirection( lucCamera* camera, Stream* stream ) {
-	XYZ   leftDirection;
-	XYZ   focusDirection;
-
-	lucCamera_GetLeftDirection( camera, leftDirection );
-	lucCamera_GetFocusDirection( camera, focusDirection );
-
-	Journal_Firewall( fabs( StGermain_AngleBetweenVectors( leftDirection, camera->upDirection, 3 ) - M_PI/2.0 ) < 0.01 , 
-			stream, "Failed %s - left direction = %f %f %f, focusDirection = %f %f %f\n", __func__,
-			leftDirection[0], leftDirection[1], leftDirection[2], 
-			focusDirection[0], focusDirection[1], focusDirection[2] ); 
-	Journal_Firewall( fabs( StGermain_AngleBetweenVectors( leftDirection, focusDirection, 3 ) - M_PI/2.0 ) < 0.01 , 
-			stream, "Failed %s - left direction = %f %f %f, focusDirection = %f %f %f\n", __func__,
-			leftDirection[0], leftDirection[1], leftDirection[2], 
-			focusDirection[0], focusDirection[1], focusDirection[2] ); 
-
-}
-
-void lucTestBroadcast( lucCamera* camera, Stream* stream, AbstractContext* context ) {
-	int rootRank = 0;
-	double rank = (double) context->rank;
-
-	camera->coord[ J_AXIS ] = rank;
-
-	camera->eyeSeparation = rank;
-	
-	lucCamera_Broadcast( camera, rootRank, context->communicator );
-
-	Journal_Firewall( fabs( camera->coord[ J_AXIS ] - (double) rootRank ) < 0.01, 
-			stream, "Failed %s\n", __func__ );
-
-	Journal_Firewall( fabs( camera->eyeSeparation - (double) rootRank ) < 0.01, 
-			stream, "Failed %s\n", __func__ );
-}
-
-void lucTestEye( lucCamera* camera, Stream* stream ) {
-	Coord leftEye;
-	Coord rightEye;
-	XYZ   vector;
-	XYZ   leftDirection;
-
-	camera->buffer = lucRight;
-	lucCamera_SwapStereoBuffer( camera );
-	lucCamera_CurrentEyePosition( camera, leftEye );
-	lucCamera_SwapStereoBuffer( camera );
-	lucCamera_CurrentEyePosition( camera, rightEye );
-
-	StGermain_VectorSubtraction( vector, leftEye, rightEye, 3 );
-	if ( camera->stereoType == lucMono ) {
-		Journal_Firewall( fabs(StGermain_VectorMagnitude( vector, 3 ) ) < 0.01, 
-				stream, "Failed %s\n", __func__ );
-		StGermain_VectorSubtraction( vector, leftEye, camera->coord, 3 );
-		Journal_Firewall( fabs(StGermain_VectorMagnitude( vector, 3 ) ) < 0.01, 
-				stream, "Failed %s\n", __func__ );
-		return;
-	}
-
-	Journal_Firewall( fabs(StGermain_VectorMagnitude( vector, 3 ) - camera->eyeSeparation ) < 0.01*camera->eyeSeparation, 
-			stream, "Failed %s\n", __func__ );
-
-	lucCamera_GetLeftDirection( camera, leftDirection );
-	Journal_Firewall( fabs( StGermain_AngleBetweenVectors( vector, leftDirection, 3 ) ) < 0.01 , 
-			stream, "Failed %s\n", __func__ );
-}
-
-void testCamera( lucCamera* camera, Stream* stream, AbstractContext* context ) {
-	lucTestEye( camera, stream );
-	lucTestLeftDirection( camera, stream );
-}
-
-
-void lucTestThisCamera( AbstractContext* context, lucCamera* camera, Stream* stream ) {
-	Index                         angleCount = 8;                         
-	Index                         angle_I;                         
-	XYZ                           leftDirection;
-	XYZ                           focusDirection;
-	XYZ                           originalFocusDirection;
-	
-	Journal_Printf( stream, "************** Checking Camera '%s' **************\n", camera->name );
-	Stream_Indent( stream );
-	lucCamera_GetFocusDirection( camera, originalFocusDirection );
-
-	Journal_Printf( stream, "************** Testing lucCamera_Zoom **************\n");
-	lucCamera_Zoom( camera, 2.0 ) ;
-	Stg_Class_Print( camera, stream );
-	testCamera( camera, stream, context );
-	lucCamera_Reset( camera );
-
-	lucCamera_Zoom( camera, 0.25 ) ;
-	Stg_Class_Print( camera, stream );
-	testCamera( camera, stream, context );
-	lucCamera_Reset( camera );
-
-	lucTestBroadcast( camera, stream, context );
-	lucCamera_Reset( camera );
-
-	Journal_Printf( stream, "************** Testing lucCamera_RotateAroundUpDirection **************\n");
-	Stream_Indent( stream );
-	for ( angle_I = 0 ; angle_I < angleCount ; angle_I++ ) {
-		lucCamera_RotateAroundUpDirection( camera, 2.0 * M_PI / (double)angleCount ) ;
-		lucCamera_GetFocusDirection( camera, focusDirection );
-		Journal_Printf(stream, "Has rotated %.5g degrees.\n", 
-				StGermain_AngleBetweenVectors( focusDirection, originalFocusDirection, 3) * 180.0 / M_PI );
-		lucCamera_GetLeftDirection( camera, leftDirection );
-	}
-	Stream_UnIndent( stream );
-	lucCamera_Reset( camera );
-	
-	Journal_Printf( stream, "************** Testing lucCamera_RotateTowardsUpDirection **************\n");
-	Stream_Indent( stream );
-	for ( angle_I = 0 ; angle_I < angleCount ; angle_I++ ) {
-		lucCamera_RotateTowardsUpDirection( camera,  0.5 * M_PI / (double)angleCount + M_PI/180.0 ) ;
-		lucCamera_GetFocusDirection( camera, focusDirection );
-		Journal_Printf(stream, "Has rotated %.5g degrees.\n", 
-				StGermain_AngleBetweenVectors( focusDirection, originalFocusDirection, 3) * 180.0 / M_PI );
-		testCamera( camera, stream, context );
-	}
-	lucCamera_Reset( camera );
-	for ( angle_I = 0 ; angle_I < angleCount ; angle_I++ ) {
-		lucCamera_RotateTowardsUpDirection( camera,  -0.5 * M_PI / (double)angleCount - M_PI/180.0 ) ;
-		lucCamera_GetFocusDirection( camera, focusDirection );
-		Journal_Printf(stream, "Has rotated %.5g degrees.\n", 
-				StGermain_AngleBetweenVectors( focusDirection, originalFocusDirection, 3) * 180.0 / M_PI );
-
-		/* Print left direction */
-		testCamera( camera, stream, context );
-	}
-	Stream_UnIndent( stream );
-	lucCamera_Reset( camera );
-	Stream_UnIndent( stream );
-}
-
-void lucTestAllCameras( AbstractContext* context ) {
-	lucCamera*                    stereo;
-	lucCamera*                    frontOn;
-	Stream*                       stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME );
-
-	if ( context->rank == 0  )
-		Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "camera.txt" );
-	Stream_SetPrintingRank( stream, 0 );
-
-	/* Note: this func gets added to construct extensions... may it should be changed to take in the tummy too? */
-	frontOn = Stg_ComponentFactory_ConstructByName( context->CF, (Name)"frontOn", lucCamera, True, 0 /* dummy */  ); 
-	stereo = Stg_ComponentFactory_ConstructByName( context->CF, (Name)"stereo", lucCamera, True, 0 /* dummy */  ); 
-	Stg_Class_Print( frontOn, stream );
-	Stg_Class_Print( stereo, stream );
-	lucTestThisCamera( context, frontOn, stream );
-	lucTestThisCamera( context, stereo, stream );
-}
-
-const Type lucTestCameras_Type = "lucTestCameras";
-typedef struct {
-	__Codelet
-} lucTestCameras;
-
-void _lucTestCameras_AssignFromXML( void* components, Stg_ComponentFactory* cf, void* data ) {
-	AbstractContext* context;
-	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ); 
-	ContextEP_Append( context, AbstractContext_EP_AssignFromXMLExtensions, lucTestAllCameras );
-}
-
-void* _lucTestCameras_DefaultNew( Name name ) {
-	return Codelet_New(
-		lucTestCameras_Type,
-		_lucTestCameras_DefaultNew,
-		_lucTestCameras_AssignFromXML,
-		_Codelet_Build,
-		_Codelet_Initialise,
-		_Codelet_Execute,
-		_Codelet_Destroy,
-		name );
-}
-
-Index lucTestCameras_Register( PluginsManager* pluginsManager ) {
-	return PluginsManager_Submit( pluginsManager, lucTestCameras_Type, (Name)"0", _lucTestCameras_DefaultNew  );
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/lucTestCameras.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/tests/plugins/lucTestCameras.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,229 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: lucTestCameras.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+void lucTestLeftDirection( lucCamera* camera, Stream* stream ) {
+	XYZ   leftDirection;
+	XYZ   focusDirection;
+
+	lucCamera_GetLeftDirection( camera, leftDirection );
+	lucCamera_GetFocusDirection( camera, focusDirection );
+
+	Journal_Firewall( fabs( StGermain_AngleBetweenVectors( leftDirection, camera->upDirection, 3 ) - M_PI/2.0 ) < 0.01 , 
+			stream, "Failed %s - left direction = %f %f %f, focusDirection = %f %f %f\n", __func__,
+			leftDirection[0], leftDirection[1], leftDirection[2], 
+			focusDirection[0], focusDirection[1], focusDirection[2] ); 
+	Journal_Firewall( fabs( StGermain_AngleBetweenVectors( leftDirection, focusDirection, 3 ) - M_PI/2.0 ) < 0.01 , 
+			stream, "Failed %s - left direction = %f %f %f, focusDirection = %f %f %f\n", __func__,
+			leftDirection[0], leftDirection[1], leftDirection[2], 
+			focusDirection[0], focusDirection[1], focusDirection[2] ); 
+
+}
+
+void lucTestBroadcast( lucCamera* camera, Stream* stream, AbstractContext* context ) {
+	int rootRank = 0;
+	double rank = (double) context->rank;
+
+	camera->coord[ J_AXIS ] = rank;
+
+	camera->eyeSeparation = rank;
+	
+	lucCamera_Broadcast( camera, rootRank, context->communicator );
+
+	Journal_Firewall( fabs( camera->coord[ J_AXIS ] - (double) rootRank ) < 0.01, 
+			stream, "Failed %s\n", __func__ );
+
+	Journal_Firewall( fabs( camera->eyeSeparation - (double) rootRank ) < 0.01, 
+			stream, "Failed %s\n", __func__ );
+}
+
+void lucTestEye( lucCamera* camera, Stream* stream ) {
+	Coord leftEye;
+	Coord rightEye;
+	XYZ   vector;
+	XYZ   leftDirection;
+
+	camera->buffer = lucRight;
+	lucCamera_SwapStereoBuffer( camera );
+	lucCamera_CurrentEyePosition( camera, leftEye );
+	lucCamera_SwapStereoBuffer( camera );
+	lucCamera_CurrentEyePosition( camera, rightEye );
+
+	StGermain_VectorSubtraction( vector, leftEye, rightEye, 3 );
+	if ( camera->stereoType == lucMono ) {
+		Journal_Firewall( fabs(StGermain_VectorMagnitude( vector, 3 ) ) < 0.01, 
+				stream, "Failed %s\n", __func__ );
+		StGermain_VectorSubtraction( vector, leftEye, camera->coord, 3 );
+		Journal_Firewall( fabs(StGermain_VectorMagnitude( vector, 3 ) ) < 0.01, 
+				stream, "Failed %s\n", __func__ );
+		return;
+	}
+
+	Journal_Firewall( fabs(StGermain_VectorMagnitude( vector, 3 ) - camera->eyeSeparation ) < 0.01*camera->eyeSeparation, 
+			stream, "Failed %s\n", __func__ );
+
+	lucCamera_GetLeftDirection( camera, leftDirection );
+	Journal_Firewall( fabs( StGermain_AngleBetweenVectors( vector, leftDirection, 3 ) ) < 0.01 , 
+			stream, "Failed %s\n", __func__ );
+}
+
+void testCamera( lucCamera* camera, Stream* stream, AbstractContext* context ) {
+	lucTestEye( camera, stream );
+	lucTestLeftDirection( camera, stream );
+}
+
+
+void lucTestThisCamera( AbstractContext* context, lucCamera* camera, Stream* stream ) {
+	Index                         angleCount = 8;                         
+	Index                         angle_I;                         
+	XYZ                           leftDirection;
+	XYZ                           focusDirection;
+	XYZ                           originalFocusDirection;
+	
+	Journal_Printf( stream, "************** Checking Camera '%s' **************\n", camera->name );
+	Stream_Indent( stream );
+	lucCamera_GetFocusDirection( camera, originalFocusDirection );
+
+	Journal_Printf( stream, "************** Testing lucCamera_Zoom **************\n");
+	lucCamera_Zoom( camera, 2.0 ) ;
+	Stg_Class_Print( camera, stream );
+	testCamera( camera, stream, context );
+	lucCamera_Reset( camera );
+
+	lucCamera_Zoom( camera, 0.25 ) ;
+	Stg_Class_Print( camera, stream );
+	testCamera( camera, stream, context );
+	lucCamera_Reset( camera );
+
+	lucTestBroadcast( camera, stream, context );
+	lucCamera_Reset( camera );
+
+	Journal_Printf( stream, "************** Testing lucCamera_RotateAroundUpDirection **************\n");
+	Stream_Indent( stream );
+	for ( angle_I = 0 ; angle_I < angleCount ; angle_I++ ) {
+		lucCamera_RotateAroundUpDirection( camera, 2.0 * M_PI / (double)angleCount ) ;
+		lucCamera_GetFocusDirection( camera, focusDirection );
+		Journal_Printf(stream, "Has rotated %.5g degrees.\n", 
+				StGermain_AngleBetweenVectors( focusDirection, originalFocusDirection, 3) * 180.0 / M_PI );
+		lucCamera_GetLeftDirection( camera, leftDirection );
+	}
+	Stream_UnIndent( stream );
+	lucCamera_Reset( camera );
+	
+	Journal_Printf( stream, "************** Testing lucCamera_RotateTowardsUpDirection **************\n");
+	Stream_Indent( stream );
+	for ( angle_I = 0 ; angle_I < angleCount ; angle_I++ ) {
+		lucCamera_RotateTowardsUpDirection( camera,  0.5 * M_PI / (double)angleCount + M_PI/180.0 ) ;
+		lucCamera_GetFocusDirection( camera, focusDirection );
+		Journal_Printf(stream, "Has rotated %.5g degrees.\n", 
+				StGermain_AngleBetweenVectors( focusDirection, originalFocusDirection, 3) * 180.0 / M_PI );
+		testCamera( camera, stream, context );
+	}
+	lucCamera_Reset( camera );
+	for ( angle_I = 0 ; angle_I < angleCount ; angle_I++ ) {
+		lucCamera_RotateTowardsUpDirection( camera,  -0.5 * M_PI / (double)angleCount - M_PI/180.0 ) ;
+		lucCamera_GetFocusDirection( camera, focusDirection );
+		Journal_Printf(stream, "Has rotated %.5g degrees.\n", 
+				StGermain_AngleBetweenVectors( focusDirection, originalFocusDirection, 3) * 180.0 / M_PI );
+
+		/* Print left direction */
+		testCamera( camera, stream, context );
+	}
+	Stream_UnIndent( stream );
+	lucCamera_Reset( camera );
+	Stream_UnIndent( stream );
+}
+
+void lucTestAllCameras( AbstractContext* context ) {
+	lucCamera*                    stereo;
+	lucCamera*                    frontOn;
+	Stream*                       stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME );
+
+	if ( context->rank == 0  )
+		Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "camera.txt" );
+	Stream_SetPrintingRank( stream, 0 );
+
+	/* Note: this func gets added to construct extensions... may it should be changed to take in the tummy too? */
+	frontOn = Stg_ComponentFactory_ConstructByName( context->CF, (Name)"frontOn", lucCamera, True, 0 /* dummy */  ); 
+	stereo = Stg_ComponentFactory_ConstructByName( context->CF, (Name)"stereo", lucCamera, True, 0 /* dummy */  ); 
+	Stg_Class_Print( frontOn, stream );
+	Stg_Class_Print( stereo, stream );
+	lucTestThisCamera( context, frontOn, stream );
+	lucTestThisCamera( context, stereo, stream );
+}
+
+const Type lucTestCameras_Type = "lucTestCameras";
+typedef struct {
+	__Codelet
+} lucTestCameras;
+
+void _lucTestCameras_AssignFromXML( void* components, Stg_ComponentFactory* cf, void* data ) {
+	AbstractContext* context;
+	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ); 
+	ContextEP_Append( context, AbstractContext_EP_AssignFromXMLExtensions, lucTestAllCameras );
+}
+
+void* _lucTestCameras_DefaultNew( Name name ) {
+	return Codelet_New(
+		lucTestCameras_Type,
+		_lucTestCameras_DefaultNew,
+		_lucTestCameras_AssignFromXML,
+		_Codelet_Build,
+		_Codelet_Initialise,
+		_Codelet_Execute,
+		_Codelet_Destroy,
+		name );
+}
+
+Index lucTestCameras_Register( PluginsManager* pluginsManager ) {
+	return PluginsManager_Submit( pluginsManager, lucTestCameras_Type, (Name)"0", _lucTestCameras_DefaultNew  );
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/lucTestColourMaps.c
--- a/Base/tests/plugins/lucTestColourMaps.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: lucTestColourMaps.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-void lucTestColourMaps_Function( AbstractContext* context ) {
-	Index            component_I;
-	Stg_ObjectList*  componentList = context->CF->LCRegister->componentList;
-	Stg_Component*   component;
-	Stream*          stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
-
-	Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "colourMap.txt" );
-
-	/* Do Stg_Class_Print for all colour maps */
-	for ( component_I = 0 ; component_I < componentList->count ; component_I++ ) {
-		component = (Stg_Component*) Stg_ObjectList_At( componentList, component_I );
-
-		if ( Stg_Class_IsInstance( component, lucColourMap_Type ) )
-			Stg_Class_Print( component, stream );
-	}
-}
-
-const Type lucTestColourMaps_Type = "lucTestColourMaps";
-typedef struct {
-	__Codelet
-} lucTestColourMaps;
-
-void _lucTestColourMaps_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-	AbstractContext* context;
-	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ); 
-	ContextEP_Append( context, AbstractContext_EP_AssignFromXMLExtensions, lucTestColourMaps_Function );
-}
-
-void* _lucTestColourMaps_DefaultNew( Name name ) {
-	return Codelet_New(
-		lucTestColourMaps_Type,
-		_lucTestColourMaps_DefaultNew,
-		_lucTestColourMaps_AssignFromXML,
-		_Codelet_Build,
-		_Codelet_Initialise,
-		_Codelet_Execute,
-		_Codelet_Destroy,
-		name );
-}
-
-Index lucTestColourMaps_Register( PluginsManager* pluginsManager ) {
-	return PluginsManager_Submit( pluginsManager, lucTestColourMaps_Type, (Name)"0", _lucTestColourMaps_DefaultNew  );
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/plugins/lucTestColourMaps.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/tests/plugins/lucTestColourMaps.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,96 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: lucTestColourMaps.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+void lucTestColourMaps_Function( AbstractContext* context ) {
+	Index            component_I;
+	Stg_ObjectList*  componentList = context->CF->LCRegister->componentList;
+	Stg_Component*   component;
+	Stream*          stream = Journal_Register( Info_Type, (Name)CURR_MODULE_NAME  );
+
+	Stream_RedirectFile_WithPrependedPath( stream, context->outputPath, "colourMap.txt" );
+
+	/* Do Stg_Class_Print for all colour maps */
+	for ( component_I = 0 ; component_I < componentList->count ; component_I++ ) {
+		component = (Stg_Component*) Stg_ObjectList_At( componentList, component_I );
+
+		if ( Stg_Class_IsInstance( component, lucColourMap_Type ) )
+			Stg_Class_Print( component, stream );
+	}
+}
+
+const Type lucTestColourMaps_Type = "lucTestColourMaps";
+typedef struct {
+	__Codelet
+} lucTestColourMaps;
+
+void _lucTestColourMaps_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+	AbstractContext* context;
+	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ); 
+	ContextEP_Append( context, AbstractContext_EP_AssignFromXMLExtensions, lucTestColourMaps_Function );
+}
+
+void* _lucTestColourMaps_DefaultNew( Name name ) {
+	return Codelet_New(
+		lucTestColourMaps_Type,
+		_lucTestColourMaps_DefaultNew,
+		_lucTestColourMaps_AssignFromXML,
+		_Codelet_Build,
+		_Codelet_Initialise,
+		_Codelet_Execute,
+		_Codelet_Destroy,
+		name );
+}
+
+Index lucTestColourMaps_Register( PluginsManager* pluginsManager ) {
+	return PluginsManager_Submit( pluginsManager, lucTestColourMaps_Type, (Name)"0", _lucTestColourMaps_DefaultNew  );
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/testlucBase.c
--- a/Base/tests/testlucBase.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,143 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: testlucBase.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-
-#ifdef HAVE_PYTHON
-#include <Python.h>
-#endif
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-int main( int argc, char* argv[] ) {
-	MPI_Comm           CommWorld;
-	int                rank;
-	int                numProcessors;
-	Dictionary*        dictionary;
-	XML_IO_Handler*    ioHandler;
-	DomainContext* context         = NULL;
-	
-	/* Initialise PETSc, get world info */
-	MPI_Init( &argc, &argv );
-	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-	MPI_Comm_size( CommWorld, &numProcessors );
-	MPI_Comm_rank( CommWorld, &rank );
-	
-	StGermain_Init( &argc, &argv );
-	StgDomain_Init( &argc, &argv );
-	lucBase_Init( &argc, &argv );
-	#ifdef HAVE_PYTHON
-	Py_Initialize();
-	#endif
-
-	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
-	
-	/* Create the application's dictionary */
-	dictionary = Dictionary_New();
-
-	/* Read input */
-	ioHandler = XML_IO_Handler_New();
-	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
-	Journal_ReadFromDictionary( dictionary );
-
-	/* Construction phase -----------------------------------------------------------------------------------------------*/
-	context = DomainContext_New( "context", 0, 0, CommWorld, dictionary );
-	#if 0
-	PluginsManager_Load( context->plugins, context, dictionary );
-
-	componentDict = Dictionary_GetDictionary( dictionary, "components" );
-	assert( componentDict );
-
-	context->CF = Stg_ComponentFactory_New( dictionary, componentDict, context->register_Register );
-
-	LiveComponentRegister_Add( context->CF->LCRegister, (Stg_Component*) context );
-	
-	Stg_ComponentFactory_CreateComponents( context->CF );
-	Stg_ComponentFactory_ConstructComponents( context->CF );
-	KeyCall( context, context->constructExtensionsK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(context,context->constructExtensionsK), context );
-	#endif
-	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, False );
-	
-	if( rank == 0 ) 
-		Context_PrintConcise( context, context->verbose );
-
-	/* Building phase ---------------------------------------------------------------------------------------------------*/
-	Stg_Component_Build( context, 0 /* dummy */, False );
-	
-	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
-	Stg_Component_Initialise( context, 0 /* dummy */, False );
-	
-	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
-	AbstractContext_Dump( context );
-	
-	/* Destruct phase ---------------------------------------------------------------------------------------------------*/
-	Stg_Component_Destroy( context, 0 /* dummy */, False );
-	Stg_Component_Destroy( context, 0 /* dummy */, False );
-	Stg_Class_Delete( context );
-	Stg_Class_Delete( dictionary );
-
-	#ifdef HAVE_PYTHON
-	Py_Finalize();
-	#endif
-
-	lucBase_Finalise();
-	StgDomain_Finalise();
-	StGermain_Finalise();
-		
-	/* Close off MPI */
-	MPI_Finalize();
-	
-	return 0; /* success */
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Base/tests/testlucBase.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/tests/testlucBase.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,143 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: testlucBase.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+
+#ifdef HAVE_PYTHON
+#include <Python.h>
+#endif
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+int main( int argc, char* argv[] ) {
+	MPI_Comm           CommWorld;
+	int                rank;
+	int                numProcessors;
+	Dictionary*        dictionary;
+	XML_IO_Handler*    ioHandler;
+	DomainContext* context         = NULL;
+	
+	/* Initialise PETSc, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+	
+	StGermain_Init( &argc, &argv );
+	StgDomain_Init( &argc, &argv );
+	lucBase_Init( &argc, &argv );
+	#ifdef HAVE_PYTHON
+	Py_Initialize();
+	#endif
+
+	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+	
+	/* Create the application's dictionary */
+	dictionary = Dictionary_New();
+
+	/* Read input */
+	ioHandler = XML_IO_Handler_New();
+	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
+	Journal_ReadFromDictionary( dictionary );
+
+	/* Construction phase -----------------------------------------------------------------------------------------------*/
+	context = DomainContext_New( "context", 0, 0, CommWorld, dictionary );
+	#if 0
+	PluginsManager_Load( context->plugins, context, dictionary );
+
+	componentDict = Dictionary_GetDictionary( dictionary, "components" );
+	assert( componentDict );
+
+	context->CF = Stg_ComponentFactory_New( dictionary, componentDict, context->register_Register );
+
+	LiveComponentRegister_Add( context->CF->LCRegister, (Stg_Component*) context );
+	
+	Stg_ComponentFactory_CreateComponents( context->CF );
+	Stg_ComponentFactory_ConstructComponents( context->CF );
+	KeyCall( context, context->constructExtensionsK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(context,context->constructExtensionsK), context );
+	#endif
+	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, False );
+	
+	if( rank == 0 ) 
+		Context_PrintConcise( context, context->verbose );
+
+	/* Building phase ---------------------------------------------------------------------------------------------------*/
+	Stg_Component_Build( context, 0 /* dummy */, False );
+	
+	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
+	Stg_Component_Initialise( context, 0 /* dummy */, False );
+	
+	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
+	AbstractContext_Dump( context );
+	
+	/* Destruct phase ---------------------------------------------------------------------------------------------------*/
+	Stg_Component_Destroy( context, 0 /* dummy */, False );
+	Stg_Component_Destroy( context, 0 /* dummy */, False );
+	Stg_Class_Delete( context );
+	Stg_Class_Delete( dictionary );
+
+	#ifdef HAVE_PYTHON
+	Py_Finalize();
+	#endif
+
+	lucBase_Finalise();
+	StgDomain_Finalise();
+	StGermain_Finalise();
+		
+	/* Close off MPI */
+	MPI_Finalize();
+	
+	return 0; /* success */
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Axis.c
--- a/DrawingObjects/src/Axis.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,358 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Axis.c 510 2006-02-17 04:33:32Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#ifdef HAVE_GL2PS
-	#include <gl2ps.h>
-#endif
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "Axis.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-const Type lucAxis_Type = "lucAxis";
-
-lucAxis* lucAxis_New( 
-		Name                                                  name,
-		Coord                                                 origin,
-    		float 				                      length,
-		lucColour                                             colourX,
-		lucColour                                             colourY,
-		lucColour                                             colourZ)
-{
-	lucAxis* self = (lucAxis*) _lucAxis_DefaultNew( name );
-
-	lucAxis_InitAll( self, origin, length, colourX, colourY, colourZ);
-
-	return self;
-}
-
-lucAxis* _lucAxis_New(  LUCAXIS_DEFARGS  )
-{
-	lucAxis*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucAxis) );
-	self = (lucAxis*)  _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	
-	return self;
-}
-
-void lucAxis_Init(		
-		lucAxis*                                         self,
-		Coord                                            origin,
-		float 				                 length,
-		lucColour                                        colourX,
-		lucColour                                        colourY,
-		lucColour                                        colourZ) 
-{
-	
-	self->length = length;
-	memcpy( self->origin, origin, sizeof(Coord) );	
-	memcpy( &(self->colourX), &colourX, sizeof(lucColour) );	
-	memcpy( &(self->colourY), &colourY, sizeof(lucColour) );	
-	memcpy( &(self->colourZ), &colourZ, sizeof(lucColour) );	
-
-	
-}
-
-void lucAxis_InitAll( 
-		void*                                              axis,
-		Coord                                              origin,
-	        float 				                   length,
-		lucColour                                          colourX,
-		lucColour                                          colourY,
-		lucColour                                          colourZ)
-{
-	lucAxis* self        = axis;
-
-	/* TODO Init parent */
-	lucAxis_Init( self, origin, length, colourX, colourY, colourZ );
-}
-
-void _lucAxis_Delete( void* drawingObject ) {
-	lucAxis*  self = (lucAxis*)drawingObject;
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucAxis_Print( void* drawingObject, Stream* stream ) {
-	lucAxis*  self = (lucAxis*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucAxis_Copy( void* axis, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucAxis* self        = axis;
-	lucAxis* newAxis;
-
-	newAxis = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newAxis->length = self->length;
-	memcpy( &(newAxis->colourX),       &(self->colourX),       sizeof(lucColour) );
-	memcpy( &(newAxis->colourY),       &(self->colourY),       sizeof(lucColour) );
-	memcpy( &(newAxis->colourZ),       &(self->colourZ),       sizeof(lucColour) );
-	memcpy( newAxis->origin,       self->origin,       sizeof(Coord) );
-	
-	return (void*) newAxis;
-}
-
-void* _lucAxis_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof( lucAxis );
-	Type                                                             type = lucAxis_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucAxis_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucAxis_Print;
-	Stg_Class_CopyFunction*                                         _copy = _lucAxis_Copy;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucAxis_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucAxis_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucAxis_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucAxis_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucAxis_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucAxis_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucAxis_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucAxis_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucAxis_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucAxis_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucAxis_New(  LUCAXIS_PASSARGS  );
-}
-
-void _lucAxis_AssignFromXML( void* axis, Stg_ComponentFactory* cf, void* data ) {
-	lucAxis*             self               = (lucAxis*) axis;
-        Name colourNameX;
-	Name colourNameY;	
-	Name colourNameZ;		
-	
-	Coord origin;
-	
-	/* Get Stereo Type */
-         /* Construct Parent */
-	_lucDrawingObject_AssignFromXML( self, cf, data );
-
-	colourNameX  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourX", "Red" ) ;
-	colourNameY  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourY", "Green" ) ;
-	colourNameZ  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourZ", "Blue" ) ;
-	
-	lucColour_FromString( &self->colourX, colourNameX );	
-	lucColour_FromString( &self->colourY, colourNameY );
-	lucColour_FromString( &self->colourZ, colourNameZ );
-	
-	origin[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originX", -0.05  );
-	origin[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originY", -0.05  );
-	origin[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originZ", -0.05  );
-	
-       	lucAxis_InitAll( self, 
-	                origin,
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2  ),
-		        self->colourX,
-			self->colourY,
-			self->colourZ);
-			
-}
-
-void _lucAxis_Build( void* Axis, void* data ) { }
-void _lucAxis_Initialise( void* Axis, void* data ) { }
-void _lucAxis_Execute( void* Axis, void* data ) { }
-void _lucAxis_Destroy( void* Axis, void* data ) { }
-
-void _lucAxis_Setup( void* drawingObject, void* _context ) {
-	lucAxis*       self            = (lucAxis*)drawingObject;
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-
-void _lucAxis_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucAxis*				self = (lucAxis*)drawingObject;
-	DomainContext*		context = (DomainContext*) _context;
-	Dimension_Index	dim = context->dim;
-	double				rodLength = 0.0;
-	double				arrowHeadLength = 0.0;
-	double				textSpacing = 0.0;
-		
-	/* Initialise OpenGL stuff */
-	glShadeModel(GL_SMOOTH);
-	glDisable(GL_LIGHTING);
-
-	glEnable(GL_LINE_SMOOTH);
-	glEnable(GL_BLEND);	
-	
-	/* Disable lighting because we don't want a 3D effect */
-	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
-	/* The rodlength is the total length of the arrow line.
-	   By default it is 0.25 */
-	rodLength = self->length;
-	 
-	/* The tip of the arrow hea starts at rodLength. 
-	   The size of the arrow is a fifth of the total length */
-	arrowHeadLength = rodLength/5.0;
-
-	textSpacing = 0; //arrowHeadLength;
-	 
-	if (dim == 2) {
-	        /* Drawing the X axis, default is the RED color */
-		lucColour_SetOpenGLColour( &self->colourX );
-
-		glBegin( GL_LINES );
-			glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] ); 
-			glVertex2f( self->origin[I_AXIS] + rodLength , self->origin[J_AXIS]  );
-		glEnd(); 
-		glBegin(GL_TRIANGLES);
-			glVertex2f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS] );
-			glVertex2f( self->origin[I_AXIS] + rodLength - arrowHeadLength, self->origin[J_AXIS] - arrowHeadLength/2.0);
-			glVertex2f( self->origin[I_AXIS] + rodLength - arrowHeadLength, self->origin[J_AXIS] + arrowHeadLength/2.0);
-		glEnd();
-		lucPrint(self->origin[I_AXIS] + rodLength + textSpacing, self->origin[J_AXIS], "X");
-		
-		/* Drawing the Y axis, default is the GREEN color */
-		lucColour_SetOpenGLColour( &self->colourY );
-
-		glBegin( GL_LINES );
-			glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] ); 
-			glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength );
-		glEnd();	
-		glBegin(GL_TRIANGLES);
-			glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength );
-			glVertex2f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength - arrowHeadLength);
-			glVertex2f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength - arrowHeadLength);
-		glEnd();
-		lucPrint(self->origin[I_AXIS], self->origin[J_AXIS] + rodLength + arrowHeadLength, "Y");
-	}
-	else if ( dim == 3 ) {
-		/* Drawing the X axis, by default using the RED color */
-		lucColour_SetOpenGLColour( &self->colourX );
-
-		glBegin(GL_TRIANGLES);
-			glVertex3f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS], self->origin[K_AXIS] );
-			glVertex3f( self->origin[I_AXIS] + rodLength - arrowHeadLength, 
-				    self->origin[J_AXIS] - arrowHeadLength/2.0, self->origin[K_AXIS] );
-			glVertex3f( self->origin[I_AXIS] + rodLength - arrowHeadLength,
-				    self->origin[J_AXIS] + arrowHeadLength/2.0,
-				    self->origin[K_AXIS] );
-		glEnd();
-
-		glBegin( GL_LINES );
-			glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] ); 
-			glVertex3f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS] , self->origin[K_AXIS] );
-		glEnd(); 
-		
-		lucPrint3d( self->origin[I_AXIS] + rodLength + textSpacing, self->origin[J_AXIS], self->origin[K_AXIS], "X");
-		
-		/* Drawing the Y axis, by default using the GREEN color */
-		lucColour_SetOpenGLColour( &self->colourY );
-
-		glBegin(GL_TRIANGLES);
-			glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength, self->origin[K_AXIS]  );
-			glVertex3f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength -arrowHeadLength, 
-				    self->origin[K_AXIS] );
-			glVertex3f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength -arrowHeadLength, 
-				    self->origin[K_AXIS] );
-		glEnd();
-
-		glBegin( GL_LINES );
-			glVertex3f(  self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS]  ); 
-			glVertex3f(  self->origin[I_AXIS], self->origin[J_AXIS] + rodLength , self->origin[K_AXIS]  );
-		glEnd();
-
-		lucPrint3d( self->origin[I_AXIS], self->origin[J_AXIS]+ rodLength + arrowHeadLength, self->origin[K_AXIS], "Y");
-		
-		
-		/* Drawing the Z axis, by default using the BLUE color */
-		lucColour_SetOpenGLColour( &self->colourZ );
-		glBegin(GL_TRIANGLES);
-			glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength );
-			glVertex3f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] , 
-				    self->origin[K_AXIS] + rodLength - arrowHeadLength );
-			glVertex3f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS], 
-				    self->origin[K_AXIS] + rodLength -arrowHeadLength );
-		glEnd();
-
-		glBegin( GL_LINES );
-			glVertex3f(  self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] ); 
-			glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength );
-		glEnd(); 
-
-		lucPrint3d( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength + textSpacing, "Z");
-	}
-	/* Put back settings */
-	glEnable(GL_LIGHTING);
-}
-
-void _lucAxis_CleanUp( void* drawingObject, void* _context ) {
-	lucAxis*      self            = (lucAxis*)drawingObject;
-	
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-
-}
-
-void _lucAxis_BuildDisplayList( void* drawingObject, void* _context ) {
-}
-
-
-
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Axis.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/Axis.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,358 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Axis.c 510 2006-02-17 04:33:32Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#ifdef HAVE_GL2PS
+	#include <gl2ps.h>
+#endif
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "Axis.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+const Type lucAxis_Type = "lucAxis";
+
+lucAxis* lucAxis_New( 
+		Name                                                  name,
+		Coord                                                 origin,
+    		float 				                      length,
+		lucColour                                             colourX,
+		lucColour                                             colourY,
+		lucColour                                             colourZ)
+{
+	lucAxis* self = (lucAxis*) _lucAxis_DefaultNew( name );
+
+	lucAxis_InitAll( self, origin, length, colourX, colourY, colourZ);
+
+	return self;
+}
+
+lucAxis* _lucAxis_New(  LUCAXIS_DEFARGS  )
+{
+	lucAxis*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucAxis) );
+	self = (lucAxis*)  _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	
+	return self;
+}
+
+void lucAxis_Init(		
+		lucAxis*                                         self,
+		Coord                                            origin,
+		float 				                 length,
+		lucColour                                        colourX,
+		lucColour                                        colourY,
+		lucColour                                        colourZ) 
+{
+	
+	self->length = length;
+	memcpy( self->origin, origin, sizeof(Coord) );	
+	memcpy( &(self->colourX), &colourX, sizeof(lucColour) );	
+	memcpy( &(self->colourY), &colourY, sizeof(lucColour) );	
+	memcpy( &(self->colourZ), &colourZ, sizeof(lucColour) );	
+
+	
+}
+
+void lucAxis_InitAll( 
+		void*                                              axis,
+		Coord                                              origin,
+	        float 				                   length,
+		lucColour                                          colourX,
+		lucColour                                          colourY,
+		lucColour                                          colourZ)
+{
+	lucAxis* self        = axis;
+
+	/* TODO Init parent */
+	lucAxis_Init( self, origin, length, colourX, colourY, colourZ );
+}
+
+void _lucAxis_Delete( void* drawingObject ) {
+	lucAxis*  self = (lucAxis*)drawingObject;
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucAxis_Print( void* drawingObject, Stream* stream ) {
+	lucAxis*  self = (lucAxis*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucAxis_Copy( void* axis, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucAxis* self        = axis;
+	lucAxis* newAxis;
+
+	newAxis = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newAxis->length = self->length;
+	memcpy( &(newAxis->colourX),       &(self->colourX),       sizeof(lucColour) );
+	memcpy( &(newAxis->colourY),       &(self->colourY),       sizeof(lucColour) );
+	memcpy( &(newAxis->colourZ),       &(self->colourZ),       sizeof(lucColour) );
+	memcpy( newAxis->origin,       self->origin,       sizeof(Coord) );
+	
+	return (void*) newAxis;
+}
+
+void* _lucAxis_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof( lucAxis );
+	Type                                                             type = lucAxis_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucAxis_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucAxis_Print;
+	Stg_Class_CopyFunction*                                         _copy = _lucAxis_Copy;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucAxis_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucAxis_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucAxis_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucAxis_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucAxis_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucAxis_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucAxis_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucAxis_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucAxis_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucAxis_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucAxis_New(  LUCAXIS_PASSARGS  );
+}
+
+void _lucAxis_AssignFromXML( void* axis, Stg_ComponentFactory* cf, void* data ) {
+	lucAxis*             self               = (lucAxis*) axis;
+        Name colourNameX;
+	Name colourNameY;	
+	Name colourNameZ;		
+	
+	Coord origin;
+	
+	/* Get Stereo Type */
+         /* Construct Parent */
+	_lucDrawingObject_AssignFromXML( self, cf, data );
+
+	colourNameX  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourX", "Red" ) ;
+	colourNameY  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourY", "Green" ) ;
+	colourNameZ  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourZ", "Blue" ) ;
+	
+	lucColour_FromString( &self->colourX, colourNameX );	
+	lucColour_FromString( &self->colourY, colourNameY );
+	lucColour_FromString( &self->colourZ, colourNameZ );
+	
+	origin[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originX", -0.05  );
+	origin[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originY", -0.05  );
+	origin[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originZ", -0.05  );
+	
+       	lucAxis_InitAll( self, 
+	                origin,
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2  ),
+		        self->colourX,
+			self->colourY,
+			self->colourZ);
+			
+}
+
+void _lucAxis_Build( void* Axis, void* data ) { }
+void _lucAxis_Initialise( void* Axis, void* data ) { }
+void _lucAxis_Execute( void* Axis, void* data ) { }
+void _lucAxis_Destroy( void* Axis, void* data ) { }
+
+void _lucAxis_Setup( void* drawingObject, void* _context ) {
+	lucAxis*       self            = (lucAxis*)drawingObject;
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+
+void _lucAxis_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucAxis*				self = (lucAxis*)drawingObject;
+	DomainContext*		context = (DomainContext*) _context;
+	Dimension_Index	dim = context->dim;
+	double				rodLength = 0.0;
+	double				arrowHeadLength = 0.0;
+	double				textSpacing = 0.0;
+		
+	/* Initialise OpenGL stuff */
+	glShadeModel(GL_SMOOTH);
+	glDisable(GL_LIGHTING);
+
+	glEnable(GL_LINE_SMOOTH);
+	glEnable(GL_BLEND);	
+	
+	/* Disable lighting because we don't want a 3D effect */
+	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+	/* The rodlength is the total length of the arrow line.
+	   By default it is 0.25 */
+	rodLength = self->length;
+	 
+	/* The tip of the arrow hea starts at rodLength. 
+	   The size of the arrow is a fifth of the total length */
+	arrowHeadLength = rodLength/5.0;
+
+	textSpacing = 0; //arrowHeadLength;
+	 
+	if (dim == 2) {
+	        /* Drawing the X axis, default is the RED color */
+		lucColour_SetOpenGLColour( &self->colourX );
+
+		glBegin( GL_LINES );
+			glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] ); 
+			glVertex2f( self->origin[I_AXIS] + rodLength , self->origin[J_AXIS]  );
+		glEnd(); 
+		glBegin(GL_TRIANGLES);
+			glVertex2f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS] );
+			glVertex2f( self->origin[I_AXIS] + rodLength - arrowHeadLength, self->origin[J_AXIS] - arrowHeadLength/2.0);
+			glVertex2f( self->origin[I_AXIS] + rodLength - arrowHeadLength, self->origin[J_AXIS] + arrowHeadLength/2.0);
+		glEnd();
+		lucPrint(self->origin[I_AXIS] + rodLength + textSpacing, self->origin[J_AXIS], "X");
+		
+		/* Drawing the Y axis, default is the GREEN color */
+		lucColour_SetOpenGLColour( &self->colourY );
+
+		glBegin( GL_LINES );
+			glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] ); 
+			glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength );
+		glEnd();	
+		glBegin(GL_TRIANGLES);
+			glVertex2f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength );
+			glVertex2f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength - arrowHeadLength);
+			glVertex2f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength - arrowHeadLength);
+		glEnd();
+		lucPrint(self->origin[I_AXIS], self->origin[J_AXIS] + rodLength + arrowHeadLength, "Y");
+	}
+	else if ( dim == 3 ) {
+		/* Drawing the X axis, by default using the RED color */
+		lucColour_SetOpenGLColour( &self->colourX );
+
+		glBegin(GL_TRIANGLES);
+			glVertex3f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS], self->origin[K_AXIS] );
+			glVertex3f( self->origin[I_AXIS] + rodLength - arrowHeadLength, 
+				    self->origin[J_AXIS] - arrowHeadLength/2.0, self->origin[K_AXIS] );
+			glVertex3f( self->origin[I_AXIS] + rodLength - arrowHeadLength,
+				    self->origin[J_AXIS] + arrowHeadLength/2.0,
+				    self->origin[K_AXIS] );
+		glEnd();
+
+		glBegin( GL_LINES );
+			glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] ); 
+			glVertex3f( self->origin[I_AXIS] + rodLength, self->origin[J_AXIS] , self->origin[K_AXIS] );
+		glEnd(); 
+		
+		lucPrint3d( self->origin[I_AXIS] + rodLength + textSpacing, self->origin[J_AXIS], self->origin[K_AXIS], "X");
+		
+		/* Drawing the Y axis, by default using the GREEN color */
+		lucColour_SetOpenGLColour( &self->colourY );
+
+		glBegin(GL_TRIANGLES);
+			glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] + rodLength, self->origin[K_AXIS]  );
+			glVertex3f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength -arrowHeadLength, 
+				    self->origin[K_AXIS] );
+			glVertex3f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS] + rodLength -arrowHeadLength, 
+				    self->origin[K_AXIS] );
+		glEnd();
+
+		glBegin( GL_LINES );
+			glVertex3f(  self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS]  ); 
+			glVertex3f(  self->origin[I_AXIS], self->origin[J_AXIS] + rodLength , self->origin[K_AXIS]  );
+		glEnd();
+
+		lucPrint3d( self->origin[I_AXIS], self->origin[J_AXIS]+ rodLength + arrowHeadLength, self->origin[K_AXIS], "Y");
+		
+		
+		/* Drawing the Z axis, by default using the BLUE color */
+		lucColour_SetOpenGLColour( &self->colourZ );
+		glBegin(GL_TRIANGLES);
+			glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength );
+			glVertex3f( self->origin[I_AXIS] + arrowHeadLength/2.0, self->origin[J_AXIS] , 
+				    self->origin[K_AXIS] + rodLength - arrowHeadLength );
+			glVertex3f( self->origin[I_AXIS] - arrowHeadLength/2.0, self->origin[J_AXIS], 
+				    self->origin[K_AXIS] + rodLength -arrowHeadLength );
+		glEnd();
+
+		glBegin( GL_LINES );
+			glVertex3f(  self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] ); 
+			glVertex3f( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength );
+		glEnd(); 
+
+		lucPrint3d( self->origin[I_AXIS], self->origin[J_AXIS] , self->origin[K_AXIS] + rodLength + textSpacing, "Z");
+	}
+	/* Put back settings */
+	glEnable(GL_LIGHTING);
+}
+
+void _lucAxis_CleanUp( void* drawingObject, void* _context ) {
+	lucAxis*      self            = (lucAxis*)drawingObject;
+	
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+
+}
+
+void _lucAxis_BuildDisplayList( void* drawingObject, void* _context ) {
+}
+
+
+
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ColourBar.c
--- a/DrawingObjects/src/ColourBar.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,393 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: ColourBar.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#ifdef HAVE_GL2PS
-	#include <gl2ps.h>
-#endif
-
-#include "types.h"
-#include "ColourBar.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucColourBar_Type = "lucColourBar";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucColourBar* _lucColourBar_New(  LUCCOLOURBAR_DEFARGS  ) 
-{
-	lucColourBar*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucColourBar) );
-	self = (lucColourBar*) _lucDrawingObject_New(  LUCDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucColourBar_Init( 
-		lucColourBar*                                                self,
-		lucColourMap*                                                colourMap,
-		double                                                       lengthFactor,    
-		Pixel_Index                                                  height,    
-		Pixel_Index                                                  margin,
-		float                                                        borderWidth,
-		int                                                          precision,
-		Bool                                                         scientific,
-		int                                                          ticks,
-		Bool                                                         printTickValue,
-		float                                                        scaleValue,
-        double                                                       tickValues[] )
-{
-	self->colourMap = colourMap;
-	self->lengthFactor = lengthFactor;
-	self->height = height;
-	self->margin = margin;
-	self->borderWidth = borderWidth;
-	self->precision = precision;
-	self->scientific = scientific;
-	self->ticks = ticks;
-	self->printTickValue = printTickValue;
-	self->scaleValue = scaleValue;
-    int i;
-    for (i = 0; i < 10; i++)    
-        self->tickValues[i] = tickValues[i];
-}
-
-void _lucColourBar_Delete( void* drawingObject ) {
-	lucColourBar*  self = (lucColourBar*)drawingObject;
-
-	_lucDrawingObject_Delete( self );
-}
-
-void _lucColourBar_Print( void* drawingObject, Stream* stream ) {
-	lucColourBar*  self = (lucColourBar*)drawingObject;
-
-	_lucDrawingObject_Print( self, stream );
-}
-
-void* _lucColourBar_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucColourBar*  self = (lucColourBar*)drawingObject;
-	lucColourBar* newDrawingObject;
-
-	newDrawingObject = _lucDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucColourBar_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucColourBar);
-	Type                                                      type = lucColourBar_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucColourBar_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucColourBar_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucColourBar_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucColourBar_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucColourBar_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucColourBar_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucColourBar_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucColourBar_Destroy;
-	lucDrawingObject_SetupFunction*                         _setup = _lucColourBar_Setup;
-	lucDrawingObject_DrawFunction*                           _draw = _lucColourBar_Draw;
-	lucDrawingObject_CleanUpFunction*                     _cleanUp = _lucColourBar_CleanUp;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucColourBar_New(  LUCCOLOURBAR_PASSARGS  );
-}
-
-void _lucColourBar_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucColourBar*   self = (lucColourBar*)drawingObject;
-	lucColourMap*   colourMap;
-    unsigned int    i, defaultTicks, ticks;
-    double          tickValues[11];
-    char            tickLabel[10];
-
-	/* Construct Parent */
-	_lucDrawingObject_AssignFromXML( self, cf, data );
-
-	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, True, data  ) ;
-
-    /* Default to 0 tick marks for linear, 1 for fixed centre, 2 for logarithmic scale */
-    defaultTicks = 0;
-    if (colourMap->centreOnFixedValue) defaultTicks = 1;
-    if (colourMap->logScale) defaultTicks = 2;
-	ticks = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"ticks", defaultTicks );
-    if (ticks > 9) ticks = 9;
-
-    /* Load any provided intermediate tick values (tick1-9) */
-    for (i = 1; i < ticks+1; i++ ) {
-        sprintf(tickLabel, "tick%d", i);
-		tickValues[i] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)tickLabel, colourMap->maximum + 1 );
-	}
-    tickValues[0] = colourMap->minimum;
-    tickValues[ticks+1] = colourMap->maximum;
-
-	_lucColourBar_Init( 
-			self, 
-			colourMap,
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthFactor", 0.8  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"height", 10  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"margin", 16  ),
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"borderWidth", 1  ) ,
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"precision", 2  ) ,
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"scientific", False  ),
-   			ticks,
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"printTickValue", True  ),
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleValue", 1.0  ),
-            tickValues
-			);
-}
-
-void _lucColourBar_Build( void* drawingObject, void* data ) {}
-void _lucColourBar_Initialise( void* drawingObject, void* data ) {}
-void _lucColourBar_Execute( void* drawingObject, void* data ) {}
-void _lucColourBar_Destroy( void* drawingObject, void* data ) {}
-
-void _lucColourBar_Setup( void* drawingObject, void* _context ) {
-}
-
-void _lucColourBar_WithPrecision(char *string, Bool scientific, int precision, float scaleValue, double value){
-
-if(precision > 5 ) precision = 2;
-
-/* For display purpose, scales the printed values if needed */
-value = scaleValue * value;
-
-	if(scientific){
-		if( precision == 1 ){
-			sprintf(string, "%.1e", value);
-			return;
-			}
-		if( precision == 2 ){
-			sprintf(string, "%.2e", value);
-			return;
-			}
-		if( precision == 3 ){
-			sprintf(string, "%.3e", value);
-			return;
-			}
-		if( precision == 4 ){
-			sprintf(string, "%.4e", value);
-			return;
-			}
-		if( precision == 5 ){
-			sprintf(string, "%.5e", value);
-			return;
-			}
-	}
-	else{
-		if( precision == 1 ){
-			sprintf(string, "%.1g", value);
-			return;
-			}
-		if( precision == 2 ){
-			sprintf(string, "%.2g", value);
-			return;
-			}
-		if( precision == 3 ){
-			sprintf(string, "%.3g", value);
-			return;
-			}
-		if( precision == 4 ){
-			sprintf(string, "%.4g", value);
-			return;
-			}
-		if( precision == 5 ){
-			sprintf(string, "%.5g", value);
-			return;
-			}
-	}
-
-}
-	
-void _lucColourBar_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucColourBar*            self          = (lucColourBar*)drawingObject;
-	lucColourMap*            colourMap     = self->colourMap;
-	Pixel_Index              length        = (Pixel_Index) ((double) viewportInfo->width * self->lengthFactor);
-	Pixel_Index              height         = self->height;
-	Pixel_Index              pixel_I;
-	double                   value;
-	double                   tickValue;
-	int                      	startx, starty;
-	char                     string[20];
-	int i = 0;
-	/* AbstractContext*         context = (AbstractContext*) _context; */
-
-	/* Only get master to draw colour bar - /
-	if ( context->rank != MASTER ) return; */
-
-	/* Set up 2D Viewer the size of the viewport */
-	lucViewport2d(True, viewportInfo);
-
-	lucSetFontCharset(FONT_SMALL);
-	
-	startx = (viewportInfo->width - length)/2;
-	starty = viewportInfo->height - self->margin - self->height;
-
-    /* Write scale */
-    lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
-    glLineWidth( self->borderWidth );
-
-    /* Update min/max end ticks */
-    self->tickValues[0] = colourMap->minimum;
-    self->tickValues[self->ticks+1] = colourMap->maximum;
-
-    for (i = 0; i < self->ticks+2; i++){
-        /* Calculate tick position */
-        float scaledPos;
-        if (self->tickValues[i] > colourMap->maximum)
-        {
-            /* First get scaled position 0-1 */
-            if (colourMap->logScale)
-            {
-                /* Space ticks based on a logarithmic scale of log(1) to log(11)
-                   shows non-linearity while keeping ticks spaced apart enough to read labels */
-                float tickpos = 1.0 + (float)i * (10.0 / (self->ticks+1));
-                scaledPos = (log10(tickpos) / log10(11));
-            }
-            else
-                /* Default linear scale evenly spaced ticks */
-                scaledPos = (float)i / (self->ticks+1);
-
-            /* Compute the tick value */
-            if (colourMap->logScale ) {
-                /* Reverse calc to find Value tick value at calculated position 0-1: */
-                tickValue = log10(colourMap->minimum) + scaledPos 
-                          * (log10(colourMap->maximum) - log10(colourMap->minimum));
-                tickValue = pow( 10.0, tickValue );
-            }
-            else
-            {
-                /* Reverse scale calc and find value of tick at position 0-1 */
-                if (colourMap->centreOnFixedValue && colourMap->centringValue > 0)
-                {
-                    /* Using fixed centre value, even linear scales either side */
-                    if (scaledPos > 0.5)
-                        tickValue = (colourMap->maximum - colourMap->centringValue)
-                                  * (scaledPos - 0.5) / 0.5 + colourMap->centringValue;
-                    else
-                        tickValue = (colourMap->centringValue - colourMap->minimum)
-                                  * scaledPos / 0.5 + colourMap->minimum;
-                }
-                else
-                    /* Using even linear scale */
-                    tickValue = colourMap->minimum + scaledPos * (colourMap->maximum - colourMap->minimum);
-            }
-        }
-        else
-        {
-            /* User specified value */
-            tickValue = self->tickValues[i];
-            /* Calculate scaled position from value */
-            scaledPos = lucColourMap_ScaleValue(colourMap, tickValue);
-        }
-
-        /* Calculate pixel position */
-        int xpos = startx + length * scaledPos;
-
-        /* Draws the tick */
-        glBegin(GL_LINES);
-            glVertex2i( xpos, starty+5+self->height );
-            glVertex2i( xpos, starty+self->height);
-        glEnd();
-        
- 
-        /* Always print end values, print others if flag set */	
-        if (self->printTickValue || i == 0 || i == self->ticks+1) 
-        {
-            if ( !self->scientific && fabs(tickValue) < 1.0e-5 )
-                sprintf( string, "0" );
-            else
-                _lucColourBar_WithPrecision( string, self->scientific, self->precision, self->scaleValue, tickValue);
-
-            lucPrint(xpos - (int) (0.5 * (float)lucStringWidth(string)),  starty + 13, string );
-        }
-    }
-
-    /* Draw Colour Bar */
-    for ( pixel_I = 0 ; pixel_I < length ; pixel_I++ ) {
-        value = ((float)pixel_I / length);
-        lucColourMap_SetOpenGLColourFromScaledValue( colourMap, value);
-        glRecti( startx + pixel_I, starty, startx + pixel_I + 1 , starty + height );
-    }
-
-	/* Draw Box around colour bar */
-	lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
-	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-	glRecti(startx, starty, startx + length, starty + height);
-	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-
-	lucSetFontCharset(FONT_DEFAULT);
-
-	/* Restore the viewport */
-	lucViewport2d(False, viewportInfo);
-}
-
-void _lucColourBar_CleanUp( void* drawingObject, void* _context ) {
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ColourBar.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/ColourBar.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,393 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: ColourBar.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#ifdef HAVE_GL2PS
+	#include <gl2ps.h>
+#endif
+
+#include "types.h"
+#include "ColourBar.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucColourBar_Type = "lucColourBar";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucColourBar* _lucColourBar_New(  LUCCOLOURBAR_DEFARGS  ) 
+{
+	lucColourBar*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucColourBar) );
+	self = (lucColourBar*) _lucDrawingObject_New(  LUCDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucColourBar_Init( 
+		lucColourBar*                                                self,
+		lucColourMap*                                                colourMap,
+		double                                                       lengthFactor,    
+		Pixel_Index                                                  height,    
+		Pixel_Index                                                  margin,
+		float                                                        borderWidth,
+		int                                                          precision,
+		Bool                                                         scientific,
+		int                                                          ticks,
+		Bool                                                         printTickValue,
+		float                                                        scaleValue,
+        double                                                       tickValues[] )
+{
+	self->colourMap = colourMap;
+	self->lengthFactor = lengthFactor;
+	self->height = height;
+	self->margin = margin;
+	self->borderWidth = borderWidth;
+	self->precision = precision;
+	self->scientific = scientific;
+	self->ticks = ticks;
+	self->printTickValue = printTickValue;
+	self->scaleValue = scaleValue;
+    int i;
+    for (i = 0; i < 10; i++)    
+        self->tickValues[i] = tickValues[i];
+}
+
+void _lucColourBar_Delete( void* drawingObject ) {
+	lucColourBar*  self = (lucColourBar*)drawingObject;
+
+	_lucDrawingObject_Delete( self );
+}
+
+void _lucColourBar_Print( void* drawingObject, Stream* stream ) {
+	lucColourBar*  self = (lucColourBar*)drawingObject;
+
+	_lucDrawingObject_Print( self, stream );
+}
+
+void* _lucColourBar_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucColourBar*  self = (lucColourBar*)drawingObject;
+	lucColourBar* newDrawingObject;
+
+	newDrawingObject = _lucDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucColourBar_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucColourBar);
+	Type                                                      type = lucColourBar_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucColourBar_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucColourBar_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucColourBar_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucColourBar_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucColourBar_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucColourBar_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucColourBar_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucColourBar_Destroy;
+	lucDrawingObject_SetupFunction*                         _setup = _lucColourBar_Setup;
+	lucDrawingObject_DrawFunction*                           _draw = _lucColourBar_Draw;
+	lucDrawingObject_CleanUpFunction*                     _cleanUp = _lucColourBar_CleanUp;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucColourBar_New(  LUCCOLOURBAR_PASSARGS  );
+}
+
+void _lucColourBar_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucColourBar*   self = (lucColourBar*)drawingObject;
+	lucColourMap*   colourMap;
+    unsigned int    i, defaultTicks, ticks;
+    double          tickValues[11];
+    char            tickLabel[10];
+
+	/* Construct Parent */
+	_lucDrawingObject_AssignFromXML( self, cf, data );
+
+	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, True, data  ) ;
+
+    /* Default to 0 tick marks for linear, 1 for fixed centre, 2 for logarithmic scale */
+    defaultTicks = 0;
+    if (colourMap->centreOnFixedValue) defaultTicks = 1;
+    if (colourMap->logScale) defaultTicks = 2;
+	ticks = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"ticks", defaultTicks );
+    if (ticks > 9) ticks = 9;
+
+    /* Load any provided intermediate tick values (tick1-9) */
+    for (i = 1; i < ticks+1; i++ ) {
+        sprintf(tickLabel, "tick%d", i);
+		tickValues[i] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)tickLabel, colourMap->maximum + 1 );
+	}
+    tickValues[0] = colourMap->minimum;
+    tickValues[ticks+1] = colourMap->maximum;
+
+	_lucColourBar_Init( 
+			self, 
+			colourMap,
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthFactor", 0.8  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"height", 10  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"margin", 16  ),
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"borderWidth", 1  ) ,
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"precision", 2  ) ,
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"scientific", False  ),
+   			ticks,
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"printTickValue", True  ),
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleValue", 1.0  ),
+            tickValues
+			);
+}
+
+void _lucColourBar_Build( void* drawingObject, void* data ) {}
+void _lucColourBar_Initialise( void* drawingObject, void* data ) {}
+void _lucColourBar_Execute( void* drawingObject, void* data ) {}
+void _lucColourBar_Destroy( void* drawingObject, void* data ) {}
+
+void _lucColourBar_Setup( void* drawingObject, void* _context ) {
+}
+
+void _lucColourBar_WithPrecision(char *string, Bool scientific, int precision, float scaleValue, double value){
+
+if(precision > 5 ) precision = 2;
+
+/* For display purpose, scales the printed values if needed */
+value = scaleValue * value;
+
+	if(scientific){
+		if( precision == 1 ){
+			sprintf(string, "%.1e", value);
+			return;
+			}
+		if( precision == 2 ){
+			sprintf(string, "%.2e", value);
+			return;
+			}
+		if( precision == 3 ){
+			sprintf(string, "%.3e", value);
+			return;
+			}
+		if( precision == 4 ){
+			sprintf(string, "%.4e", value);
+			return;
+			}
+		if( precision == 5 ){
+			sprintf(string, "%.5e", value);
+			return;
+			}
+	}
+	else{
+		if( precision == 1 ){
+			sprintf(string, "%.1g", value);
+			return;
+			}
+		if( precision == 2 ){
+			sprintf(string, "%.2g", value);
+			return;
+			}
+		if( precision == 3 ){
+			sprintf(string, "%.3g", value);
+			return;
+			}
+		if( precision == 4 ){
+			sprintf(string, "%.4g", value);
+			return;
+			}
+		if( precision == 5 ){
+			sprintf(string, "%.5g", value);
+			return;
+			}
+	}
+
+}
+	
+void _lucColourBar_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucColourBar*            self          = (lucColourBar*)drawingObject;
+	lucColourMap*            colourMap     = self->colourMap;
+	Pixel_Index              length        = (Pixel_Index) ((double) viewportInfo->width * self->lengthFactor);
+	Pixel_Index              height         = self->height;
+	Pixel_Index              pixel_I;
+	double                   value;
+	double                   tickValue;
+	int                      	startx, starty;
+	char                     string[20];
+	int i = 0;
+	/* AbstractContext*         context = (AbstractContext*) _context; */
+
+	/* Only get master to draw colour bar - /
+	if ( context->rank != MASTER ) return; */
+
+	/* Set up 2D Viewer the size of the viewport */
+	lucViewport2d(True, viewportInfo);
+
+	lucSetFontCharset(FONT_SMALL);
+	
+	startx = (viewportInfo->width - length)/2;
+	starty = viewportInfo->height - self->margin - self->height;
+
+    /* Write scale */
+    lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
+    glLineWidth( self->borderWidth );
+
+    /* Update min/max end ticks */
+    self->tickValues[0] = colourMap->minimum;
+    self->tickValues[self->ticks+1] = colourMap->maximum;
+
+    for (i = 0; i < self->ticks+2; i++){
+        /* Calculate tick position */
+        float scaledPos;
+        if (self->tickValues[i] > colourMap->maximum)
+        {
+            /* First get scaled position 0-1 */
+            if (colourMap->logScale)
+            {
+                /* Space ticks based on a logarithmic scale of log(1) to log(11)
+                   shows non-linearity while keeping ticks spaced apart enough to read labels */
+                float tickpos = 1.0 + (float)i * (10.0 / (self->ticks+1));
+                scaledPos = (log10(tickpos) / log10(11));
+            }
+            else
+                /* Default linear scale evenly spaced ticks */
+                scaledPos = (float)i / (self->ticks+1);
+
+            /* Compute the tick value */
+            if (colourMap->logScale ) {
+                /* Reverse calc to find Value tick value at calculated position 0-1: */
+                tickValue = log10(colourMap->minimum) + scaledPos 
+                          * (log10(colourMap->maximum) - log10(colourMap->minimum));
+                tickValue = pow( 10.0, tickValue );
+            }
+            else
+            {
+                /* Reverse scale calc and find value of tick at position 0-1 */
+                if (colourMap->centreOnFixedValue && colourMap->centringValue > 0)
+                {
+                    /* Using fixed centre value, even linear scales either side */
+                    if (scaledPos > 0.5)
+                        tickValue = (colourMap->maximum - colourMap->centringValue)
+                                  * (scaledPos - 0.5) / 0.5 + colourMap->centringValue;
+                    else
+                        tickValue = (colourMap->centringValue - colourMap->minimum)
+                                  * scaledPos / 0.5 + colourMap->minimum;
+                }
+                else
+                    /* Using even linear scale */
+                    tickValue = colourMap->minimum + scaledPos * (colourMap->maximum - colourMap->minimum);
+            }
+        }
+        else
+        {
+            /* User specified value */
+            tickValue = self->tickValues[i];
+            /* Calculate scaled position from value */
+            scaledPos = lucColourMap_ScaleValue(colourMap, tickValue);
+        }
+
+        /* Calculate pixel position */
+        int xpos = startx + length * scaledPos;
+
+        /* Draws the tick */
+        glBegin(GL_LINES);
+            glVertex2i( xpos, starty+5+self->height );
+            glVertex2i( xpos, starty+self->height);
+        glEnd();
+        
+ 
+        /* Always print end values, print others if flag set */	
+        if (self->printTickValue || i == 0 || i == self->ticks+1) 
+        {
+            if ( !self->scientific && fabs(tickValue) < 1.0e-5 )
+                sprintf( string, "0" );
+            else
+                _lucColourBar_WithPrecision( string, self->scientific, self->precision, self->scaleValue, tickValue);
+
+            lucPrint(xpos - (int) (0.5 * (float)lucStringWidth(string)),  starty + 13, string );
+        }
+    }
+
+    /* Draw Colour Bar */
+    for ( pixel_I = 0 ; pixel_I < length ; pixel_I++ ) {
+        value = ((float)pixel_I / length);
+        lucColourMap_SetOpenGLColourFromScaledValue( colourMap, value);
+        glRecti( startx + pixel_I, starty, startx + pixel_I + 1 , starty + height );
+    }
+
+	/* Draw Box around colour bar */
+	lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
+	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+	glRecti(startx, starty, startx + length, starty + height);
+	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+
+	lucSetFontCharset(FONT_DEFAULT);
+
+	/* Restore the viewport */
+	lucViewport2d(False, viewportInfo);
+}
+
+void _lucColourBar_CleanUp( void* drawingObject, void* _context ) {
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Contour.c
--- a/DrawingObjects/src/Contour.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,485 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Contour.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "Contour.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucContour_Type = "lucContour";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucContour* _lucContour_New(  LUCCONTOUR_DEFARGS  ) 
-{
-	lucContour*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucContour) );
-	self = (lucContour*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucContour_Init( 
-		lucContour*      self,
-		FieldVariable*   fieldVariable,
-		lucColourMap*    colourMap,
-		Name             colourName,
-		IJK              resolution,
-		double           lineWidth,
-    Bool             showValues,
-		double           interval )
-{
-	self->fieldVariable = fieldVariable;
-	self->colourMap     = colourMap;
-	lucColour_FromString( &self->colour, colourName );
-	memcpy( self->resolution, resolution, sizeof(IJK) );
-	self->lineWidth = lineWidth;
-	self->showValues = showValues;
-	self->interval = interval;
-}
-
-void _lucContour_Delete( void* drawingObject ) {
-	lucContour*  self = (lucContour*)drawingObject;
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucContour_Print( void* drawingObject, Stream* stream ) {
-	lucContour*  self = (lucContour*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucContour_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucContour*  self = (lucContour*)drawingObject;
-	lucContour* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucContour_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucContour);
-	Type                                                             type = lucContour_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucContour_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucContour_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucContour_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucContour_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucContour_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucContour_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucContour_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucContour_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucContour_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucContour_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucContour_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucContour_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucContour_New(  LUCCONTOUR_PASSARGS  );
-}
-
-void _lucContour_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucContour*      self = (lucContour*)drawingObject;
-	Index            defaultResolution;
-	FieldVariable*   fieldVariable;
-	lucColourMap*    colourMap;
-	IJK              resolution;
-	Bool             showValues;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	fieldVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", FieldVariable, True, data  );
-	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
-
-	showValues = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"showValues", True  );
-	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 8  );
-	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
-	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
-	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
-			
-	_lucContour_Init( 
-			self, 
-			fieldVariable,
-			colourMap,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
-			resolution,
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
-      showValues,
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"interval", 0.33 )  ) ;
-}
-
-void _lucContour_Build( void* drawingObject, void* data ) {}
-void _lucContour_Initialise( void* drawingObject, void* data ) {}
-void _lucContour_Execute( void* drawingObject, void* data ) {}
-void _lucContour_Destroy( void* drawingObject, void* data ) {}
-
-void _lucContour_Setup( void* drawingObject, void* _context ) {
-	lucContour*            self            = (lucContour*)drawingObject;
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-
-void _lucContour_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucContour*            self            = (lucContour*)drawingObject;
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-void _lucContour_CleanUp( void* drawingObject, void* _context ) {
-	lucContour*            self            = (lucContour*)drawingObject;
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}
-	
-void _lucContour_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucContour*            self            = (lucContour*)drawingObject;
-	FieldVariable*         fieldVariable   = self->fieldVariable;
-	double                 isovalue;
-	double                 interval        = self->interval;
-	double                 minIsovalue     = FieldVariable_GetMinGlobalFieldMagnitude( fieldVariable );
-	double                 maxIsovalue     = FieldVariable_GetMaxGlobalFieldMagnitude( fieldVariable );
-	lucColourMap*          colourMap       = self->colourMap;
-	Coord min, max;
-	
-	glLineWidth(self->lineWidth);
-
-	FieldVariable_GetMinAndMaxLocalCoords( fieldVariable, min, max );
-	
-	lucColour_SetOpenGLColour( &self->colour );
-
-	/* Draw isovalues at interval */
-	if ( interval <= 0.0 ) 
-		return;
-
-	for ( isovalue = minIsovalue + interval ; isovalue < maxIsovalue ; isovalue += interval ) {
-		if ( colourMap )
-			lucColourMap_SetOpenGLColourFromValue( colourMap, isovalue );
-		
-		lucContour_DrawContourWalls( self, isovalue, min, max );
-	}
-}
-
-
-#define LEFT   0
-#define RIGHT  1
-#define BOTTOM 2
-#define TOP    3
-
-void lucContour_DrawContourWalls( 
-		void*                                             drawingObject,
-		double                                            isovalue,
-		Coord                                             min,
-		Coord                                             max )
-{
-	lucContour*            self            = (lucContour*)drawingObject;
-	Dimension_Index        dim             = self->fieldVariable->dim;
-
-	if ( dim == 2 ) {
-		lucContour_DrawContour( self, isovalue, 0.0, K_AXIS, min, max ); 
-	}
-	else {
-		lucContour_DrawContour( self, isovalue, min[ I_AXIS ], I_AXIS, min, max ); 
-		lucContour_DrawContour( self, isovalue, max[ I_AXIS ], I_AXIS, min, max ); 
-		lucContour_DrawContour( self, isovalue, min[ J_AXIS ], J_AXIS, min, max ); 
-		lucContour_DrawContour( self, isovalue, max[ J_AXIS ], J_AXIS, min, max ); 
-		lucContour_DrawContour( self, isovalue, min[ K_AXIS ], K_AXIS, min, max ); 
-		lucContour_DrawContour( self, isovalue, max[ K_AXIS ], K_AXIS, min, max ); 
-	}
-}
-	
-
-void lucContour_DrawContour( 
-		void*                                             drawingObject,
-		double                                            isovalue,
-		double                                            planeHeight,
-		Axis                                              planeAxis,
-		Coord                                             min,
-		Coord                                             max )
-{
-	lucContour*            self            = (lucContour*)drawingObject;
-	FieldVariable*         fieldVariable   = self->fieldVariable;
-	Axis                   aAxis           = ( planeAxis == I_AXIS ? J_AXIS : I_AXIS );
-	Axis                   bAxis           = ( planeAxis == K_AXIS ? J_AXIS : K_AXIS );
-	unsigned int           elementType;
-	unsigned int           i, j;
-	Coord                  pos;
-	double **              array;
-	Index                  resolutionA     = self->resolution[ aAxis ];
-	Index                  resolutionB     = self->resolution[ bAxis ];
-  char                   numberStr[10];
-	double                 dA, dB;
-  int rememberCoord = 0;
-  double writePos[2];
-	
-	/* Find position of cross - section */
-	pos[planeAxis] = planeHeight;
-	
-	/* Calculate number of points in direction A and B */
-	dA = (max[ aAxis ] - min[ aAxis ])/(double) (resolutionA - 1);
-	dB = (max[ bAxis ] - min[ bAxis ])/(double) (resolutionB - 1);
-
-	array = Memory_Alloc_2DArray( double , resolutionA, resolutionB, (Name)"Field Values" );
-	for ( i = 0, pos[ aAxis ] = min[ aAxis ] ; i < resolutionA ; i++, pos[aAxis] += dA ) {
-		for ( j = 0, pos[bAxis] = min[ bAxis ] ; j < resolutionB ; j++, pos[bAxis] += dB ) {
-			if (pos[aAxis] > max[ aAxis ]) 
-				pos[aAxis] = max[ aAxis ];
-			if (pos[bAxis] > max[ bAxis ]) 
-				pos[bAxis] = max[ bAxis ];
-
-			/* Interpolate value to point */
-			FieldVariable_InterpolateValueAt( fieldVariable, pos, &array[i][j] );
-		}
-	}
-		
-	/* Initialise OpenGL stuff */
-	glDisable(GL_LIGHTING);
-	glEnable(GL_LINE_SMOOTH);
-	glEnable(GL_BLEND);
-	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-	glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
-    glDisable(GL_DEPTH_TEST); /* Depth test messes up line anti-aliasing, needs checking on multiple procs */
-	glBegin(GL_LINES);
-
-	/* Start marching rectangles */
-	for ( i = 0, pos[ aAxis ] = min[ aAxis ] ; i < resolutionA - 1 ; i++, pos[ aAxis ] += dA ) {
-		for ( j = 0, pos[ bAxis ] = min[ bAxis ] ; j < resolutionB - 1 ; j++, pos[ bAxis ] += dB ) {
-			/* Assign a unique number to the square type from 0 to 15 */
-			elementType = 0;
-			if (array[i][j]     > isovalue) 	elementType += 1;
-			if (array[i+1][j]   > isovalue) 	elementType += 2;
-			if (array[i][j+1]   > isovalue) 	elementType += 4;
-			if (array[i+1][j+1] > isovalue) 	elementType += 8;
-
-			switch ( elementType ) {
-				case 0:
-					/*  @@  */
-					/*  @@  */
-					break;
-				case 1:		
-					/*  @@  */
-					/*  #@  */
-					lucContour_PlotPoint( LEFT,   isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 2:
-					/*  @@  */
-					/*  @#  */	
-					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 3:
-					/*  @@  */
-					/*  ##  */	
-					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					if( rememberCoord == 0 )  {
-            writePos[0] = pos[aAxis] + dA;
-            writePos[1] = pos[bAxis] + dB;
-            rememberCoord = 1;
-          }break;
-				case 4:
-					/*  #@  */
-					/*  @@  */
-					lucContour_PlotPoint( LEFT  , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( TOP   , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 5:
-					/*  #@  */
-					/*  #@  */
-					lucContour_PlotPoint( TOP   , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					if( rememberCoord == 0 )  {
-            writePos[0] = pos[aAxis] + dA;
-            writePos[1] = pos[bAxis] + dB;
-            rememberCoord = 1;
-          }break;
-				case 6:
-					/*  #@  */
-					/*  @#  */
-					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( TOP , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-
-					lucContour_PlotPoint( RIGHT , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 7:
-					/*  #@  */
-					/*  ##  */
-					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 8:
-					/*  @#  */
-					/*  @@  */
-					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 9:
-					/*  @#  */
-					/*  #@  */
-					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-
-					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 10:
-					/*  @#  */
-					/*  @#  */
-					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-          if( rememberCoord == 0 )  {
-            writePos[0] = pos[aAxis] + dA;
-            writePos[1] = pos[bAxis] + dB;
-            rememberCoord = 1;
-          }
-					break;
-				case 11:
-					/*  @#  */
-					/*  ##  */
-					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 12:
-					/*  ##  */
-					/*  @@  */
-					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					if( rememberCoord == 0 )  {
-            writePos[0] = pos[aAxis] + dA;
-            writePos[1] = pos[bAxis] + dB;
-            rememberCoord = 1;
-          }break;
-				case 13:
-					/*  ##  */
-					/*  #@  */
-					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 14:
-					/*  ##  */
-					/*  @#  */
-					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
-					break;
-				case 15:
-					/*  ##  */
-					/*  ##  */
-					break;
-				default:
-					fprintf(stderr, "In func %s: Cannot find element %d.\n", __func__, elementType );
-					abort();
-			}
-			
-		}
-	}
-	glEnd();
-
-  /* print the isovalue "near" the last isovalue */
-  sprintf( numberStr, "%g", isovalue );
-  lucPrint( writePos[0], writePos[1], numberStr);
-  rememberCoord= 0;
-
-	glEnable(GL_LIGHTING);
-    glEnable(GL_DEPTH_TEST);
-
-	/* Clean up */
-	Memory_Free(array);
-}
-
-void lucContour_PlotPoint( char edge, double isovalue, double leftBtm, double rightBtm, double leftTop, double rightTop , Coord pos, double dA, double dB, Axis planeAxis ) {
-	Axis            aAxis           = ( planeAxis == I_AXIS ? J_AXIS : I_AXIS );
-	Axis            bAxis           = ( planeAxis == K_AXIS ? J_AXIS : K_AXIS );
-	Coord           vertex;
-	
-	vertex[planeAxis] = pos[planeAxis];
-
-	switch (edge) {
-		case BOTTOM:
-			vertex[aAxis] = pos[aAxis] + dA * (isovalue - leftBtm)/(rightBtm - leftBtm) ; 
-			vertex[bAxis] = pos[bAxis];
-			break;
-		case TOP:	
-			vertex[aAxis] = pos[aAxis] + dA * (isovalue - leftTop)/(rightTop - leftTop); 
-			vertex[bAxis] = pos[bAxis] + dB;
-			break;
-		case LEFT:	
-			vertex[aAxis] = pos[aAxis];
-			vertex[bAxis] = pos[bAxis] + dB * (isovalue - leftBtm)/(leftTop - leftBtm); 
-			break;
-		case RIGHT:	
-			vertex[aAxis] = pos[aAxis] + dA;
-			vertex[bAxis] = pos[bAxis] + dB * (isovalue - rightBtm)/(rightTop - rightBtm ); 
-			break;
-	}
-	glVertex3dv(vertex);
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Contour.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/Contour.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,485 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Contour.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "Contour.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucContour_Type = "lucContour";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucContour* _lucContour_New(  LUCCONTOUR_DEFARGS  ) 
+{
+	lucContour*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucContour) );
+	self = (lucContour*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucContour_Init( 
+		lucContour*      self,
+		FieldVariable*   fieldVariable,
+		lucColourMap*    colourMap,
+		Name             colourName,
+		IJK              resolution,
+		double           lineWidth,
+    Bool             showValues,
+		double           interval )
+{
+	self->fieldVariable = fieldVariable;
+	self->colourMap     = colourMap;
+	lucColour_FromString( &self->colour, colourName );
+	memcpy( self->resolution, resolution, sizeof(IJK) );
+	self->lineWidth = lineWidth;
+	self->showValues = showValues;
+	self->interval = interval;
+}
+
+void _lucContour_Delete( void* drawingObject ) {
+	lucContour*  self = (lucContour*)drawingObject;
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucContour_Print( void* drawingObject, Stream* stream ) {
+	lucContour*  self = (lucContour*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucContour_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucContour*  self = (lucContour*)drawingObject;
+	lucContour* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucContour_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucContour);
+	Type                                                             type = lucContour_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucContour_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucContour_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucContour_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucContour_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucContour_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucContour_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucContour_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucContour_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucContour_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucContour_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucContour_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucContour_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucContour_New(  LUCCONTOUR_PASSARGS  );
+}
+
+void _lucContour_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucContour*      self = (lucContour*)drawingObject;
+	Index            defaultResolution;
+	FieldVariable*   fieldVariable;
+	lucColourMap*    colourMap;
+	IJK              resolution;
+	Bool             showValues;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	fieldVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", FieldVariable, True, data  );
+	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
+
+	showValues = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"showValues", True  );
+	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 8  );
+	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
+	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
+	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
+			
+	_lucContour_Init( 
+			self, 
+			fieldVariable,
+			colourMap,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
+			resolution,
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
+      showValues,
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"interval", 0.33 )  ) ;
+}
+
+void _lucContour_Build( void* drawingObject, void* data ) {}
+void _lucContour_Initialise( void* drawingObject, void* data ) {}
+void _lucContour_Execute( void* drawingObject, void* data ) {}
+void _lucContour_Destroy( void* drawingObject, void* data ) {}
+
+void _lucContour_Setup( void* drawingObject, void* _context ) {
+	lucContour*            self            = (lucContour*)drawingObject;
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+
+void _lucContour_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucContour*            self            = (lucContour*)drawingObject;
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucContour_CleanUp( void* drawingObject, void* _context ) {
+	lucContour*            self            = (lucContour*)drawingObject;
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+	
+void _lucContour_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucContour*            self            = (lucContour*)drawingObject;
+	FieldVariable*         fieldVariable   = self->fieldVariable;
+	double                 isovalue;
+	double                 interval        = self->interval;
+	double                 minIsovalue     = FieldVariable_GetMinGlobalFieldMagnitude( fieldVariable );
+	double                 maxIsovalue     = FieldVariable_GetMaxGlobalFieldMagnitude( fieldVariable );
+	lucColourMap*          colourMap       = self->colourMap;
+	Coord min, max;
+	
+	glLineWidth(self->lineWidth);
+
+	FieldVariable_GetMinAndMaxLocalCoords( fieldVariable, min, max );
+	
+	lucColour_SetOpenGLColour( &self->colour );
+
+	/* Draw isovalues at interval */
+	if ( interval <= 0.0 ) 
+		return;
+
+	for ( isovalue = minIsovalue + interval ; isovalue < maxIsovalue ; isovalue += interval ) {
+		if ( colourMap )
+			lucColourMap_SetOpenGLColourFromValue( colourMap, isovalue );
+		
+		lucContour_DrawContourWalls( self, isovalue, min, max );
+	}
+}
+
+
+#define LEFT   0
+#define RIGHT  1
+#define BOTTOM 2
+#define TOP    3
+
+void lucContour_DrawContourWalls( 
+		void*                                             drawingObject,
+		double                                            isovalue,
+		Coord                                             min,
+		Coord                                             max )
+{
+	lucContour*            self            = (lucContour*)drawingObject;
+	Dimension_Index        dim             = self->fieldVariable->dim;
+
+	if ( dim == 2 ) {
+		lucContour_DrawContour( self, isovalue, 0.0, K_AXIS, min, max ); 
+	}
+	else {
+		lucContour_DrawContour( self, isovalue, min[ I_AXIS ], I_AXIS, min, max ); 
+		lucContour_DrawContour( self, isovalue, max[ I_AXIS ], I_AXIS, min, max ); 
+		lucContour_DrawContour( self, isovalue, min[ J_AXIS ], J_AXIS, min, max ); 
+		lucContour_DrawContour( self, isovalue, max[ J_AXIS ], J_AXIS, min, max ); 
+		lucContour_DrawContour( self, isovalue, min[ K_AXIS ], K_AXIS, min, max ); 
+		lucContour_DrawContour( self, isovalue, max[ K_AXIS ], K_AXIS, min, max ); 
+	}
+}
+	
+
+void lucContour_DrawContour( 
+		void*                                             drawingObject,
+		double                                            isovalue,
+		double                                            planeHeight,
+		Axis                                              planeAxis,
+		Coord                                             min,
+		Coord                                             max )
+{
+	lucContour*            self            = (lucContour*)drawingObject;
+	FieldVariable*         fieldVariable   = self->fieldVariable;
+	Axis                   aAxis           = ( planeAxis == I_AXIS ? J_AXIS : I_AXIS );
+	Axis                   bAxis           = ( planeAxis == K_AXIS ? J_AXIS : K_AXIS );
+	unsigned int           elementType;
+	unsigned int           i, j;
+	Coord                  pos;
+	double **              array;
+	Index                  resolutionA     = self->resolution[ aAxis ];
+	Index                  resolutionB     = self->resolution[ bAxis ];
+  char                   numberStr[10];
+	double                 dA, dB;
+  int rememberCoord = 0;
+  double writePos[2];
+	
+	/* Find position of cross - section */
+	pos[planeAxis] = planeHeight;
+	
+	/* Calculate number of points in direction A and B */
+	dA = (max[ aAxis ] - min[ aAxis ])/(double) (resolutionA - 1);
+	dB = (max[ bAxis ] - min[ bAxis ])/(double) (resolutionB - 1);
+
+	array = Memory_Alloc_2DArray( double , resolutionA, resolutionB, (Name)"Field Values" );
+	for ( i = 0, pos[ aAxis ] = min[ aAxis ] ; i < resolutionA ; i++, pos[aAxis] += dA ) {
+		for ( j = 0, pos[bAxis] = min[ bAxis ] ; j < resolutionB ; j++, pos[bAxis] += dB ) {
+			if (pos[aAxis] > max[ aAxis ]) 
+				pos[aAxis] = max[ aAxis ];
+			if (pos[bAxis] > max[ bAxis ]) 
+				pos[bAxis] = max[ bAxis ];
+
+			/* Interpolate value to point */
+			FieldVariable_InterpolateValueAt( fieldVariable, pos, &array[i][j] );
+		}
+	}
+		
+	/* Initialise OpenGL stuff */
+	glDisable(GL_LIGHTING);
+	glEnable(GL_LINE_SMOOTH);
+	glEnable(GL_BLEND);
+	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+	glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+    glDisable(GL_DEPTH_TEST); /* Depth test messes up line anti-aliasing, needs checking on multiple procs */
+	glBegin(GL_LINES);
+
+	/* Start marching rectangles */
+	for ( i = 0, pos[ aAxis ] = min[ aAxis ] ; i < resolutionA - 1 ; i++, pos[ aAxis ] += dA ) {
+		for ( j = 0, pos[ bAxis ] = min[ bAxis ] ; j < resolutionB - 1 ; j++, pos[ bAxis ] += dB ) {
+			/* Assign a unique number to the square type from 0 to 15 */
+			elementType = 0;
+			if (array[i][j]     > isovalue) 	elementType += 1;
+			if (array[i+1][j]   > isovalue) 	elementType += 2;
+			if (array[i][j+1]   > isovalue) 	elementType += 4;
+			if (array[i+1][j+1] > isovalue) 	elementType += 8;
+
+			switch ( elementType ) {
+				case 0:
+					/*  @@  */
+					/*  @@  */
+					break;
+				case 1:		
+					/*  @@  */
+					/*  #@  */
+					lucContour_PlotPoint( LEFT,   isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 2:
+					/*  @@  */
+					/*  @#  */	
+					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 3:
+					/*  @@  */
+					/*  ##  */	
+					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					if( rememberCoord == 0 )  {
+            writePos[0] = pos[aAxis] + dA;
+            writePos[1] = pos[bAxis] + dB;
+            rememberCoord = 1;
+          }break;
+				case 4:
+					/*  #@  */
+					/*  @@  */
+					lucContour_PlotPoint( LEFT  , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( TOP   , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 5:
+					/*  #@  */
+					/*  #@  */
+					lucContour_PlotPoint( TOP   , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					if( rememberCoord == 0 )  {
+            writePos[0] = pos[aAxis] + dA;
+            writePos[1] = pos[bAxis] + dB;
+            rememberCoord = 1;
+          }break;
+				case 6:
+					/*  #@  */
+					/*  @#  */
+					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( TOP , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+
+					lucContour_PlotPoint( RIGHT , isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 7:
+					/*  #@  */
+					/*  ##  */
+					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 8:
+					/*  @#  */
+					/*  @@  */
+					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 9:
+					/*  @#  */
+					/*  #@  */
+					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+
+					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 10:
+					/*  @#  */
+					/*  @#  */
+					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+          if( rememberCoord == 0 )  {
+            writePos[0] = pos[aAxis] + dA;
+            writePos[1] = pos[bAxis] + dB;
+            rememberCoord = 1;
+          }
+					break;
+				case 11:
+					/*  @#  */
+					/*  ##  */
+					lucContour_PlotPoint( TOP, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 12:
+					/*  ##  */
+					/*  @@  */
+					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					if( rememberCoord == 0 )  {
+            writePos[0] = pos[aAxis] + dA;
+            writePos[1] = pos[bAxis] + dB;
+            rememberCoord = 1;
+          }break;
+				case 13:
+					/*  ##  */
+					/*  #@  */
+					lucContour_PlotPoint( RIGHT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 14:
+					/*  ##  */
+					/*  @#  */
+					lucContour_PlotPoint( LEFT, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					lucContour_PlotPoint( BOTTOM, isovalue, array[i][j], array[i+1][j], array[i][j+1], array[i+1][j+1], pos, dA, dB, planeAxis );
+					break;
+				case 15:
+					/*  ##  */
+					/*  ##  */
+					break;
+				default:
+					fprintf(stderr, "In func %s: Cannot find element %d.\n", __func__, elementType );
+					abort();
+			}
+			
+		}
+	}
+	glEnd();
+
+  /* print the isovalue "near" the last isovalue */
+  sprintf( numberStr, "%g", isovalue );
+  lucPrint( writePos[0], writePos[1], numberStr);
+  rememberCoord= 0;
+
+	glEnable(GL_LIGHTING);
+    glEnable(GL_DEPTH_TEST);
+
+	/* Clean up */
+	Memory_Free(array);
+}
+
+void lucContour_PlotPoint( char edge, double isovalue, double leftBtm, double rightBtm, double leftTop, double rightTop , Coord pos, double dA, double dB, Axis planeAxis ) {
+	Axis            aAxis           = ( planeAxis == I_AXIS ? J_AXIS : I_AXIS );
+	Axis            bAxis           = ( planeAxis == K_AXIS ? J_AXIS : K_AXIS );
+	Coord           vertex;
+	
+	vertex[planeAxis] = pos[planeAxis];
+
+	switch (edge) {
+		case BOTTOM:
+			vertex[aAxis] = pos[aAxis] + dA * (isovalue - leftBtm)/(rightBtm - leftBtm) ; 
+			vertex[bAxis] = pos[bAxis];
+			break;
+		case TOP:	
+			vertex[aAxis] = pos[aAxis] + dA * (isovalue - leftTop)/(rightTop - leftTop); 
+			vertex[bAxis] = pos[bAxis] + dB;
+			break;
+		case LEFT:	
+			vertex[aAxis] = pos[aAxis];
+			vertex[bAxis] = pos[bAxis] + dB * (isovalue - leftBtm)/(leftTop - leftBtm); 
+			break;
+		case RIGHT:	
+			vertex[aAxis] = pos[aAxis] + dA;
+			vertex[bAxis] = pos[bAxis] + dB * (isovalue - rightBtm)/(rightTop - rightBtm ); 
+			break;
+	}
+	glVertex3dv(vertex);
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Eigenvectors.c
--- a/DrawingObjects/src/Eigenvectors.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Eigenvectors.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/Base/CrossSection.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "EigenvectorsCrossSection.h"
-#include "Eigenvectors.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucEigenvectors_Type = "lucEigenvectors";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucEigenvectors* _lucEigenvectors_New(  LUCEIGENVECTORS_DEFARGS  ) 
-{
-	lucEigenvectors*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucEigenvectors) );
-	self = (lucEigenvectors*) _lucEigenvectorsCrossSection_New(  LUCEIGENVECTORSCROSSSECTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucEigenvectors_Init( lucEigenvectors*                                             self ) {
-}
-
-void _lucEigenvectors_Delete( void* drawingObject ) {
-	lucEigenvectors*  self = (lucEigenvectors*)drawingObject;
-
-	_lucEigenvectorsCrossSection_Delete( self );
-}
-
-void _lucEigenvectors_Print( void* drawingObject, Stream* stream ) {
-	lucEigenvectors*  self = (lucEigenvectors*)drawingObject;
-
-	_lucEigenvectorsCrossSection_Print( self, stream );
-}
-
-void* _lucEigenvectors_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucEigenvectors*  self = (lucEigenvectors*)drawingObject;
-	lucEigenvectors* newDrawingObject;
-
-	newDrawingObject = _lucEigenvectorsCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucEigenvectors_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucEigenvectors);
-	Type                                                             type = lucEigenvectors_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucEigenvectors_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucEigenvectors_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucEigenvectors_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucEigenvectors_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucEigenvectors_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucEigenvectors_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucEigenvectors_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucEigenvectors_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucEigenvectors_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucEigenvectors_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucEigenvectors_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucEigenvectors_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucEigenvectors_New(  LUCEIGENVECTORS_PASSARGS  );
-}
-
-void _lucEigenvectors_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucEigenvectors* self = (lucEigenvectors*)drawingObject;
-
-	/* Construct Parent */
-	_lucEigenvectorsCrossSection_AssignFromXML( self, cf, data );
-	
-	_lucEigenvectors_Init( self );
-}
-
-void _lucEigenvectors_Build( void* drawingObject, void* data ) {}
-void _lucEigenvectors_Initialise( void* drawingObject, void* data ) {}
-void _lucEigenvectors_Execute( void* drawingObject, void* data ) {}
-void _lucEigenvectors_Destroy( void* drawingObject, void* data ) {}
-
-void _lucEigenvectors_Setup( void* drawingObject, void* _context ) {
-	lucEigenvectors*       self            = (lucEigenvectors*)drawingObject;
-	
-	_lucEigenvectorsCrossSection_Setup( self, _context );
-}
-
-void _lucEigenvectors_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucEigenvectors*       self            = (lucEigenvectors*)drawingObject;
-
-	_lucEigenvectorsCrossSection_Draw( self, window, viewportInfo, _context );
-}
-
-void _lucEigenvectors_CleanUp( void* drawingObject, void* _context ) {
-	lucEigenvectors*       self            = (lucEigenvectors*)drawingObject;
-	
-	_lucEigenvectorsCrossSection_CleanUp( self, _context );
-}
-	
-void _lucEigenvectors_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucEigenvectors*       self            = (lucEigenvectors*)drawingObject;
-	DomainContext* context         = (DomainContext*) _context;
-	Dimension_Index        dim             = context->dim;
-   lucCrossSection          crossSection;
-
-	if ( dim == 2 )
-   {
-      _lucEigenvectorsCrossSection_DrawCrossSection( self, dim, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
-	}
-	else 
-   {
-		double dz = 1/(double)self->resolution[ K_AXIS ];
-      crossSection.axis = K_AXIS;
-      crossSection.interpolate = True;
-		for ( crossSection.value = 0.0 ; crossSection.value < 1.0+dz ; crossSection.value += dz) {
-		   _lucEigenvectorsCrossSection_DrawCrossSection( self, dim, &crossSection);
-		}
-	}
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Eigenvectors.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/Eigenvectors.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,185 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Eigenvectors.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "EigenvectorsCrossSection.h"
+#include "Eigenvectors.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucEigenvectors_Type = "lucEigenvectors";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucEigenvectors* _lucEigenvectors_New(  LUCEIGENVECTORS_DEFARGS  ) 
+{
+	lucEigenvectors*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucEigenvectors) );
+	self = (lucEigenvectors*) _lucEigenvectorsCrossSection_New(  LUCEIGENVECTORSCROSSSECTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucEigenvectors_Init( lucEigenvectors*                                             self ) {
+}
+
+void _lucEigenvectors_Delete( void* drawingObject ) {
+	lucEigenvectors*  self = (lucEigenvectors*)drawingObject;
+
+	_lucEigenvectorsCrossSection_Delete( self );
+}
+
+void _lucEigenvectors_Print( void* drawingObject, Stream* stream ) {
+	lucEigenvectors*  self = (lucEigenvectors*)drawingObject;
+
+	_lucEigenvectorsCrossSection_Print( self, stream );
+}
+
+void* _lucEigenvectors_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucEigenvectors*  self = (lucEigenvectors*)drawingObject;
+	lucEigenvectors* newDrawingObject;
+
+	newDrawingObject = _lucEigenvectorsCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucEigenvectors_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucEigenvectors);
+	Type                                                             type = lucEigenvectors_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucEigenvectors_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucEigenvectors_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucEigenvectors_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucEigenvectors_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucEigenvectors_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucEigenvectors_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucEigenvectors_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucEigenvectors_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucEigenvectors_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucEigenvectors_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucEigenvectors_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucEigenvectors_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucEigenvectors_New(  LUCEIGENVECTORS_PASSARGS  );
+}
+
+void _lucEigenvectors_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucEigenvectors* self = (lucEigenvectors*)drawingObject;
+
+	/* Construct Parent */
+	_lucEigenvectorsCrossSection_AssignFromXML( self, cf, data );
+	
+	_lucEigenvectors_Init( self );
+}
+
+void _lucEigenvectors_Build( void* drawingObject, void* data ) {}
+void _lucEigenvectors_Initialise( void* drawingObject, void* data ) {}
+void _lucEigenvectors_Execute( void* drawingObject, void* data ) {}
+void _lucEigenvectors_Destroy( void* drawingObject, void* data ) {}
+
+void _lucEigenvectors_Setup( void* drawingObject, void* _context ) {
+	lucEigenvectors*       self            = (lucEigenvectors*)drawingObject;
+	
+	_lucEigenvectorsCrossSection_Setup( self, _context );
+}
+
+void _lucEigenvectors_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucEigenvectors*       self            = (lucEigenvectors*)drawingObject;
+
+	_lucEigenvectorsCrossSection_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucEigenvectors_CleanUp( void* drawingObject, void* _context ) {
+	lucEigenvectors*       self            = (lucEigenvectors*)drawingObject;
+	
+	_lucEigenvectorsCrossSection_CleanUp( self, _context );
+}
+	
+void _lucEigenvectors_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucEigenvectors*       self            = (lucEigenvectors*)drawingObject;
+	DomainContext* context         = (DomainContext*) _context;
+	Dimension_Index        dim             = context->dim;
+   lucCrossSection          crossSection;
+
+	if ( dim == 2 )
+   {
+      _lucEigenvectorsCrossSection_DrawCrossSection( self, dim, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
+	}
+	else 
+   {
+		double dz = 1/(double)self->resolution[ K_AXIS ];
+      crossSection.axis = K_AXIS;
+      crossSection.interpolate = True;
+		for ( crossSection.value = 0.0 ; crossSection.value < 1.0+dz ; crossSection.value += dz) {
+		   _lucEigenvectorsCrossSection_DrawCrossSection( self, dim, &crossSection);
+		}
+	}
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/EigenvectorsCrossSection.c
--- a/DrawingObjects/src/EigenvectorsCrossSection.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,347 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: EigenvectorsCrossSection.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include <glucifer/Base/CrossSection.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "EigenvectorsCrossSection.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucEigenvectorsCrossSection_Type = "lucEigenvectorsCrossSection";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucEigenvectorsCrossSection* _lucEigenvectorsCrossSection_New(  LUCEIGENVECTORSCROSSSECTION_DEFARGS  ) 
-{
-	lucEigenvectorsCrossSection*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucEigenvectorsCrossSection) );
-	self = (lucEigenvectorsCrossSection*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucEigenvectorsCrossSection_Init( 
-		lucEigenvectorsCrossSection*                                 self,
-		FieldVariable*                                               tensorField,
-		Dimension_Index                                              dim,
-		Name                                                         leastColourName,
-		Name                                                         middleColourName,
-		Name                                                         greatestColourName,
-		IJK                                                          resolution,
-		double                                                       arrowHeadSize,
-		double                                                       lengthScale,
-		float                                                        lineWidth,
-		Bool 				                             useEigenValue,
-		double                                                       notEigenValue,
-		Bool 							     plotEigenVector,
-		Bool 							     plotEigenValue,
-		double 							     scaleEigenValue,
-		Name                                                         leastColourForNegativeName,
-		Name                                                         middleColourForNegativeName,
-		Name                                                         greatestColourForNegativeName,
-		lucCrossSection*                                             crossSection)
-{
-	Stream* errorStream         = Journal_MyStream( Error_Type, self );
-	self->tensorField = tensorField;
-	if ( dim == 2 ) {
-		lucColour_FromString( &self->colour[0], leastColourName );
-		lucColour_FromString( &self->colour[1], greatestColourName );
-		lucColour_FromString( &self->colourForNegative[0], leastColourForNegativeName );
-		lucColour_FromString( &self->colourForNegative[1], greatestColourForNegativeName );
-
-	}
-	else {
-		lucColour_FromString( &self->colour[0], leastColourName );
-		lucColour_FromString( &self->colour[1], middleColourName );
-		lucColour_FromString( &self->colour[2], greatestColourName );
-
-	        lucColour_FromString( &self->colourForNegative[0], leastColourForNegativeName );
-		lucColour_FromString( &self->colourForNegative[1], middleColourForNegativeName );
-		lucColour_FromString( &self->colourForNegative[2], greatestColourForNegativeName );
-	}
-
-	memcpy( self->resolution, resolution, sizeof(IJK) );
-	self->arrowHeadSize = arrowHeadSize;
-	Journal_Firewall( ( arrowHeadSize <= 1 && arrowHeadSize >= 0 ), errorStream,
-			"Error in %s:\narrowHeadSize given for %s was not in the range [0, 1]. " 
-			"Please use an arrowHeadSize within this range\n", __func__, self->name );
-	self->lengthScale = lengthScale;
-	self->lineWidth = lineWidth;
-	
-	
-	self->useEigenValue = useEigenValue;
-	self->notEigenValue = notEigenValue;
-
-	self->plotEigenVector = plotEigenVector;
-	self->plotEigenValue = plotEigenValue;
-	self->scaleEigenValue = scaleEigenValue;
-
-	self->crossSection = crossSection;
-}
-
-void _lucEigenvectorsCrossSection_Delete( void* drawingObject ) {
-	lucEigenvectorsCrossSection*  self = (lucEigenvectorsCrossSection*)drawingObject;
-
-   lucCrossSection_Delete(self->crossSection);
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucEigenvectorsCrossSection_Print( void* drawingObject, Stream* stream ) {
-	lucEigenvectorsCrossSection*  self = (lucEigenvectorsCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucEigenvectorsCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucEigenvectorsCrossSection*  self = (lucEigenvectorsCrossSection*)drawingObject;
-	lucEigenvectorsCrossSection* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucEigenvectorsCrossSection_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucEigenvectorsCrossSection);
-	Type                                                             type = lucEigenvectorsCrossSection_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucEigenvectorsCrossSection_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucEigenvectorsCrossSection_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucEigenvectorsCrossSection_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucEigenvectorsCrossSection_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucEigenvectorsCrossSection_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucEigenvectorsCrossSection_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucEigenvectorsCrossSection_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucEigenvectorsCrossSection_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucEigenvectorsCrossSection_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucEigenvectorsCrossSection_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucEigenvectorsCrossSection_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucEigenvectorsCrossSection_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucEigenvectorsCrossSection_New(  LUCEIGENVECTORSCROSSSECTION_PASSARGS  );
-}
-
-void _lucEigenvectorsCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
-	FieldVariable*   tensorField;
-	Index            defaultResolution;
-	IJK              resolution;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	tensorField =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"TensorField", FieldVariable, True, data  );
-
-	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 8  );
-	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
-	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
-	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
-			
-	_lucEigenvectorsCrossSection_Init( 
-			self, 
-			tensorField,
-			Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 2  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColour", "black"  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColour", "black"  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColour", "black"  ),
-			resolution,
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.3  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthScale", 0.3  ),
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useEigenValue", True  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"notEigenValue", 0.3  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"plotEigenVector", True  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"plotEigenValue", False  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleEigenValue", 1.0  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColourForNegative", "black"  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColourForNegative", "black"  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColourForNegative", "black"  ),
-			lucCrossSection_Read(cf, self->name));
-}
-
-void _lucEigenvectorsCrossSection_Build( void* drawingObject, void* data ) {}
-void _lucEigenvectorsCrossSection_Initialise( void* drawingObject, void* data ) {}
-void _lucEigenvectorsCrossSection_Execute( void* drawingObject, void* data ) {}
-void _lucEigenvectorsCrossSection_Destroy( void* drawingObject, void* data ) {}
-
-void _lucEigenvectorsCrossSection_Setup( void* drawingObject, void* _context ) {
-	lucEigenvectorsCrossSection*       self            = (lucEigenvectorsCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-	
-void _lucEigenvectorsCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucEigenvectorsCrossSection*       self            = (lucEigenvectorsCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucEigenvectorsCrossSection_CleanUp( void* drawingObject, void* _context ) {
-	lucEigenvectorsCrossSection*       self            = (lucEigenvectorsCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}
-
-void _lucEigenvectorsCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucEigenvectorsCrossSection*       self            = (lucEigenvectorsCrossSection*)drawingObject;
-	DomainContext*            context         = (DomainContext*) _context;
-
-	_lucEigenvectorsCrossSection_DrawCrossSection( self, context->dim, self->crossSection );
-}
-
-void _lucEigenvectorsCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim, lucCrossSection* crossSection ) {
-	lucEigenvectorsCrossSection*  self           = (lucEigenvectorsCrossSection*)drawingObject;
-	FieldVariable*    tensorField    = self->tensorField;
-   Axis              axis = crossSection->axis;
-	Axis              aAxis          = (axis == I_AXIS ? J_AXIS : I_AXIS);
-	Axis              bAxis          = (axis == K_AXIS ? J_AXIS : K_AXIS);
-	Coord             pos;
-	SymmetricTensor   tensor;
-	Coord             globalMin;
-	Coord             globalMax;
-	Coord             localMin;
-	Coord             localMax;
-	double            dA, dB;
-	Eigenvector       eigenvectorList[3];
-	Dimension_Index   dim_I;
-	
-	FieldVariable_GetMinAndMaxGlobalCoords( tensorField, globalMin, globalMax );
-	FieldVariable_GetMinAndMaxLocalCoords( tensorField, localMin, localMax );
-
-	glLineWidth(self->lineWidth);
-	
-	dA = (globalMax[ aAxis ] - globalMin[ aAxis ])/(double)self->resolution[ aAxis ];
-	dB = (globalMax[ bAxis ] - globalMin[ bAxis ])/(double)self->resolution[ bAxis ];
-	
-	pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
-	Journal_DPrintf( self->debugStream, "-- Drawing cross section on axis %d at value %lf\n", axis, pos[axis]);
-
-	for ( pos[ aAxis ] = globalMin[ aAxis ] + dA * 0.5 ; pos[ aAxis ] < globalMax[ aAxis ] ; pos[ aAxis ] += dA ) {
-		for ( pos[ bAxis ] = globalMin[ bAxis ] + dB * 0.5 ; pos[ bAxis ] < globalMax[ bAxis ] ; pos[ bAxis ] += dB ) {
-
-			if ( pos[ aAxis ] < localMin[ aAxis ] || pos[ aAxis ] >= localMax[ aAxis ] )
-				continue;
-			if ( pos[ bAxis ] < localMin[ bAxis ] || pos[ bAxis ] >= localMax[ bAxis ] )
-				continue;
-
-			/* Get Value of Tensor at this point in space */
-			if ( FieldVariable_InterpolateValueAt( tensorField, pos, tensor ) == LOCAL ) {
-				SymmetricTensor_CalcAllEigenvectors( tensor, dim, eigenvectorList );
-
-                                if(self->plotEigenVector){
-					for ( dim_I = 0 ; dim_I < dim ; dim_I++ ) {
-						
-						lucColour_SetOpenGLColour( &self->colour[ dim_I ] );
-						if(self->useEigenValue){
-						     luc_DrawVector( dim, pos, eigenvectorList[ dim_I ].vector, 
-								(eigenvectorList[ dim_I ].eigenvalue * self->scaleEigenValue), self->arrowHeadSize );
-						}
-						else{
-							luc_DrawVector( dim, pos, eigenvectorList[ dim_I ].vector,
-									 self->notEigenValue, self->arrowHeadSize );
-						}
-					}
-				}
-				if(self->plotEigenValue){
-					GLfloat pointSize = 0;
-
-					for ( dim_I = 0 ; dim_I < dim ; dim_I++ ) {
-					        /* The EigenValue can be negative.... Got to attribute a potential */
-						/* colour for negative values, one for each dim as well */
-						if ( eigenvectorList[ dim_I ].eigenvalue >= 0) {
-						        pointSize = eigenvectorList[ dim_I ].eigenvalue * self->scaleEigenValue;
-							lucColour_SetOpenGLColour( &self->colour[ dim_I ] );
-	                                        }
-						else {
-						        lucColour_SetOpenGLColour( &self->colourForNegative[ dim_I ] );
-							pointSize = - eigenvectorList[ dim_I ].eigenvalue * self->scaleEigenValue;
-	                                        }
-						glPointSize( pointSize );
-					
-						glBegin(GL_POINTS);
-							if (dim == 2)
-					      			glVertex3f( (GLfloat)pos[0], (GLfloat)pos[1], 0.001 );
-							else 
-						    		glVertex3dv( pos );
-						glEnd();
-					
-					}
-				}
-
-			}
-		}
-	}
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/EigenvectorsCrossSection.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/EigenvectorsCrossSection.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,347 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: EigenvectorsCrossSection.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include <glucifer/Base/CrossSection.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "EigenvectorsCrossSection.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucEigenvectorsCrossSection_Type = "lucEigenvectorsCrossSection";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucEigenvectorsCrossSection* _lucEigenvectorsCrossSection_New(  LUCEIGENVECTORSCROSSSECTION_DEFARGS  ) 
+{
+	lucEigenvectorsCrossSection*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucEigenvectorsCrossSection) );
+	self = (lucEigenvectorsCrossSection*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucEigenvectorsCrossSection_Init( 
+		lucEigenvectorsCrossSection*                                 self,
+		FieldVariable*                                               tensorField,
+		Dimension_Index                                              dim,
+		Name                                                         leastColourName,
+		Name                                                         middleColourName,
+		Name                                                         greatestColourName,
+		IJK                                                          resolution,
+		double                                                       arrowHeadSize,
+		double                                                       lengthScale,
+		float                                                        lineWidth,
+		Bool 				                             useEigenValue,
+		double                                                       notEigenValue,
+		Bool 							     plotEigenVector,
+		Bool 							     plotEigenValue,
+		double 							     scaleEigenValue,
+		Name                                                         leastColourForNegativeName,
+		Name                                                         middleColourForNegativeName,
+		Name                                                         greatestColourForNegativeName,
+		lucCrossSection*                                             crossSection)
+{
+	Stream* errorStream         = Journal_MyStream( Error_Type, self );
+	self->tensorField = tensorField;
+	if ( dim == 2 ) {
+		lucColour_FromString( &self->colour[0], leastColourName );
+		lucColour_FromString( &self->colour[1], greatestColourName );
+		lucColour_FromString( &self->colourForNegative[0], leastColourForNegativeName );
+		lucColour_FromString( &self->colourForNegative[1], greatestColourForNegativeName );
+
+	}
+	else {
+		lucColour_FromString( &self->colour[0], leastColourName );
+		lucColour_FromString( &self->colour[1], middleColourName );
+		lucColour_FromString( &self->colour[2], greatestColourName );
+
+	        lucColour_FromString( &self->colourForNegative[0], leastColourForNegativeName );
+		lucColour_FromString( &self->colourForNegative[1], middleColourForNegativeName );
+		lucColour_FromString( &self->colourForNegative[2], greatestColourForNegativeName );
+	}
+
+	memcpy( self->resolution, resolution, sizeof(IJK) );
+	self->arrowHeadSize = arrowHeadSize;
+	Journal_Firewall( ( arrowHeadSize <= 1 && arrowHeadSize >= 0 ), errorStream,
+			"Error in %s:\narrowHeadSize given for %s was not in the range [0, 1]. " 
+			"Please use an arrowHeadSize within this range\n", __func__, self->name );
+	self->lengthScale = lengthScale;
+	self->lineWidth = lineWidth;
+	
+	
+	self->useEigenValue = useEigenValue;
+	self->notEigenValue = notEigenValue;
+
+	self->plotEigenVector = plotEigenVector;
+	self->plotEigenValue = plotEigenValue;
+	self->scaleEigenValue = scaleEigenValue;
+
+	self->crossSection = crossSection;
+}
+
+void _lucEigenvectorsCrossSection_Delete( void* drawingObject ) {
+	lucEigenvectorsCrossSection*  self = (lucEigenvectorsCrossSection*)drawingObject;
+
+   lucCrossSection_Delete(self->crossSection);
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucEigenvectorsCrossSection_Print( void* drawingObject, Stream* stream ) {
+	lucEigenvectorsCrossSection*  self = (lucEigenvectorsCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucEigenvectorsCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucEigenvectorsCrossSection*  self = (lucEigenvectorsCrossSection*)drawingObject;
+	lucEigenvectorsCrossSection* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucEigenvectorsCrossSection_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucEigenvectorsCrossSection);
+	Type                                                             type = lucEigenvectorsCrossSection_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucEigenvectorsCrossSection_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucEigenvectorsCrossSection_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucEigenvectorsCrossSection_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucEigenvectorsCrossSection_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucEigenvectorsCrossSection_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucEigenvectorsCrossSection_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucEigenvectorsCrossSection_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucEigenvectorsCrossSection_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucEigenvectorsCrossSection_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucEigenvectorsCrossSection_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucEigenvectorsCrossSection_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucEigenvectorsCrossSection_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucEigenvectorsCrossSection_New(  LUCEIGENVECTORSCROSSSECTION_PASSARGS  );
+}
+
+void _lucEigenvectorsCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucEigenvectorsCrossSection* self = (lucEigenvectorsCrossSection*)drawingObject;
+	FieldVariable*   tensorField;
+	Index            defaultResolution;
+	IJK              resolution;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	tensorField =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"TensorField", FieldVariable, True, data  );
+
+	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 8  );
+	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
+	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
+	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
+			
+	_lucEigenvectorsCrossSection_Init( 
+			self, 
+			tensorField,
+			Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 2  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColour", "black"  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColour", "black"  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColour", "black"  ),
+			resolution,
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.3  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthScale", 0.3  ),
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useEigenValue", True  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"notEigenValue", 0.3  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"plotEigenVector", True  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"plotEigenValue", False  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleEigenValue", 1.0  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"leastColourForNegative", "black"  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"middleColourForNegative", "black"  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"greatestColourForNegative", "black"  ),
+			lucCrossSection_Read(cf, self->name));
+}
+
+void _lucEigenvectorsCrossSection_Build( void* drawingObject, void* data ) {}
+void _lucEigenvectorsCrossSection_Initialise( void* drawingObject, void* data ) {}
+void _lucEigenvectorsCrossSection_Execute( void* drawingObject, void* data ) {}
+void _lucEigenvectorsCrossSection_Destroy( void* drawingObject, void* data ) {}
+
+void _lucEigenvectorsCrossSection_Setup( void* drawingObject, void* _context ) {
+	lucEigenvectorsCrossSection*       self            = (lucEigenvectorsCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+	
+void _lucEigenvectorsCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucEigenvectorsCrossSection*       self            = (lucEigenvectorsCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucEigenvectorsCrossSection_CleanUp( void* drawingObject, void* _context ) {
+	lucEigenvectorsCrossSection*       self            = (lucEigenvectorsCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+
+void _lucEigenvectorsCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucEigenvectorsCrossSection*       self            = (lucEigenvectorsCrossSection*)drawingObject;
+	DomainContext*            context         = (DomainContext*) _context;
+
+	_lucEigenvectorsCrossSection_DrawCrossSection( self, context->dim, self->crossSection );
+}
+
+void _lucEigenvectorsCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim, lucCrossSection* crossSection ) {
+	lucEigenvectorsCrossSection*  self           = (lucEigenvectorsCrossSection*)drawingObject;
+	FieldVariable*    tensorField    = self->tensorField;
+   Axis              axis = crossSection->axis;
+	Axis              aAxis          = (axis == I_AXIS ? J_AXIS : I_AXIS);
+	Axis              bAxis          = (axis == K_AXIS ? J_AXIS : K_AXIS);
+	Coord             pos;
+	SymmetricTensor   tensor;
+	Coord             globalMin;
+	Coord             globalMax;
+	Coord             localMin;
+	Coord             localMax;
+	double            dA, dB;
+	Eigenvector       eigenvectorList[3];
+	Dimension_Index   dim_I;
+	
+	FieldVariable_GetMinAndMaxGlobalCoords( tensorField, globalMin, globalMax );
+	FieldVariable_GetMinAndMaxLocalCoords( tensorField, localMin, localMax );
+
+	glLineWidth(self->lineWidth);
+	
+	dA = (globalMax[ aAxis ] - globalMin[ aAxis ])/(double)self->resolution[ aAxis ];
+	dB = (globalMax[ bAxis ] - globalMin[ bAxis ])/(double)self->resolution[ bAxis ];
+	
+	pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
+	Journal_DPrintf( self->debugStream, "-- Drawing cross section on axis %d at value %lf\n", axis, pos[axis]);
+
+	for ( pos[ aAxis ] = globalMin[ aAxis ] + dA * 0.5 ; pos[ aAxis ] < globalMax[ aAxis ] ; pos[ aAxis ] += dA ) {
+		for ( pos[ bAxis ] = globalMin[ bAxis ] + dB * 0.5 ; pos[ bAxis ] < globalMax[ bAxis ] ; pos[ bAxis ] += dB ) {
+
+			if ( pos[ aAxis ] < localMin[ aAxis ] || pos[ aAxis ] >= localMax[ aAxis ] )
+				continue;
+			if ( pos[ bAxis ] < localMin[ bAxis ] || pos[ bAxis ] >= localMax[ bAxis ] )
+				continue;
+
+			/* Get Value of Tensor at this point in space */
+			if ( FieldVariable_InterpolateValueAt( tensorField, pos, tensor ) == LOCAL ) {
+				SymmetricTensor_CalcAllEigenvectors( tensor, dim, eigenvectorList );
+
+                                if(self->plotEigenVector){
+					for ( dim_I = 0 ; dim_I < dim ; dim_I++ ) {
+						
+						lucColour_SetOpenGLColour( &self->colour[ dim_I ] );
+						if(self->useEigenValue){
+						     luc_DrawVector( dim, pos, eigenvectorList[ dim_I ].vector, 
+								(eigenvectorList[ dim_I ].eigenvalue * self->scaleEigenValue), self->arrowHeadSize );
+						}
+						else{
+							luc_DrawVector( dim, pos, eigenvectorList[ dim_I ].vector,
+									 self->notEigenValue, self->arrowHeadSize );
+						}
+					}
+				}
+				if(self->plotEigenValue){
+					GLfloat pointSize = 0;
+
+					for ( dim_I = 0 ; dim_I < dim ; dim_I++ ) {
+					        /* The EigenValue can be negative.... Got to attribute a potential */
+						/* colour for negative values, one for each dim as well */
+						if ( eigenvectorList[ dim_I ].eigenvalue >= 0) {
+						        pointSize = eigenvectorList[ dim_I ].eigenvalue * self->scaleEigenValue;
+							lucColour_SetOpenGLColour( &self->colour[ dim_I ] );
+	                                        }
+						else {
+						        lucColour_SetOpenGLColour( &self->colourForNegative[ dim_I ] );
+							pointSize = - eigenvectorList[ dim_I ].eigenvalue * self->scaleEigenValue;
+	                                        }
+						glPointSize( pointSize );
+					
+						glBegin(GL_POINTS);
+							if (dim == 2)
+					      			glVertex3f( (GLfloat)pos[0], (GLfloat)pos[1], 0.001 );
+							else 
+						    		glVertex3dv( pos );
+						glEnd();
+					
+					}
+				}
+
+			}
+		}
+	}
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/FeVariableSurface.c
--- a/DrawingObjects/src/FeVariableSurface.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: FeVariableSurface.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "FeVariableSurface.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucFeVariableSurface_Type = "lucFeVariableSurface";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucFeVariableSurface* _lucFeVariableSurface_New(  LUCFEVARIABLESURFACE_DEFARGS  ) 
-{
-	lucFeVariableSurface*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucFeVariableSurface) );
-	self = (lucFeVariableSurface*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucFeVariableSurface_Init( 
-		lucFeVariableSurface*                                        self,
-		FieldVariable*                                               feVariable,
-		lucColourMap*                                                colourMap,
-		Name                                                         colourName,
-		Bool                                                         wireframe,
-		float                                                        lineWidth,
-		float                                                        scaleHeight )
-{
-	self->feVariable  = feVariable;
-	self->colourMap   = colourMap;
-	lucColour_FromString( &self->colour, colourName );
-	self->wireframe   = wireframe;
-	self->lineWidth   = lineWidth;
-	self->scaleHeight = scaleHeight;
-
-	assert( Stg_Class_IsInstance( feVariable, FeVariable_Type ) );
-}
-
-void _lucFeVariableSurface_Delete( void* drawingObject ) {
-	lucFeVariableSurface*  self = (lucFeVariableSurface*)drawingObject;
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucFeVariableSurface_Print( void* drawingObject, Stream* stream ) {
-	lucFeVariableSurface*  self = (lucFeVariableSurface*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucFeVariableSurface_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucFeVariableSurface*  self = (lucFeVariableSurface*)drawingObject;
-	lucFeVariableSurface* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucFeVariableSurface_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucFeVariableSurface);
-	Type                                                             type = lucFeVariableSurface_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucFeVariableSurface_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucFeVariableSurface_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucFeVariableSurface_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucFeVariableSurface_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucFeVariableSurface_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucFeVariableSurface_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucFeVariableSurface_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucFeVariableSurface_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucFeVariableSurface_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucFeVariableSurface_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucFeVariableSurface_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucFeVariableSurface_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucFeVariableSurface_New(  LUCFEVARIABLESURFACE_PASSARGS  );
-}
-
-void _lucFeVariableSurface_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucFeVariableSurface*  self = (lucFeVariableSurface*)drawingObject;
-	FieldVariable*         feVariable;
-	lucColourMap*          colourMap;
-
-	/* Construct Parent */
-	_lucDrawingObject_AssignFromXML( self, cf, data );
-
-	feVariable    =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"FeVariable", FieldVariable, True, data  );
-	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
-	
-	_lucFeVariableSurface_Init( 
-			self, 
-			feVariable,
-			colourMap,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"wireframe", False  ),
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleHeight", 0.0 )  );
-}
-
-void _lucFeVariableSurface_Build( void* drawingObject, void* data ) {}
-void _lucFeVariableSurface_Initialise( void* drawingObject, void* data ) {}
-void _lucFeVariableSurface_Execute( void* drawingObject, void* data ) {}
-void _lucFeVariableSurface_Destroy( void* drawingObject, void* data ) {}
-
-void _lucFeVariableSurface_Setup( void* drawingObject, void* _context ) {
-	lucFeVariableSurface*       self            = (lucFeVariableSurface*)drawingObject;
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-	
-void _lucFeVariableSurface_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucFeVariableSurface*       self            = (lucFeVariableSurface*)drawingObject;
-	FeVariable*                    feVariable         = (FeVariable*) self->feVariable;
-	lucColourMap*                  colourMap          = self->colourMap;
-	if ( colourMap )
-		lucColourMap_CalibrateFromFieldVariable( colourMap, feVariable );
-	else
-		lucColour_SetOpenGLColour( &self->colour );
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucFeVariableSurface_CleanUp( void* drawingObject, void* _context ) {
-	lucFeVariableSurface*       self            = (lucFeVariableSurface*)drawingObject;
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}
-	
-void _lucFeVariableSurface_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucFeVariableSurface*          self               = (lucFeVariableSurface*)drawingObject;
-	FeVariable*                    feVariable         = (FeVariable*) self->feVariable;
-	FeMesh*    		       mesh               = feVariable->feMesh;
-	lucColourMap*                  colourMap          = self->colourMap;
-	Element_LocalIndex             lElement_I;
-	Element_LocalIndex             elementLocalCount  = FeMesh_GetElementLocalSize( mesh );
-	Element_NodeIndex              eNode_I;
-	Element_NodeIndex              elementNodeCount, *elementNodes;
-	Element_NodeIndex              nodeMapper[]       = { 0, 1, 3, 2 };
-	Node_LocalIndex                lNode_I;
-	double                         nodeValue;
-	double                         height;
-	IArray*                        inc;
-
-	FeVariable_SyncShadowValues( feVariable );
-
-	/* Give option to draw surface as wireframe */
-	if (self->wireframe) 
-		glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
-	else 
-		glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-
-	glNormal3f( 0.0, 0.0, 1.0 ); /* TODO - FIX */
-	glLineWidth( self->lineWidth );
-	glDisable( GL_LIGHTING );
-
-	if ( colourMap )
-		lucColourMap_CalibrateFromFieldVariable( colourMap, feVariable );
-	else
-		lucColour_SetOpenGLColour( &self->colour );
-
-	inc = IArray_New();
-	for ( lElement_I = 0 ; lElement_I < elementLocalCount ; lElement_I++ ) {
-		FeMesh_GetElementNodes( mesh, lElement_I, inc );
-		elementNodeCount = IArray_GetSize( inc );
-		elementNodes = IArray_GetPtr( inc );
-
-		glBegin( GL_POLYGON );
-		for ( eNode_I = 0 ; eNode_I < elementNodeCount ; eNode_I++ ) {
-			/* Get the index of the node - we use the 'nodeMapper' array so that 
-			 * we are going around the nodes in an anti-clockwise direction */
-			lNode_I = elementNodes[ nodeMapper[ eNode_I ] ];
-
-			/* Get Value at node */
-			nodeValue = FeVariable_GetScalarAtNode( feVariable, lNode_I );
-
-			/* Change Colour */
-			if ( colourMap )
-				lucColourMap_SetOpenGLColourFromValue( colourMap, nodeValue );
-
-			/* Set Height */
-			height = nodeValue * self->scaleHeight;
-
-			/* Plot Vertex */
-			glVertex3d( mesh->verts[ lNode_I ][ I_AXIS ], mesh->verts[ lNode_I ][ J_AXIS ], height );
-		}
-		glEnd();
-	}
-	glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
-	glEnable( GL_LIGHTING );	
-
-	NewClass_Delete( inc );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/FeVariableSurface.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/FeVariableSurface.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,260 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: FeVariableSurface.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "FeVariableSurface.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucFeVariableSurface_Type = "lucFeVariableSurface";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucFeVariableSurface* _lucFeVariableSurface_New(  LUCFEVARIABLESURFACE_DEFARGS  ) 
+{
+	lucFeVariableSurface*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucFeVariableSurface) );
+	self = (lucFeVariableSurface*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucFeVariableSurface_Init( 
+		lucFeVariableSurface*                                        self,
+		FieldVariable*                                               feVariable,
+		lucColourMap*                                                colourMap,
+		Name                                                         colourName,
+		Bool                                                         wireframe,
+		float                                                        lineWidth,
+		float                                                        scaleHeight )
+{
+	self->feVariable  = feVariable;
+	self->colourMap   = colourMap;
+	lucColour_FromString( &self->colour, colourName );
+	self->wireframe   = wireframe;
+	self->lineWidth   = lineWidth;
+	self->scaleHeight = scaleHeight;
+
+	assert( Stg_Class_IsInstance( feVariable, FeVariable_Type ) );
+}
+
+void _lucFeVariableSurface_Delete( void* drawingObject ) {
+	lucFeVariableSurface*  self = (lucFeVariableSurface*)drawingObject;
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucFeVariableSurface_Print( void* drawingObject, Stream* stream ) {
+	lucFeVariableSurface*  self = (lucFeVariableSurface*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucFeVariableSurface_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucFeVariableSurface*  self = (lucFeVariableSurface*)drawingObject;
+	lucFeVariableSurface* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucFeVariableSurface_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucFeVariableSurface);
+	Type                                                             type = lucFeVariableSurface_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucFeVariableSurface_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucFeVariableSurface_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucFeVariableSurface_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucFeVariableSurface_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucFeVariableSurface_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucFeVariableSurface_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucFeVariableSurface_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucFeVariableSurface_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucFeVariableSurface_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucFeVariableSurface_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucFeVariableSurface_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucFeVariableSurface_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucFeVariableSurface_New(  LUCFEVARIABLESURFACE_PASSARGS  );
+}
+
+void _lucFeVariableSurface_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucFeVariableSurface*  self = (lucFeVariableSurface*)drawingObject;
+	FieldVariable*         feVariable;
+	lucColourMap*          colourMap;
+
+	/* Construct Parent */
+	_lucDrawingObject_AssignFromXML( self, cf, data );
+
+	feVariable    =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"FeVariable", FieldVariable, True, data  );
+	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
+	
+	_lucFeVariableSurface_Init( 
+			self, 
+			feVariable,
+			colourMap,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"wireframe", False  ),
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"scaleHeight", 0.0 )  );
+}
+
+void _lucFeVariableSurface_Build( void* drawingObject, void* data ) {}
+void _lucFeVariableSurface_Initialise( void* drawingObject, void* data ) {}
+void _lucFeVariableSurface_Execute( void* drawingObject, void* data ) {}
+void _lucFeVariableSurface_Destroy( void* drawingObject, void* data ) {}
+
+void _lucFeVariableSurface_Setup( void* drawingObject, void* _context ) {
+	lucFeVariableSurface*       self            = (lucFeVariableSurface*)drawingObject;
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+	
+void _lucFeVariableSurface_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucFeVariableSurface*       self            = (lucFeVariableSurface*)drawingObject;
+	FeVariable*                    feVariable         = (FeVariable*) self->feVariable;
+	lucColourMap*                  colourMap          = self->colourMap;
+	if ( colourMap )
+		lucColourMap_CalibrateFromFieldVariable( colourMap, feVariable );
+	else
+		lucColour_SetOpenGLColour( &self->colour );
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucFeVariableSurface_CleanUp( void* drawingObject, void* _context ) {
+	lucFeVariableSurface*       self            = (lucFeVariableSurface*)drawingObject;
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+	
+void _lucFeVariableSurface_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucFeVariableSurface*          self               = (lucFeVariableSurface*)drawingObject;
+	FeVariable*                    feVariable         = (FeVariable*) self->feVariable;
+	FeMesh*    		       mesh               = feVariable->feMesh;
+	lucColourMap*                  colourMap          = self->colourMap;
+	Element_LocalIndex             lElement_I;
+	Element_LocalIndex             elementLocalCount  = FeMesh_GetElementLocalSize( mesh );
+	Element_NodeIndex              eNode_I;
+	Element_NodeIndex              elementNodeCount, *elementNodes;
+	Element_NodeIndex              nodeMapper[]       = { 0, 1, 3, 2 };
+	Node_LocalIndex                lNode_I;
+	double                         nodeValue;
+	double                         height;
+	IArray*                        inc;
+
+	FeVariable_SyncShadowValues( feVariable );
+
+	/* Give option to draw surface as wireframe */
+	if (self->wireframe) 
+		glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
+	else 
+		glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+
+	glNormal3f( 0.0, 0.0, 1.0 ); /* TODO - FIX */
+	glLineWidth( self->lineWidth );
+	glDisable( GL_LIGHTING );
+
+	if ( colourMap )
+		lucColourMap_CalibrateFromFieldVariable( colourMap, feVariable );
+	else
+		lucColour_SetOpenGLColour( &self->colour );
+
+	inc = IArray_New();
+	for ( lElement_I = 0 ; lElement_I < elementLocalCount ; lElement_I++ ) {
+		FeMesh_GetElementNodes( mesh, lElement_I, inc );
+		elementNodeCount = IArray_GetSize( inc );
+		elementNodes = IArray_GetPtr( inc );
+
+		glBegin( GL_POLYGON );
+		for ( eNode_I = 0 ; eNode_I < elementNodeCount ; eNode_I++ ) {
+			/* Get the index of the node - we use the 'nodeMapper' array so that 
+			 * we are going around the nodes in an anti-clockwise direction */
+			lNode_I = elementNodes[ nodeMapper[ eNode_I ] ];
+
+			/* Get Value at node */
+			nodeValue = FeVariable_GetScalarAtNode( feVariable, lNode_I );
+
+			/* Change Colour */
+			if ( colourMap )
+				lucColourMap_SetOpenGLColourFromValue( colourMap, nodeValue );
+
+			/* Set Height */
+			height = nodeValue * self->scaleHeight;
+
+			/* Plot Vertex */
+			glVertex3d( mesh->verts[ lNode_I ][ I_AXIS ], mesh->verts[ lNode_I ][ J_AXIS ], height );
+		}
+		glEnd();
+	}
+	glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
+	glEnable( GL_LIGHTING );	
+
+	NewClass_Delete( inc );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/FieldVariableBorder.c
--- a/DrawingObjects/src/FieldVariableBorder.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: FieldVariableBorder.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "FieldVariableBorder.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucFieldVariableBorder_Type = "lucFieldVariableBorder";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucFieldVariableBorder* _lucFieldVariableBorder_New(  LUCFIELDVARIABLEBORDER_DEFARGS  ) 
-{
-	lucFieldVariableBorder*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucFieldVariableBorder) );
-	self = (lucFieldVariableBorder*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucFieldVariableBorder_Init( 
-		lucFieldVariableBorder*                                      self,
-		FieldVariable*                                               fieldVariable,
-		Name                                                         colourName,
-		float                                                        lineWidth ) 
-{
-	self->fieldVariable = fieldVariable;
-	
-	lucColour_FromString( &self->colour, colourName );
-	self->lineWidth = lineWidth;
-}
-
-void _lucFieldVariableBorder_Delete( void* drawingObject ) {
-	lucFieldVariableBorder*  self = (lucFieldVariableBorder*)drawingObject;
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucFieldVariableBorder_Print( void* drawingObject, Stream* stream ) {
-	lucFieldVariableBorder*  self = (lucFieldVariableBorder*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucFieldVariableBorder_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucFieldVariableBorder*  self = (lucFieldVariableBorder*)drawingObject;
-	lucFieldVariableBorder* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucFieldVariableBorder_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucFieldVariableBorder);
-	Type                                                             type = lucFieldVariableBorder_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucFieldVariableBorder_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucFieldVariableBorder_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucFieldVariableBorder_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucFieldVariableBorder_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucFieldVariableBorder_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucFieldVariableBorder_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucFieldVariableBorder_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucFieldVariableBorder_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucFieldVariableBorder_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucFieldVariableBorder_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucFieldVariableBorder_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucFieldVariableBorder_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucFieldVariableBorder_New(  LUCFIELDVARIABLEBORDER_PASSARGS  );
-}
-
-void _lucFieldVariableBorder_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucFieldVariableBorder*  self = (lucFieldVariableBorder*)drawingObject;
-	FieldVariable*           fieldVariable;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	fieldVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", FieldVariable, True, data  );
-	
-	_lucFieldVariableBorder_Init( 
-			self, 
-			fieldVariable, 
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "Black"  ),
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 0.5 )  );
-
-}
-
-void _lucFieldVariableBorder_Build( void* drawingObject, void* data ) {}
-void _lucFieldVariableBorder_Initialise( void* drawingObject, void* data ) {}
-void _lucFieldVariableBorder_Execute( void* drawingObject, void* data ) {}
-void _lucFieldVariableBorder_Destroy( void* drawingObject, void* data ) {}
-
-void _lucFieldVariableBorder_Setup( void* drawingObject, void* _context ) {
-	lucFieldVariableBorder*       self            = (lucFieldVariableBorder*)drawingObject;
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-	
-void _lucFieldVariableBorder_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucFieldVariableBorder*       self            = (lucFieldVariableBorder*)drawingObject;
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucFieldVariableBorder_CleanUp( void* drawingObject, void* _context ) {
-	lucFieldVariableBorder*       self            = (lucFieldVariableBorder*)drawingObject;
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}	
-
-void _lucFieldVariableBorder_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucFieldVariableBorder*  self    = (lucFieldVariableBorder*)drawingObject;
-	DomainContext*   context = (DomainContext*) _context;
-	Dimension_Index          dim     = context->dim;
-	FieldVariable*           field   = self->fieldVariable;
-	Coord                    min;
-	Coord                    max;
-
-	/* THis needs to be first so all processors call it - collective comms */
-	/* Grab values from field variable */
-	FieldVariable_GetMinAndMaxGlobalCoords( field, min, max );
-
-	/* Initialise OpenGL stuff */
-	glDisable(GL_LIGHTING);
-
-	/* Line smoothing will not work correctly with depth testing enabled*/
-	glDisable(GL_DEPTH_TEST);
-	glEnable(GL_LINE_SMOOTH);
-	glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
-	glEnable(GL_BLEND);
-	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-	glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE ) ;
-
-	lucColour_SetOpenGLColour( &self->colour );
-	glLineWidth( self->lineWidth );
-
-	if (dim == 2) 
-		glRectd( min[ I_AXIS ], min[ J_AXIS ], max[ I_AXIS ], max[ J_AXIS ]);
-	else if ( dim == 3 ) {
-		glBegin( GL_QUAD_STRIP );
-			glVertex3d( min[ I_AXIS ], min[ J_AXIS ], min[ K_AXIS ]);
-			glVertex3d( min[ I_AXIS ], max[ J_AXIS ], min[ K_AXIS ]);
-
-			glVertex3d( max[ I_AXIS ], min[ J_AXIS ], min[ K_AXIS ]);
-			glVertex3d( max[ I_AXIS ], max[ J_AXIS ], min[ K_AXIS ]);
-
-			glVertex3d( max[ I_AXIS ], min[ J_AXIS ], max[ K_AXIS ]);
-			glVertex3d( max[ I_AXIS ], max[ J_AXIS ], max[ K_AXIS ]);
-
-			glVertex3d( min[ I_AXIS ], min[ J_AXIS ], max[ K_AXIS ]);
-			glVertex3d( min[ I_AXIS ], max[ J_AXIS ], max[ K_AXIS ]);
-			
-			glVertex3d( min[ I_AXIS ], min[ J_AXIS ], min[ K_AXIS ]);
-			glVertex3d( min[ I_AXIS ], max[ J_AXIS ], min[ K_AXIS ]);
-		glEnd();
-	}
-	
-	/* Clean up OpenGL stuff */
- 	glEnable(GL_DEPTH_TEST);
-	glPolygonMode ( GL_FRONT_AND_BACK, GL_FILL ) ;
-	glEnable( GL_LIGHTING );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/FieldVariableBorder.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/FieldVariableBorder.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,234 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: FieldVariableBorder.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "FieldVariableBorder.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucFieldVariableBorder_Type = "lucFieldVariableBorder";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucFieldVariableBorder* _lucFieldVariableBorder_New(  LUCFIELDVARIABLEBORDER_DEFARGS  ) 
+{
+	lucFieldVariableBorder*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucFieldVariableBorder) );
+	self = (lucFieldVariableBorder*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucFieldVariableBorder_Init( 
+		lucFieldVariableBorder*                                      self,
+		FieldVariable*                                               fieldVariable,
+		Name                                                         colourName,
+		float                                                        lineWidth ) 
+{
+	self->fieldVariable = fieldVariable;
+	
+	lucColour_FromString( &self->colour, colourName );
+	self->lineWidth = lineWidth;
+}
+
+void _lucFieldVariableBorder_Delete( void* drawingObject ) {
+	lucFieldVariableBorder*  self = (lucFieldVariableBorder*)drawingObject;
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucFieldVariableBorder_Print( void* drawingObject, Stream* stream ) {
+	lucFieldVariableBorder*  self = (lucFieldVariableBorder*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucFieldVariableBorder_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucFieldVariableBorder*  self = (lucFieldVariableBorder*)drawingObject;
+	lucFieldVariableBorder* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucFieldVariableBorder_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucFieldVariableBorder);
+	Type                                                             type = lucFieldVariableBorder_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucFieldVariableBorder_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucFieldVariableBorder_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucFieldVariableBorder_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucFieldVariableBorder_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucFieldVariableBorder_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucFieldVariableBorder_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucFieldVariableBorder_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucFieldVariableBorder_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucFieldVariableBorder_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucFieldVariableBorder_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucFieldVariableBorder_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucFieldVariableBorder_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucFieldVariableBorder_New(  LUCFIELDVARIABLEBORDER_PASSARGS  );
+}
+
+void _lucFieldVariableBorder_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucFieldVariableBorder*  self = (lucFieldVariableBorder*)drawingObject;
+	FieldVariable*           fieldVariable;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	fieldVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", FieldVariable, True, data  );
+	
+	_lucFieldVariableBorder_Init( 
+			self, 
+			fieldVariable, 
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "Black"  ),
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 0.5 )  );
+
+}
+
+void _lucFieldVariableBorder_Build( void* drawingObject, void* data ) {}
+void _lucFieldVariableBorder_Initialise( void* drawingObject, void* data ) {}
+void _lucFieldVariableBorder_Execute( void* drawingObject, void* data ) {}
+void _lucFieldVariableBorder_Destroy( void* drawingObject, void* data ) {}
+
+void _lucFieldVariableBorder_Setup( void* drawingObject, void* _context ) {
+	lucFieldVariableBorder*       self            = (lucFieldVariableBorder*)drawingObject;
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+	
+void _lucFieldVariableBorder_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucFieldVariableBorder*       self            = (lucFieldVariableBorder*)drawingObject;
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucFieldVariableBorder_CleanUp( void* drawingObject, void* _context ) {
+	lucFieldVariableBorder*       self            = (lucFieldVariableBorder*)drawingObject;
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}	
+
+void _lucFieldVariableBorder_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucFieldVariableBorder*  self    = (lucFieldVariableBorder*)drawingObject;
+	DomainContext*   context = (DomainContext*) _context;
+	Dimension_Index          dim     = context->dim;
+	FieldVariable*           field   = self->fieldVariable;
+	Coord                    min;
+	Coord                    max;
+
+	/* THis needs to be first so all processors call it - collective comms */
+	/* Grab values from field variable */
+	FieldVariable_GetMinAndMaxGlobalCoords( field, min, max );
+
+	/* Initialise OpenGL stuff */
+	glDisable(GL_LIGHTING);
+
+	/* Line smoothing will not work correctly with depth testing enabled*/
+	glDisable(GL_DEPTH_TEST);
+	glEnable(GL_LINE_SMOOTH);
+	glHint (GL_LINE_SMOOTH_HINT, GL_NICEST);
+	glEnable(GL_BLEND);
+	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE ) ;
+
+	lucColour_SetOpenGLColour( &self->colour );
+	glLineWidth( self->lineWidth );
+
+	if (dim == 2) 
+		glRectd( min[ I_AXIS ], min[ J_AXIS ], max[ I_AXIS ], max[ J_AXIS ]);
+	else if ( dim == 3 ) {
+		glBegin( GL_QUAD_STRIP );
+			glVertex3d( min[ I_AXIS ], min[ J_AXIS ], min[ K_AXIS ]);
+			glVertex3d( min[ I_AXIS ], max[ J_AXIS ], min[ K_AXIS ]);
+
+			glVertex3d( max[ I_AXIS ], min[ J_AXIS ], min[ K_AXIS ]);
+			glVertex3d( max[ I_AXIS ], max[ J_AXIS ], min[ K_AXIS ]);
+
+			glVertex3d( max[ I_AXIS ], min[ J_AXIS ], max[ K_AXIS ]);
+			glVertex3d( max[ I_AXIS ], max[ J_AXIS ], max[ K_AXIS ]);
+
+			glVertex3d( min[ I_AXIS ], min[ J_AXIS ], max[ K_AXIS ]);
+			glVertex3d( min[ I_AXIS ], max[ J_AXIS ], max[ K_AXIS ]);
+			
+			glVertex3d( min[ I_AXIS ], min[ J_AXIS ], min[ K_AXIS ]);
+			glVertex3d( min[ I_AXIS ], max[ J_AXIS ], min[ K_AXIS ]);
+		glEnd();
+	}
+	
+	/* Clean up OpenGL stuff */
+ 	glEnable(GL_DEPTH_TEST);
+	glPolygonMode ( GL_FRONT_AND_BACK, GL_FILL ) ;
+	glEnable( GL_LIGHTING );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Finalise.c
--- a/DrawingObjects/src/Finalise.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool lucDrawingObjects_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/Finalise.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,60 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool lucDrawingObjects_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/HistoricalSwarmTrajectory.c
--- a/DrawingObjects/src/HistoricalSwarmTrajectory.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,301 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: HistoricalSwarmTrajectory.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "HistoricalSwarmTrajectory.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucHistoricalSwarmTrajectory_Type = "lucHistoricalSwarmTrajectory";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucHistoricalSwarmTrajectory* _lucHistoricalSwarmTrajectory_New(  LUCHISTORICALSWARMTRAJECTORY_DEFARGS  ) 
-{
-	lucHistoricalSwarmTrajectory*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucHistoricalSwarmTrajectory) );
-	self = (lucHistoricalSwarmTrajectory*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-
-	return self;
-}
-
-void _lucHistoricalSwarmTrajectory_Init( 
-		lucHistoricalSwarmTrajectory*                                self,
-		Swarm*                                                       swarm,
-		lucColourMap*                                                colourMap,
-		Name                                                         colourName,
-		float                                                        lineWidth,
-		unsigned int 						     historySteps,
-		double							     historyTime )
-{
-	self->swarm               = swarm;
-	self->colourMap           = colourMap;
-	self->lineWidth           = lineWidth;
-	self->historySteps	  = historySteps;
-	self->historyTime	  = historyTime;
-
-	self->particleExtHandle = ExtensionManager_Add( swarm->particleExtensionMgr, (Name)self->type, sizeof( lucHistoricalSwarmTrajectory_ParticleExt ) + ( historySteps+3 )*sizeof( Coord )  );
-	
-	lucColour_FromString( &self->colour, colourName );
-
-	self->startTimestepIndex = 0;
-}
-
-void _lucHistoricalSwarmTrajectory_Delete( void* drawingObject ) {
-	lucHistoricalSwarmTrajectory*  self = (lucHistoricalSwarmTrajectory*)drawingObject;
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucHistoricalSwarmTrajectory_Print( void* drawingObject, Stream* stream ) {
-	lucHistoricalSwarmTrajectory*  self = (lucHistoricalSwarmTrajectory*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucHistoricalSwarmTrajectory_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucHistoricalSwarmTrajectory*  self = (lucHistoricalSwarmTrajectory*)drawingObject;
-	lucHistoricalSwarmTrajectory* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucHistoricalSwarmTrajectory_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucHistoricalSwarmTrajectory);
-	Type                                                             type = lucHistoricalSwarmTrajectory_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucHistoricalSwarmTrajectory_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucHistoricalSwarmTrajectory_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucHistoricalSwarmTrajectory_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucHistoricalSwarmTrajectory_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucHistoricalSwarmTrajectory_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucHistoricalSwarmTrajectory_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucHistoricalSwarmTrajectory_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucHistoricalSwarmTrajectory_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucHistoricalSwarmTrajectory_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucHistoricalSwarmTrajectory_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucHistoricalSwarmTrajectory_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucHistoricalSwarmTrajectory_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucHistoricalSwarmTrajectory_New(  LUCHISTORICALSWARMTRAJECTORY_PASSARGS  );
-}
-
-void _lucHistoricalSwarmTrajectory_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucHistoricalSwarmTrajectory*   self	= (lucHistoricalSwarmTrajectory*)drawingObject;
-	lucColourMap*           	colourMap;
-	Swarm*                  	swarm;
-	unsigned int			historySteps;
-	double 				historyTime;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	swarm         =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Swarm", Swarm, True, data  );
-	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
-
-	historySteps  =  Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"historySteps", DEFAULT_STEPS  );
-	historyTime   =  Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"historyTime", 0  );
-
-	Journal_Firewall(
-			swarm->particleLayout->coordSystem == GlobalCoordSystem,
-			Journal_MyStream( Error_Type, self ),
-			"In func %s, unable to visualise swarm %s because it uses a local coord system layout %s of type %s.\n",
-			__func__,
-			swarm->name,
-			swarm->particleLayout->name,
-			swarm->particleLayout->type );
-
-	_lucHistoricalSwarmTrajectory_Init( 
-			self, 
-			swarm,
-			colourMap,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
-			historySteps,
-			historyTime );
-}
-
-void _lucHistoricalSwarmTrajectory_Build( void* drawingObject, void* data ) {}
-void _lucHistoricalSwarmTrajectory_Initialise( void* drawingObject, void* data ) {}
-
-void _lucHistoricalSwarmTrajectory_Execute( void* drawingObject, void* data ) {}
-
-void _lucHistoricalSwarmTrajectory_Destroy( void* drawingObject, void* data ) {
-	lucHistoricalSwarmTrajectory*  self            = (lucHistoricalSwarmTrajectory*)drawingObject;
-	
-	Memory_Free( self->timeAtStep );
-}
-
-void _lucHistoricalSwarmTrajectory_Setup( void* drawingObject, void* _context ) {
-	lucHistoricalSwarmTrajectory*  self            = (lucHistoricalSwarmTrajectory*)drawingObject;
-	AbstractContext*               context         = (AbstractContext*)             _context;
-	Swarm*                         swarm           = self->swarm;
-	lucColourMap*                  colourMap       = self->colourMap;
-	Particle_Index                 lParticle_I;
-	GlobalParticle*                particle;
-	int                            currentTimestep = context->timeStep;
-	lucHistoricalSwarmTrajectory_ParticleExt* particleExt;
-	unsigned int		       historySteps    = self->historySteps;
-	
-	if ( currentTimestep >= historySteps ) {
-		self->startTimestepIndex++;
-		self->startTimestepIndex %= historySteps;	
-		currentTimestep %= historySteps;		
-	}
-	
-	self->timeAtStep =  Memory_Realloc_Array( self->timeAtStep, double, historySteps );
-
-	self->timeAtStep[ currentTimestep ] = context->currentTime;	
-
-	/* Calibrate Colour Map */
-	if ( colourMap )
-		lucColourMap_SetMinMax( colourMap, self->timeAtStep[ self->startTimestepIndex ], self->timeAtStep[ currentTimestep ] );
-
-	/* Store Current position for each time step */
-	for ( lParticle_I = 0 ; lParticle_I < swarm->particleLocalCount ; lParticle_I++ ) {
-
-		particle    = (GlobalParticle*)Swarm_ParticleAt( swarm, lParticle_I );
-		particleExt = ExtensionManager_Get( swarm->particleExtensionMgr, particle, self->particleExtHandle );
-
-		particleExt->historyCoordList = particleExt + sizeof( lucHistoricalSwarmTrajectory_ParticleExt );
-
-		memcpy( particleExt->historyCoordList[ currentTimestep ], particle->coord, sizeof(Coord) );
-	}
-	
-	/* Call parent's 'Setup' function */
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-
-void _lucHistoricalSwarmTrajectory_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	_lucOpenGLDrawingObject_Draw( drawingObject, window, viewportInfo, _context );
-}
-
-void _lucHistoricalSwarmTrajectory_CleanUp( void* drawingObject, void* context ) {
-	_lucOpenGLDrawingObject_CleanUp( drawingObject, context );
-}
-
-void _lucHistoricalSwarmTrajectory_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucHistoricalSwarmTrajectory*  self            = (lucHistoricalSwarmTrajectory*)drawingObject;
-	DomainContext*         context         = (DomainContext*)       _context;
-	Swarm*                         swarm           = self->swarm;
-	lucColourMap*                  colourMap       = self->colourMap;
-	unsigned int		       historySteps    = self->historySteps;
-	double			       historyTime     = self->historyTime;		
-	int                            timestep;
-	int                            currentTimestep = context->timeStep % historySteps; 
-	Particle_Index                 lParticle_I;
-	StandardParticle*              particle;
-	lucHistoricalSwarmTrajectory_ParticleExt* particleExt;
-	float                          offset          = -1.0;
-	double*                        coord;
-	Dimension_Index                dim             = context->dim;
-	double 			       currentTime     = context->currentTime;	
-
-	lucColour_SetOpenGLColour( &self->colour );
-	glLineWidth( self->lineWidth );
-	
-	glDisable(GL_LIGHTING);
-
-	/* Loop over all particles and draw lines according to where each one has been */
-	for ( lParticle_I = 0 ; lParticle_I < swarm->particleLocalCount ; lParticle_I++ ) {
-		particle    = Swarm_ParticleAt( swarm, lParticle_I );
-		particleExt = ExtensionManager_Get( swarm->particleExtensionMgr, particle, self->particleExtHandle );
-
-		glBegin( GL_LINE_STRIP );
-		timestep = self->startTimestepIndex ;
-		while (True) {
-			if ( (currentTime - self->timeAtStep[ timestep ]) <= historyTime || historyTime == 0 ) {
-				coord = particleExt->historyCoordList[ timestep ];
-
-				/* Set the colour from the colour map - if we've passed it in */
-				if ( colourMap )
-					lucColourMap_SetOpenGLColourFromValue( colourMap, self->timeAtStep[ timestep ] );
-
-				if (dim == 2)
-					glVertex3f( (float)coord[0], (float)coord[1], offset );
-				else
-					glVertex3dv( coord );
-			}
-				
-			/* Stop the loop when we have arrived a the current timestep */
-			if ( timestep == currentTimestep )
-				break;
-
-			/* Adjust current timestep counter so that the list of stored coordinates loops over itself */
-			timestep++;
-			timestep %= historySteps;
-		}
-		glEnd();
-	}
-		
-	glEnable(GL_LIGHTING);
-
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/HistoricalSwarmTrajectory.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/HistoricalSwarmTrajectory.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,301 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: HistoricalSwarmTrajectory.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "HistoricalSwarmTrajectory.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucHistoricalSwarmTrajectory_Type = "lucHistoricalSwarmTrajectory";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucHistoricalSwarmTrajectory* _lucHistoricalSwarmTrajectory_New(  LUCHISTORICALSWARMTRAJECTORY_DEFARGS  ) 
+{
+	lucHistoricalSwarmTrajectory*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucHistoricalSwarmTrajectory) );
+	self = (lucHistoricalSwarmTrajectory*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+
+	return self;
+}
+
+void _lucHistoricalSwarmTrajectory_Init( 
+		lucHistoricalSwarmTrajectory*                                self,
+		Swarm*                                                       swarm,
+		lucColourMap*                                                colourMap,
+		Name                                                         colourName,
+		float                                                        lineWidth,
+		unsigned int 						     historySteps,
+		double							     historyTime )
+{
+	self->swarm               = swarm;
+	self->colourMap           = colourMap;
+	self->lineWidth           = lineWidth;
+	self->historySteps	  = historySteps;
+	self->historyTime	  = historyTime;
+
+	self->particleExtHandle = ExtensionManager_Add( swarm->particleExtensionMgr, (Name)self->type, sizeof( lucHistoricalSwarmTrajectory_ParticleExt ) + ( historySteps+3 )*sizeof( Coord )  );
+	
+	lucColour_FromString( &self->colour, colourName );
+
+	self->startTimestepIndex = 0;
+}
+
+void _lucHistoricalSwarmTrajectory_Delete( void* drawingObject ) {
+	lucHistoricalSwarmTrajectory*  self = (lucHistoricalSwarmTrajectory*)drawingObject;
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucHistoricalSwarmTrajectory_Print( void* drawingObject, Stream* stream ) {
+	lucHistoricalSwarmTrajectory*  self = (lucHistoricalSwarmTrajectory*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucHistoricalSwarmTrajectory_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucHistoricalSwarmTrajectory*  self = (lucHistoricalSwarmTrajectory*)drawingObject;
+	lucHistoricalSwarmTrajectory* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucHistoricalSwarmTrajectory_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucHistoricalSwarmTrajectory);
+	Type                                                             type = lucHistoricalSwarmTrajectory_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucHistoricalSwarmTrajectory_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucHistoricalSwarmTrajectory_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucHistoricalSwarmTrajectory_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucHistoricalSwarmTrajectory_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucHistoricalSwarmTrajectory_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucHistoricalSwarmTrajectory_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucHistoricalSwarmTrajectory_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucHistoricalSwarmTrajectory_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucHistoricalSwarmTrajectory_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucHistoricalSwarmTrajectory_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucHistoricalSwarmTrajectory_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucHistoricalSwarmTrajectory_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucHistoricalSwarmTrajectory_New(  LUCHISTORICALSWARMTRAJECTORY_PASSARGS  );
+}
+
+void _lucHistoricalSwarmTrajectory_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucHistoricalSwarmTrajectory*   self	= (lucHistoricalSwarmTrajectory*)drawingObject;
+	lucColourMap*           	colourMap;
+	Swarm*                  	swarm;
+	unsigned int			historySteps;
+	double 				historyTime;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	swarm         =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Swarm", Swarm, True, data  );
+	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
+
+	historySteps  =  Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"historySteps", DEFAULT_STEPS  );
+	historyTime   =  Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"historyTime", 0  );
+
+	Journal_Firewall(
+			swarm->particleLayout->coordSystem == GlobalCoordSystem,
+			Journal_MyStream( Error_Type, self ),
+			"In func %s, unable to visualise swarm %s because it uses a local coord system layout %s of type %s.\n",
+			__func__,
+			swarm->name,
+			swarm->particleLayout->name,
+			swarm->particleLayout->type );
+
+	_lucHistoricalSwarmTrajectory_Init( 
+			self, 
+			swarm,
+			colourMap,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
+			historySteps,
+			historyTime );
+}
+
+void _lucHistoricalSwarmTrajectory_Build( void* drawingObject, void* data ) {}
+void _lucHistoricalSwarmTrajectory_Initialise( void* drawingObject, void* data ) {}
+
+void _lucHistoricalSwarmTrajectory_Execute( void* drawingObject, void* data ) {}
+
+void _lucHistoricalSwarmTrajectory_Destroy( void* drawingObject, void* data ) {
+	lucHistoricalSwarmTrajectory*  self            = (lucHistoricalSwarmTrajectory*)drawingObject;
+	
+	Memory_Free( self->timeAtStep );
+}
+
+void _lucHistoricalSwarmTrajectory_Setup( void* drawingObject, void* _context ) {
+	lucHistoricalSwarmTrajectory*  self            = (lucHistoricalSwarmTrajectory*)drawingObject;
+	AbstractContext*               context         = (AbstractContext*)             _context;
+	Swarm*                         swarm           = self->swarm;
+	lucColourMap*                  colourMap       = self->colourMap;
+	Particle_Index                 lParticle_I;
+	GlobalParticle*                particle;
+	int                            currentTimestep = context->timeStep;
+	lucHistoricalSwarmTrajectory_ParticleExt* particleExt;
+	unsigned int		       historySteps    = self->historySteps;
+	
+	if ( currentTimestep >= historySteps ) {
+		self->startTimestepIndex++;
+		self->startTimestepIndex %= historySteps;	
+		currentTimestep %= historySteps;		
+	}
+	
+	self->timeAtStep =  Memory_Realloc_Array( self->timeAtStep, double, historySteps );
+
+	self->timeAtStep[ currentTimestep ] = context->currentTime;	
+
+	/* Calibrate Colour Map */
+	if ( colourMap )
+		lucColourMap_SetMinMax( colourMap, self->timeAtStep[ self->startTimestepIndex ], self->timeAtStep[ currentTimestep ] );
+
+	/* Store Current position for each time step */
+	for ( lParticle_I = 0 ; lParticle_I < swarm->particleLocalCount ; lParticle_I++ ) {
+
+		particle    = (GlobalParticle*)Swarm_ParticleAt( swarm, lParticle_I );
+		particleExt = ExtensionManager_Get( swarm->particleExtensionMgr, particle, self->particleExtHandle );
+
+		particleExt->historyCoordList = particleExt + sizeof( lucHistoricalSwarmTrajectory_ParticleExt );
+
+		memcpy( particleExt->historyCoordList[ currentTimestep ], particle->coord, sizeof(Coord) );
+	}
+	
+	/* Call parent's 'Setup' function */
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+
+void _lucHistoricalSwarmTrajectory_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	_lucOpenGLDrawingObject_Draw( drawingObject, window, viewportInfo, _context );
+}
+
+void _lucHistoricalSwarmTrajectory_CleanUp( void* drawingObject, void* context ) {
+	_lucOpenGLDrawingObject_CleanUp( drawingObject, context );
+}
+
+void _lucHistoricalSwarmTrajectory_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucHistoricalSwarmTrajectory*  self            = (lucHistoricalSwarmTrajectory*)drawingObject;
+	DomainContext*         context         = (DomainContext*)       _context;
+	Swarm*                         swarm           = self->swarm;
+	lucColourMap*                  colourMap       = self->colourMap;
+	unsigned int		       historySteps    = self->historySteps;
+	double			       historyTime     = self->historyTime;		
+	int                            timestep;
+	int                            currentTimestep = context->timeStep % historySteps; 
+	Particle_Index                 lParticle_I;
+	StandardParticle*              particle;
+	lucHistoricalSwarmTrajectory_ParticleExt* particleExt;
+	float                          offset          = -1.0;
+	double*                        coord;
+	Dimension_Index                dim             = context->dim;
+	double 			       currentTime     = context->currentTime;	
+
+	lucColour_SetOpenGLColour( &self->colour );
+	glLineWidth( self->lineWidth );
+	
+	glDisable(GL_LIGHTING);
+
+	/* Loop over all particles and draw lines according to where each one has been */
+	for ( lParticle_I = 0 ; lParticle_I < swarm->particleLocalCount ; lParticle_I++ ) {
+		particle    = Swarm_ParticleAt( swarm, lParticle_I );
+		particleExt = ExtensionManager_Get( swarm->particleExtensionMgr, particle, self->particleExtHandle );
+
+		glBegin( GL_LINE_STRIP );
+		timestep = self->startTimestepIndex ;
+		while (True) {
+			if ( (currentTime - self->timeAtStep[ timestep ]) <= historyTime || historyTime == 0 ) {
+				coord = particleExt->historyCoordList[ timestep ];
+
+				/* Set the colour from the colour map - if we've passed it in */
+				if ( colourMap )
+					lucColourMap_SetOpenGLColourFromValue( colourMap, self->timeAtStep[ timestep ] );
+
+				if (dim == 2)
+					glVertex3f( (float)coord[0], (float)coord[1], offset );
+				else
+					glVertex3dv( coord );
+			}
+				
+			/* Stop the loop when we have arrived a the current timestep */
+			if ( timestep == currentTimestep )
+				break;
+
+			/* Adjust current timestep counter so that the list of stored coordinates loops over itself */
+			timestep++;
+			timestep %= historySteps;
+		}
+		glEnd();
+	}
+		
+	glEnable(GL_LIGHTING);
+
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Init.c
--- a/DrawingObjects/src/Init.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "DrawingObjects.h"
-
-Bool lucDrawingObjects_Init() {
-	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-
-	Stg_ComponentRegister_Add( componentRegister, lucColourBar_Type, (Name)"0", _lucColourBar_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucFieldVariableBorder_Type, (Name)"0", _lucFieldVariableBorder_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucIsosurface_Type, (Name)"0", _lucIsosurface_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucScalarFieldCrossSection_Type, (Name)"0", _lucScalarFieldCrossSection_DefaultNew );
-	Stg_ComponentRegister_Add( componentRegister, lucScalarField_Type, (Name)"0", _lucScalarField_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucVectorArrowCrossSection_Type, (Name)"0", _lucVectorArrowCrossSection_DefaultNew );
-	Stg_ComponentRegister_Add( componentRegister, lucVectorArrows_Type, (Name)"0", _lucVectorArrows_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucTextureMap_Type, (Name)"0", _lucTextureMap_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucContour_Type, (Name)"0", _lucContour_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucFeVariableSurface_Type, (Name)"0", _lucFeVariableSurface_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucSwarmViewer_Type, (Name)"0", _lucSwarmViewer_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucSwarmVectors_Type, (Name)"0", _lucSwarmVectors_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucSwarmSquares_Type, (Name)"0", _lucSwarmSquares_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucHistoricalSwarmTrajectory_Type, (Name)"0", _lucHistoricalSwarmTrajectory_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucEigenvectorsCrossSection_Type, (Name)"0", _lucEigenvectorsCrossSection_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucEigenvectors_Type, (Name)"0", _lucEigenvectors_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucSwarmRGBColourViewer_Type, (Name)"0", _lucSwarmRGBColourViewer_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucMeshViewer_Type, (Name)"0", _lucMeshViewer_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucTitle_Type, (Name)"0", _lucTitle_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucAxis_Type, (Name)"0", _lucAxis_DefaultNew  );
-        Stg_ComponentRegister_Add( componentRegister, lucTimeStep_Type, (Name)"0", _lucTimeStep_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucScalarFieldOnMeshCrossSection_Type, (Name)"0", _lucScalarFieldOnMeshCrossSection_DefaultNew );
-	Stg_ComponentRegister_Add( componentRegister, lucScalarFieldOnMesh_Type, (Name)"0", _lucScalarFieldOnMesh_DefaultNew );
-	
-
-	/* Register Parents for type checking */
-	RegisterParent( lucOpenGLDrawingObject_Type,             lucDrawingObject_Type );
-	RegisterParent( lucScalarFieldCrossSection_Type,         lucOpenGLDrawingObject_Type );
-	RegisterParent( lucScalarField_Type,                     lucScalarFieldCrossSection_Type );	
-	RegisterParent( lucScalarFieldOnMeshCrossSection_Type,   lucOpenGLDrawingObject_Type );
-	RegisterParent( lucScalarFieldOnMesh_Type,  	 	 lucScalarFieldOnMeshCrossSection_Type );
-	RegisterParent( lucVectorArrowCrossSection_Type,         lucOpenGLDrawingObject_Type );
-	RegisterParent( lucVectorArrows_Type,                    lucVectorArrowCrossSection_Type );
-	RegisterParent( lucEigenvectorsCrossSection_Type,        lucOpenGLDrawingObject_Type );
-	RegisterParent( lucEigenvectors_Type,                    lucEigenvectorsCrossSection_Type );
-	
-	
-	RegisterParent( lucColourBar_Type,                       lucDrawingObject_Type );
-	RegisterParent( lucFieldVariableBorder_Type,             lucOpenGLDrawingObject_Type );
-	RegisterParent( lucIsosurface_Type,                      lucOpenGLDrawingObject_Type );
-	RegisterParent( lucTextureMap_Type,                      lucOpenGLDrawingObject_Type );
-	RegisterParent( lucContour_Type,                         lucOpenGLDrawingObject_Type );
-	RegisterParent( lucFeVariableSurface_Type,               lucOpenGLDrawingObject_Type );
-	RegisterParent( lucSwarmViewerBase_Type,           lucOpenGLDrawingObject_Type );
-	RegisterParent( lucSwarmViewer_Type,               lucSwarmViewerBase_Type );
-	RegisterParent( lucSwarmVectors_Type,              lucSwarmViewerBase_Type );
-	RegisterParent( lucSwarmSquares_Type,              lucSwarmViewerBase_Type );
-	RegisterParent( lucHistoricalSwarmTrajectory_Type, lucOpenGLDrawingObject_Type );
-	RegisterParent( lucSwarmRGBColourViewer_Type,      lucSwarmViewerBase_Type );
-	RegisterParent( lucMeshViewer_Type,                lucOpenGLDrawingObject_Type );
-	RegisterParent( lucTitle_Type,                     lucOpenGLDrawingObject_Type );
-	RegisterParent( lucAxis_Type,                      lucOpenGLDrawingObject_Type );
-	RegisterParent( lucTimeStep_Type,                  lucOpenGLDrawingObject_Type );
-
-
-
-
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/Init.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,120 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "DrawingObjects.h"
+
+Bool lucDrawingObjects_Init() {
+	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+
+	Stg_ComponentRegister_Add( componentRegister, lucColourBar_Type, (Name)"0", _lucColourBar_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucFieldVariableBorder_Type, (Name)"0", _lucFieldVariableBorder_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucIsosurface_Type, (Name)"0", _lucIsosurface_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucScalarFieldCrossSection_Type, (Name)"0", _lucScalarFieldCrossSection_DefaultNew );
+	Stg_ComponentRegister_Add( componentRegister, lucScalarField_Type, (Name)"0", _lucScalarField_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucVectorArrowCrossSection_Type, (Name)"0", _lucVectorArrowCrossSection_DefaultNew );
+	Stg_ComponentRegister_Add( componentRegister, lucVectorArrows_Type, (Name)"0", _lucVectorArrows_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucTextureMap_Type, (Name)"0", _lucTextureMap_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucContour_Type, (Name)"0", _lucContour_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucFeVariableSurface_Type, (Name)"0", _lucFeVariableSurface_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucSwarmViewer_Type, (Name)"0", _lucSwarmViewer_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucSwarmVectors_Type, (Name)"0", _lucSwarmVectors_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucSwarmSquares_Type, (Name)"0", _lucSwarmSquares_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucHistoricalSwarmTrajectory_Type, (Name)"0", _lucHistoricalSwarmTrajectory_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucEigenvectorsCrossSection_Type, (Name)"0", _lucEigenvectorsCrossSection_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucEigenvectors_Type, (Name)"0", _lucEigenvectors_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucSwarmRGBColourViewer_Type, (Name)"0", _lucSwarmRGBColourViewer_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucMeshViewer_Type, (Name)"0", _lucMeshViewer_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucTitle_Type, (Name)"0", _lucTitle_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucAxis_Type, (Name)"0", _lucAxis_DefaultNew  );
+        Stg_ComponentRegister_Add( componentRegister, lucTimeStep_Type, (Name)"0", _lucTimeStep_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucScalarFieldOnMeshCrossSection_Type, (Name)"0", _lucScalarFieldOnMeshCrossSection_DefaultNew );
+	Stg_ComponentRegister_Add( componentRegister, lucScalarFieldOnMesh_Type, (Name)"0", _lucScalarFieldOnMesh_DefaultNew );
+	
+
+	/* Register Parents for type checking */
+	RegisterParent( lucOpenGLDrawingObject_Type,             lucDrawingObject_Type );
+	RegisterParent( lucScalarFieldCrossSection_Type,         lucOpenGLDrawingObject_Type );
+	RegisterParent( lucScalarField_Type,                     lucScalarFieldCrossSection_Type );	
+	RegisterParent( lucScalarFieldOnMeshCrossSection_Type,   lucOpenGLDrawingObject_Type );
+	RegisterParent( lucScalarFieldOnMesh_Type,  	 	 lucScalarFieldOnMeshCrossSection_Type );
+	RegisterParent( lucVectorArrowCrossSection_Type,         lucOpenGLDrawingObject_Type );
+	RegisterParent( lucVectorArrows_Type,                    lucVectorArrowCrossSection_Type );
+	RegisterParent( lucEigenvectorsCrossSection_Type,        lucOpenGLDrawingObject_Type );
+	RegisterParent( lucEigenvectors_Type,                    lucEigenvectorsCrossSection_Type );
+	
+	
+	RegisterParent( lucColourBar_Type,                       lucDrawingObject_Type );
+	RegisterParent( lucFieldVariableBorder_Type,             lucOpenGLDrawingObject_Type );
+	RegisterParent( lucIsosurface_Type,                      lucOpenGLDrawingObject_Type );
+	RegisterParent( lucTextureMap_Type,                      lucOpenGLDrawingObject_Type );
+	RegisterParent( lucContour_Type,                         lucOpenGLDrawingObject_Type );
+	RegisterParent( lucFeVariableSurface_Type,               lucOpenGLDrawingObject_Type );
+	RegisterParent( lucSwarmViewerBase_Type,           lucOpenGLDrawingObject_Type );
+	RegisterParent( lucSwarmViewer_Type,               lucSwarmViewerBase_Type );
+	RegisterParent( lucSwarmVectors_Type,              lucSwarmViewerBase_Type );
+	RegisterParent( lucSwarmSquares_Type,              lucSwarmViewerBase_Type );
+	RegisterParent( lucHistoricalSwarmTrajectory_Type, lucOpenGLDrawingObject_Type );
+	RegisterParent( lucSwarmRGBColourViewer_Type,      lucSwarmViewerBase_Type );
+	RegisterParent( lucMeshViewer_Type,                lucOpenGLDrawingObject_Type );
+	RegisterParent( lucTitle_Type,                     lucOpenGLDrawingObject_Type );
+	RegisterParent( lucAxis_Type,                      lucOpenGLDrawingObject_Type );
+	RegisterParent( lucTimeStep_Type,                  lucOpenGLDrawingObject_Type );
+
+
+
+
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Isosurface.c
--- a/DrawingObjects/src/Isosurface.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1213 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Isosurface.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "Isosurface.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucIsosurface_Type = "lucIsosurface";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucIsosurface* _lucIsosurface_New(  LUCISOSURFACE_DEFARGS  ) 
-{
-	lucIsosurface*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucIsosurface) );
-	self = (lucIsosurface*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucIsosurface_Init( 
-		lucIsosurface*                                     self,
-		FieldVariable*                                     isosurfaceField,
-		double                                             isovalue,
-		IJK                                                resolution,
-		Bool                                               drawWalls,
-		Bool                                               wireframe,
-		Bool                                               cullFrontFace,
-		Bool                                               cullBackFace,
-		Name                                               colourName,
-		lucColourMap*                                      colourMap,
-		FieldVariable*                                     colourField,
-		FieldVariable*                                     maskField,
-		lucDrawingObjectMask*                              mask )
-{
-	self->isosurfaceField = isosurfaceField;
-	self->isovalue        = isovalue;
-	lucColour_FromString( &self->colour, colourName );
-	memcpy( self->resolution, resolution, sizeof(IJK) );
-	self->drawWalls       = drawWalls;
-	self->wireframe       = wireframe;
-	self->cullFrontFace   = cullFrontFace;
-	self->cullBackFace    = cullBackFace;
-	self->colourMap       = colourMap;
-	self->colourField     = colourField;
-	self->maskField       = maskField;
-	memcpy( &self->mask, mask, sizeof(lucDrawingObjectMask) );
-
-	self->trianglesAlloced = 100;
-	self->triangleList = Memory_Alloc_Array( Surface_Triangle, self->trianglesAlloced, "triangleList" );
-}
-
-void _lucIsosurface_Delete( void* drawingObject ) {
-	lucIsosurface*  self = (lucIsosurface*)drawingObject;
-
-	Memory_Free( self->triangleList );
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucIsosurface_Print( void* drawingObject, Stream* stream ) {
-	lucIsosurface*  self = (lucIsosurface*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucIsosurface_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucIsosurface*  self = (lucIsosurface*)drawingObject;
-	lucIsosurface* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucIsosurface_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucIsosurface);
-	Type                                                             type = lucIsosurface_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucIsosurface_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucIsosurface_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucIsosurface_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucIsosurface_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucIsosurface_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucIsosurface_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucIsosurface_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucIsosurface_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucIsosurface_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucIsosurface_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucIsosurface_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucIsosurface_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucIsosurface_New(  LUCISOSURFACE_PASSARGS  );
-}
-
-void _lucIsosurface_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucIsosurface*         self               = (lucIsosurface*)drawingObject;
-	FieldVariable*         isosurfaceField;
-	FieldVariable*         colourField;
-	FieldVariable*         maskField;
-	lucColourMap*          colourMap;
-	Index                  defaultResolution;
-	IJK                    resolution;
-	double                 isovalue;
-	lucDrawingObjectMask   mask;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	isosurfaceField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"IsosurfaceField", FieldVariable, True, data  );
-	colourMap       = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
-	colourField     = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourField", FieldVariable, False, data  );
-	maskField       = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaskField", FieldVariable, False, data  );
-
-	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 64  );
-	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
-	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
-	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
-
-	lucDrawingObjectMask_Construct( &mask, self->name, cf, data );
-
-	isovalue = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"isovalue", 0.0  );
-	
-	_lucIsosurface_Init( 
-			self, 
-			isosurfaceField,
-			isovalue,
-			resolution,
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawWalls", False  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"wireframe", False  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFrontFace", False  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullBackFace", False  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "White"  ),
-			colourMap,
-			colourField,
-			maskField,
-			&mask );
-}
-
-void _lucIsosurface_Build( void* drawingObject, void* data ) {}
-void _lucIsosurface_Initialise( void* drawingObject, void* data ) {}
-void _lucIsosurface_Execute( void* drawingObject, void* data ) {}
-void _lucIsosurface_Destroy( void* drawingObject, void* data ) {}
-
-void _lucIsosurface_Setup( void* drawingObject, void* _context ) {
-	lucIsosurface*           self            = (lucIsosurface*)drawingObject;
-	DomainContext*   context         = (DomainContext*) _context;
-	FieldVariable*           isosurfaceField = self->isosurfaceField;
-	int                      i, j, k;
-	int                      nx, ny, nz;
-	double                   dx, dy, dz;
-	Vertex***                vertex;
-	Coord                    pos;
-	Coord                    min;
-	Coord                    max;
-	Dimension_Index          dim             = context->dim;
-
-	lucOpenGLDrawingObject_SyncShadowValues( self, self->isosurfaceField );
-
-	/* Initialise Variables */
-	self->triangleCount = 0;
-	nx = self->resolution[ I_AXIS ];
-	ny = self->resolution[ J_AXIS ];
-	nz = self->resolution[ K_AXIS ];
-	
-	FieldVariable_GetMinAndMaxLocalCoords( isosurfaceField, min, max );
-	dx = (max[0] - min[0])/((double) nx - 1);
-	dy = (max[1] - min[1])/((double) ny - 1);
-	dz = (max[2] - min[2])/((double) nz - 1);
-	if (dim == 2) {
-		dz = 0.0;
-		nz = 1;
-	}
-	
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	vertex = Memory_Alloc_3DArray( Vertex , nx, ny, nz , (Name)"Vertex array" );
-
-	/* Sample Field in in regular grid */
-	for ( i = 0 ; i < nx ; i++ ) {
-		for ( j = 0 ; j < ny ; j++ ) {
-			for ( k = 0 ; k < nz ; k++ ) {
-				pos[ I_AXIS ] = min[ I_AXIS ] + dx * (double) i;
-				pos[ J_AXIS ] = min[ J_AXIS ] + dy * (double) j;
-				pos[ K_AXIS ] = min[ K_AXIS ] + dz * (double ) k;
-
-				memcpy( vertex[i][j][k].pos, pos, 3 * sizeof(double) );
-				
-				if ( i == 0 )
-					pos[ I_AXIS ] = min[ I_AXIS ] + 0.001 * dx; 
-				if ( j == 0 )
-					pos[ J_AXIS ] = min[ J_AXIS ] + 0.001 * dy; 
-				if ( k == 0 )
-					pos[ K_AXIS ] = min[ K_AXIS ] + 0.001 * dz; 
-				if ( i == nx - 1 )
-					pos[ I_AXIS ] = max[ I_AXIS ] - 0.001 * dx;
-				if ( j == ny - 1 )
-					pos[ J_AXIS ] = max[ J_AXIS ] - 0.001 * dy;
-				if ( k == nz - 1 )
-					pos[ K_AXIS ] = max[ K_AXIS ] - 0.001 * dz;
-				FieldVariable_InterpolateValueAt( isosurfaceField, pos, &vertex[i][j][k].value );
-			}
-		}
-	}
-	if (dim == 3) {
-		/* Find normals */
-		lucIsosurface_Normals( self, vertex );
-		
-		/* Find Surface with Marching Cubes */
-		lucIsosurface_MarchingCubes( self, vertex );
-	}
-	if (dim == 2 || self->drawWalls)
-		lucIsosurface_DrawWalls( self, vertex );
-
-	/* Free memory */
-	Memory_Free( vertex );
-
-	/* Call parents setup function */
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-
-
-
-	#define lucIsosurface_GetColourForPos( self, pos, min, max, fudgeFactor ) \
-		do { \
-			double          __value; \
-			Coord           __interpolationPos; \
-			if ( self->colourField && self->colourMap ) { \
-				memcpy( __interpolationPos, pos, sizeof(Coord) ); \
-				if ( __interpolationPos[ I_AXIS ] >= max[ I_AXIS ] ) \
-					__interpolationPos[ I_AXIS ] = max[ I_AXIS ] - fudgeFactor[ I_AXIS ]; \
-				if ( __interpolationPos[ J_AXIS ] >= max[ J_AXIS ] ) \
-					__interpolationPos[ J_AXIS ] = max[ J_AXIS ] - fudgeFactor[ J_AXIS ]; \
-				if ( __interpolationPos[ K_AXIS ] >= max[ K_AXIS ] ) \
-					__interpolationPos[ K_AXIS ] = max[ K_AXIS ] - fudgeFactor[ K_AXIS ]; \
-				FieldVariable_InterpolateValueAt( self->colourField, __interpolationPos, &__value ); \
-				lucColourMap_SetOpenGLColourFromValue( self->colourMap, __value ); \
-			} \
-		} while (0)
-	
-void _lucIsosurface_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucIsosurface*           self          = (lucIsosurface*)drawingObject;
-	FieldVariable*           colourField   = self->colourField;
-	lucColourMap*            colourMap     = self->colourMap;
-	Coord                    min;
-	Coord                    max;
-	XYZ                      fudgeFactor   = { 0.0, 0.0, 0.0 };
-	Index                    dof_I;
-
-	lucOpenGLDrawingObject_SyncShadowValues( self, self->isosurfaceField );
-	lucOpenGLDrawingObject_SyncShadowValues( self, colourField );
-	lucOpenGLDrawingObject_SyncShadowValues( self, self->maskField );
-
-	/* Calibrate Colour Map using Colour Variable */
-	if ( colourMap && colourField ) {
-		lucColourMap_CalibrateFromFieldVariable( colourMap, colourField );
-		FieldVariable_GetMinAndMaxGlobalCoords( colourField, min, max );
-		for ( dof_I = 0 ; dof_I < 3 ; dof_I++ )
-			fudgeFactor[ dof_I ] = 0.001 * (max[ dof_I ] - min[ dof_I ]);
-		FieldVariable_GetMinAndMaxLocalCoords( colourField, min, max );
-	}
-	else if ( colourMap ) 
-		lucColourMap_CalibrateFromFieldVariable( colourMap, self->isosurfaceField );	
-	glEnable(GL_LIGHTING);
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucIsosurface_CleanUp( void* drawingObject, void* _context ) {
-	lucIsosurface*            self            = (lucIsosurface*) drawingObject;
-	
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}
-
-void _lucIsosurface_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucIsosurface*           self          = (lucIsosurface*)drawingObject;
-	FieldVariable*           colourField   = self->colourField;
-	FieldVariable*           maskField     = self->maskField;
-	Surface_Triangle*        triangleList  = self->triangleList;
-	Surface_Triangle*        currentTriangle;
-	Index                    triangle_I;
-	Index                    triangleCount = self->triangleCount;
-	lucColourMap*            colourMap     = self->colourMap;
-	Coord                    min;
-	Coord                    max;
-	XYZ                      fudgeFactor   = { 0.0, 0.0, 0.0 };
-	Index                    dof_I;
-
-	lucOpenGLDrawingObject_SyncShadowValues( self, self->isosurfaceField );
-	lucOpenGLDrawingObject_SyncShadowValues( self, colourField );
-	lucOpenGLDrawingObject_SyncShadowValues( self, maskField );
-
-	/* Give option to draw surface as wireframe */
-	if (self->wireframe) 
-		glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
-	else 
-		glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );	
-
-	/* Set up Face Culling */
-	if (self->cullBackFace) {
-		if (self->cullFrontFace) 
-			glCullFace( GL_FRONT_AND_BACK );
-		else 
-			glCullFace( GL_BACK );
-		glEnable( GL_CULL_FACE );
-	}
-	else if( self->cullFrontFace ) {
-		glCullFace( GL_FRONT );
-		glEnable( GL_CULL_FACE );
-	}
-
-	/* Calibrate Colour Map using Colour Variable */
-	if ( colourMap && colourField ) {
-		lucColourMap_CalibrateFromFieldVariable( colourMap, colourField );
-		FieldVariable_GetMinAndMaxGlobalCoords( colourField, min, max );
-		for ( dof_I = 0 ; dof_I < 3 ; dof_I++ )
-			fudgeFactor[ dof_I ] = 0.001 * (max[ dof_I ] - min[ dof_I ]);
-		FieldVariable_GetMinAndMaxLocalCoords( colourField, min, max );
-	}
-	else if ( colourMap ) 
-		lucColourMap_CalibrateFromFieldVariable( colourMap, self->isosurfaceField );
-
-
-	glFrontFace(GL_CW);
-	glBegin(GL_TRIANGLES);
-
-	if ( ! self->colourMap || ! colourField ) {
-		lucColour_SetOpenGLColour( &self->colour );
-	}
-	else if ( !colourField ) {
-		lucColourMap_SetOpenGLColourFromValue( colourMap, self->isovalue );
-	}
-	
-	for( triangle_I = 0 ; triangle_I < triangleCount ; triangle_I++) {
-		currentTriangle = (Surface_Triangle*) &triangleList[triangle_I];
-
-		/* Test for masked triangle */
-		if ( maskField != NULL ) {
-			if (lucIsosurface_TestMask( self, currentTriangle->pos1 ) == False) continue;
-			if (lucIsosurface_TestMask( self, currentTriangle->pos2 ) == False) continue;
-			if (lucIsosurface_TestMask( self, currentTriangle->pos3 ) == False) continue;
-		}
-
-		/* Plot First Vertex */
-		lucIsosurface_GetColourForPos( self, currentTriangle->pos1, min, max, fudgeFactor );
-		glNormal3dv(currentTriangle->normal1);
-		glVertex3dv(currentTriangle->pos1);
-		
-		/* Plot Second Vertex */
-		lucIsosurface_GetColourForPos( self, currentTriangle->pos3, min, max, fudgeFactor );
-		glNormal3dv(currentTriangle->normal3);
-		glVertex3dv(currentTriangle->pos3);	
-		
-		/* Plot Third Vertex */
-		lucIsosurface_GetColourForPos( self, currentTriangle->pos2, min, max, fudgeFactor );
-		glNormal3dv(currentTriangle->normal2);
-		glVertex3dv(currentTriangle->pos2);
-	}
-	glEnd();
-}
-
-Bool lucIsosurface_TestMask( lucIsosurface* self, Coord pos ) {
-	double value;
-
-	FieldVariable_InterpolateValueAt( self->maskField, pos, &value );
-
-	return lucDrawingObjectMask_Test( &self->mask, value );
-}
-
-/*
-   Given a grid cell and an isolevel, calculate the triangular
-   facets required to represent the isosurface through the cell.
-   Return the number of triangular facets, the array "triangleList"
-   will be loaded up with the vertices at most 5 triangular facets.
-	0 will be returned if the grid cell is either totally above
-   of totally below the isolevel.
-*/
-
-void VertexInterp(double isolevel, Vertex* point, Vertex* vertex1, Vertex* vertex2 ) ;
-double getQuadraticDerive(double y1, double y2, double y3, double x1, double x2, double x3) ;
-
-/* This algorithm for constructing an isosurface is taken from:
-Lorensen, William and Harvey E. Cline. Marching Cubes: A High Resolution 3D Surface Construction Algorithm. Computer Graphics (SIGGRAPH 87 Proceedings) 21(4) July 1987, p. 163-170) http://www.cs.duke.edu/education/courses/fall01/cps124/resources/p163-lorensen.pdf 
-The lookup table is taken from http://astronomy.swin.edu.au/~pbourke/modelling/polygonise/ 
-*/
-void lucIsosurface_MarchingCubes( lucIsosurface* self, Vertex*** vertex ) {
-	double isolevel = self->isovalue;
-	int i,j,k,n;
-	int triangleCount = 0;
-	int nx = self->resolution[ I_AXIS ];
-	int ny = self->resolution[ J_AXIS ];
-	int nz = self->resolution[ K_AXIS ];
-	int cubeindex;
-	Vertex points[12];
-
-int edgeTable[256]={
-0x0  , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
-0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
-0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
-0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
-0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c,
-0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
-0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac,
-0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
-0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c,
-0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
-0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc,
-0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
-0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c,
-0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
-0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc ,
-0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
-0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
-0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
-0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
-0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
-0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
-0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
-0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
-0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460,
-0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
-0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0,
-0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
-0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230,
-0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
-0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190,
-0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
-0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0   };
-int triTable[256][16] =
-{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1},
-{3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1},
-{3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1},
-{3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1},
-{9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1},
-{9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
-{2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1},
-{8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1},
-{9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
-{4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1},
-{3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1},
-{1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1},
-{4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1},
-{4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1},
-{9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
-{5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1},
-{2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1},
-{9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
-{0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
-{2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1},
-{10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1},
-{4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1},
-{5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1},
-{5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1},
-{9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1},
-{0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1},
-{1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1},
-{10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1},
-{8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1},
-{2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1},
-{7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1},
-{9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1},
-{2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1},
-{11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1},
-{9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1},
-{5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1},
-{11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1},
-{11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
-{1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1},
-{9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1},
-{5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1},
-{2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
-{0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
-{5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1},
-{6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1},
-{3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1},
-{6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1},
-{5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1},
-{1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
-{10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1},
-{6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1},
-{8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1},
-{7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1},
-{3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
-{5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1},
-{0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1},
-{9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1},
-{8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1},
-{5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1},
-{0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1},
-{6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1},
-{10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1},
-{10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1},
-{8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1},
-{1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1},
-{3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1},
-{0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1},
-{10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1},
-{3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1},
-{6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1},
-{9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1},
-{8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1},
-{3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1},
-{6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1},
-{0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1},
-{10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1},
-{10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1},
-{2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1},
-{7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1},
-{7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1},
-{2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1},
-{1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1},
-{11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1},
-{8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1},
-{0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1},
-{7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
-{10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
-{2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
-{6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1},
-{7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1},
-{2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1},
-{1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1},
-{10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1},
-{10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1},
-{0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1},
-{7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1},
-{6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1},
-{8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1},
-{9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1},
-{6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1},
-{4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1},
-{10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1},
-{8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1},
-{0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1},
-{1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1},
-{8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1},
-{10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1},
-{4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1},
-{10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
-{5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
-{11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1},
-{9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
-{6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1},
-{7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1},
-{3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1},
-{7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1},
-{9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1},
-{3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1},
-{6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1},
-{9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1},
-{1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1},
-{4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1},
-{7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1},
-{6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1},
-{3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1},
-{0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1},
-{6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1},
-{0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1},
-{11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1},
-{6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1},
-{5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1},
-{9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1},
-{1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1},
-{1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1},
-{10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1},
-{0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1},
-{5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1},
-{10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1},
-{11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1},
-{9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1},
-{7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1},
-{2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1},
-{8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1},
-{9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1},
-{9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1},
-{1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1},
-{9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1},
-{9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1},
-{5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1},
-{0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1},
-{10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1},
-{2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1},
-{0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1},
-{0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1},
-{9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1},
-{5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1},
-{3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1},
-{5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1},
-{8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1},
-{0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1},
-{9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1},
-{0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1},
-{1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1},
-{3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1},
-{4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1},
-{9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1},
-{11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1},
-{11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1},
-{2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1},
-{9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1},
-{3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1},
-{1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1},
-{4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1},
-{4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1},
-{0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1},
-{3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1},
-{3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1},
-{0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1},
-{9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1},
-{1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
-{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
-
-
-	for ( i = 0 ; i < nx - 1  ; i++ ) {
-		for ( j = 0 ; j < ny - 1 ; j++ ) {
-			for ( k = 0 ; k < nz - 1 ; k++ ) {
-				/* Determine the index into the edge table which tells us which vertices are inside of the surface */
-				cubeindex = 0;
-				if (vertex[i][j][k].value       < isolevel) cubeindex |= 1;	
-				if (vertex[i+1][j][k].value     < isolevel) cubeindex |= 2;
-				if (vertex[i+1][j][k+1].value   < isolevel) cubeindex |= 4;
-				if (vertex[i][j][k+1].value     < isolevel) cubeindex |= 8;
-				if (vertex[i][j+1][k].value     < isolevel) cubeindex |= 16;
-				if (vertex[i+1][j+1][k].value   < isolevel) cubeindex |= 32;
-				if (vertex[i+1][j+1][k+1].value < isolevel) cubeindex |= 64;
-				if (vertex[i][j+1][k+1].value   < isolevel) cubeindex |= 128;
-				
-				/* Cube is entirely in/out of the surface */
-				if (edgeTable[cubeindex] == 0) continue;
-					
-				/* Find the vertices where the surface intersects the cube */
-				if (edgeTable[cubeindex] & 1)
-					VertexInterp(isolevel, &points[0], &vertex[i][j][k] , &vertex[i+1][j][k]);
-				if (edgeTable[cubeindex] & 2)
-					VertexInterp(isolevel, &points[1], &vertex[i+1][j][k] , &vertex[i+1][j][k+1] );
-				if (edgeTable[cubeindex] & 4)
-					VertexInterp(isolevel, &points[2], &vertex[i+1][j][k+1] , &vertex[i][j][k+1] );
-				if (edgeTable[cubeindex] & 8)
-					VertexInterp(isolevel, &points[3], &vertex[i][j][k+1] , &vertex[i][j][k] );
-				if (edgeTable[cubeindex] & 16)
-					VertexInterp(isolevel, &points[4], &vertex[i][j+1][k] , &vertex[i+1][j+1][k] );
-				if (edgeTable[cubeindex] & 32)
-					VertexInterp(isolevel, &points[5], &vertex[i+1][j+1][k] , &vertex[i+1][j+1][k+1] );
-				if (edgeTable[cubeindex] & 64)
-					VertexInterp(isolevel, &points[6], &vertex[i+1][j+1][k+1] , &vertex[i][j+1][k+1] );
-				if (edgeTable[cubeindex] & 128)
-					VertexInterp(isolevel, &points[7], &vertex[i][j+1][k+1] , &vertex[i][j+1][k] );
-				if (edgeTable[cubeindex] & 256)
-					VertexInterp(isolevel, &points[8], &vertex[i][j][k] , &vertex[i][j+1][k] );
-				if (edgeTable[cubeindex] & 512)
-					VertexInterp(isolevel, &points[9], &vertex[i+1][j][k] , &vertex[i+1][j+1][k] );
-				if (edgeTable[cubeindex] & 1024)
-					VertexInterp(isolevel, &points[10], &vertex[i+1][j][k+1] , &vertex[i+1][j+1][k+1] );
-				if (edgeTable[cubeindex] & 2048)
-					VertexInterp(isolevel, &points[11], &vertex[i][j][k+1] , &vertex[i][j+1][k+1] );
-
-				/* Create the triangle */
-				for ( n = 0 ; triTable[cubeindex][n] != -1 ; n += 3 ) {
-					if (triangleCount > self->trianglesAlloced - 1 ) {
-						self->trianglesAlloced = self->trianglesAlloced + 100;
-						self->triangleList = Memory_Realloc_Array( self->triangleList, Surface_Triangle, self->trianglesAlloced );
-					}
-					/* Get positions */
-					memcpy( self->triangleList[triangleCount].pos1 , points[ triTable[cubeindex][n  ] ].pos , 3 * sizeof(double) );
-					memcpy( self->triangleList[triangleCount].pos2 , points[ triTable[cubeindex][n+1] ].pos , 3 * sizeof(double) );
-					memcpy( self->triangleList[triangleCount].pos3 , points[ triTable[cubeindex][n+2] ].pos , 3 * sizeof(double) );
-
-					/* Get Normals */
-					memcpy( self->triangleList[triangleCount].normal1 , points[ triTable[cubeindex][n  ] ].normal , 3 * sizeof(double) );
-					memcpy( self->triangleList[triangleCount].normal2 , points[ triTable[cubeindex][n+1] ].normal , 3 * sizeof(double) );
-					memcpy( self->triangleList[triangleCount].normal3 , points[ triTable[cubeindex][n+2] ].normal , 3 * sizeof(double) );
-
-					triangleCount++;
-				}
-			}
-		}
-	}
-	self->triangleCount = triangleCount;
-}
-
-/*
-   Linearly interpolate the position where an isosurface cuts
-   an edge between two vertices, each with their own scalar value
-*/
-void VertexInterp(double isolevel, Vertex* point, Vertex* vertex1, Vertex* vertex2 ) {
-	double mu;
-
-	if (fabs(isolevel - vertex1->value) < 0.00001) {
-		memcpy( point, vertex1, sizeof(Vertex) );
-		return;
-	}
-	if (fabs(isolevel - vertex2->value) < 0.00001) {
-		memcpy( point, vertex2, sizeof(Vertex) );
-		return;
-	}
-	if (fabs(vertex1->value - vertex2->value) < 0.00001) {
-		memcpy( point, vertex1, sizeof(Vertex) );
-		return;
-	}
-		
-	mu = (isolevel - vertex1->value) / (vertex2->value - vertex1->value);
-	
-	point->pos[0] = vertex1->pos[0] + mu * (vertex2->pos[0] - vertex1->pos[0]);
-	point->pos[1] = vertex1->pos[1] + mu * (vertex2->pos[1] - vertex1->pos[1]);
-	point->pos[2] = vertex1->pos[2] + mu * (vertex2->pos[2] - vertex1->pos[2]);
-
-	point->normal[0] = vertex1->normal[0] + mu * (vertex2->normal[0] - vertex1->normal[0]);
-	point->normal[1] = vertex1->normal[1] + mu * (vertex2->normal[1] - vertex1->normal[1]);
-	point->normal[2] = vertex1->normal[2] + mu * (vertex2->normal[2] - vertex1->normal[2]);
-}
-
-void lucIsosurface_Normals( lucIsosurface* self, Vertex*** vertex ) {
-	int i, j, k;
-	int nx = self->resolution[ I_AXIS ];
-	int ny = self->resolution[ J_AXIS ];
-	int nz = self->resolution[ K_AXIS ];
-
-	for ( i = 0 ; i < nx ; i++ ) {
-		for ( j = 0 ; j < ny ; j++ ) {
-			for ( k = 0 ; k < nz ; k++ ) {
-				/* Set up component in x direction */
-				if (i == 0) {
-					vertex[i][j][k].normal[0] = (vertex[i+1][j][k].value - vertex[i][j][k].value) / 
-									(vertex[i+1][j][k].pos[0] - vertex[i][j][k].pos[0] ) ;
-				}
-				else if (i == nx - 1)  {
-					vertex[i][j][k].normal[0] = (vertex[i][j][k].value - vertex[i-1][j][k].value) / 
-									(vertex[i][j][k].pos[0] - vertex[i-1][j][k].pos[0] ) ;
-				}
-				else {	
-					vertex[i][j][k].normal[0] = getQuadraticDerive(	
-					                              vertex[i-1][j][k].value, vertex[i][j][k].value, vertex[i+1][j][k].value,
-					                              vertex[i-1][j][k].pos[0], vertex[i][j][k].pos[0], vertex[i+1][j][k].pos[0]);
-				}
-				
-				/* Set up component in y direction */
-				if (j == 0) {
-					vertex[i][j][k].normal[1] = (vertex[i][j+1][k].value - vertex[i][j][k].value) / 
-									(vertex[i][j+1][k].pos[1] - vertex[i][j][k].pos[1] ) ;
-				}
-				else if (j == ny - 1)  {
-					vertex[i][j][k].normal[1] = (vertex[i][j][k].value - vertex[i][j-1][k].value) / 
-									(vertex[i][j][k].pos[1] - vertex[i][j-1][k].pos[1] ) ;
-				}
-				else {	
-					vertex[i][j][k].normal[1] = getQuadraticDerive(	
-					                              vertex[i][j-1][k].value, vertex[i][j][k].value, vertex[i][j+1][k].value,
-					                              vertex[i][j-1][k].pos[1], vertex[i][j][k].pos[1], vertex[i][j+1][k].pos[1]);
-				}			
-				
-				/* Set up component in z direction */
-				if (k == 0) {
-					vertex[i][j][k].normal[2] = (vertex[i][j][k+1].value - vertex[i][j][k].value) / 
-									(vertex[i][j][k+1].pos[2] - vertex[i][j][k].pos[2] ) ;
-				}
-				else if (k == nz - 1)  {
-					vertex[i][j][k].normal[2] = (vertex[i][j][k].value - vertex[i][j][k-1].value) / 
-									(vertex[i][j][k].pos[2] - vertex[i][j][k-1].pos[2] ) ;
-				}
-				else {	
-					vertex[i][j][k].normal[2] = getQuadraticDerive(	
-					                              vertex[i][j][k-1].value, vertex[i][j][k].value, vertex[i][j][k+1].value,
-					                              vertex[i][j][k-1].pos[2], vertex[i][j][k].pos[2], vertex[i][j][k+1].pos[2]);
-				}														
-				StGermain_VectorNormalise(vertex[i][j][k].normal, 3);	
-			}
-		}
-	}
-}
-
-double getQuadraticDerive(double y1, double y2, double y3, double x1, double x2, double x3) {
-	double dy12, dy32;
-	double dx12sq, dx32sq, dx12, dx32;
-	double a, b;
-	double result;
-
-	if (fabs(y2 - y1) < 0.0001 && fabs(y3 - y1) < 0.0001) {
-		return 0.0;
-	}
-	//  Get the problem variables
-	dy12 = y1-y2;
-	dy32 = y3-y2;
-	dx12 = x1-x2;
-	dx32 = x3-x2;
-	dx12sq = (x1*x1)-(x2*x2);
-	dx32sq = (x3*x3)-(x2*x2);
-	
-	//  Get a
-	a = dx12 * dy32 / dx32;
-	a -= dy12;
-	a /= ((dx32sq/dx32) + dx12sq);
-	
-	//  Get b
-	b = dy32;
-	b -= a * dx32sq;
-	b /= dx32;
-	
-	//  Now get the derivative
-	result = 2*a*x2 + b;
-	
-	return result;
-}
-
-
-#define gLucifer_CW	0
-#define gLucifer_CCW	1
-
-#define LEFT_BOTTOM     0
-#define RIGHT_BOTTOM    1
-#define LEFT_TOP        2
-#define RIGHT_TOP       3
-#define LEFT            4
-#define RIGHT           5
-#define TOP	            6
-#define BOTTOM          7
-
-void lucIsosurface_DrawWalls( lucIsosurface* self, Vertex ***array ) {
-	int nx = self->resolution[ I_AXIS ];
-	int ny = self->resolution[ J_AXIS ];
-	int nz = self->resolution[ K_AXIS ];
-	int i, j, k;
-	Vertex ** points;
-	Vertex * midVertices;
-	char order;
-
-	/* Allocate Memory */
-	points = Memory_Alloc_Array( Vertex* , 8, "array for marching squares");
-	midVertices = Memory_Alloc_Array( Vertex , 4, "array for marching squares");
-	points[LEFT] = &midVertices[0];
-	points[RIGHT] = &midVertices[1];
-	points[TOP] = &midVertices[2];
-	points[BOTTOM] = &midVertices[3];
-	
-	for ( i = 0 ; i < nx - 1 ; i++ ) {
-		for ( j = 0 ; j < ny - 1 ; j++ ) {
-			k = 0;
-			order = gLucifer_CCW;
-			lucIsosurface_SetupPointsZ( points, array, i, j, k );
-			lucIsosurface_WallElement( self, points, order, K_AXIS );
-
-			k = nz - 1;
-			order = gLucifer_CW;
-			lucIsosurface_SetupPointsZ( points, array, i, j, k );
-			lucIsosurface_WallElement( self, points, order, K_AXIS );
-		}
-	}
-	for ( k = 0 ; k < nz - 1 ; k++ ) {
-		for ( j = 0 ; j < ny - 1 ; j++ ) {
-			i = 0;
-			order = gLucifer_CW;
-			lucIsosurface_SetupPointsX( points, array, i, j, k );
-			lucIsosurface_WallElement( self, points, order, I_AXIS );
-
-			i = nx - 1;
-			order = gLucifer_CCW;
-			lucIsosurface_SetupPointsX( points, array, i, j, k );
-			lucIsosurface_WallElement( self, points, order, I_AXIS );
-
-		}
-	}
-	for ( i = 0 ; i < nx - 1 ; i++ ) {
-		for ( k = 0 ; k < nz - 1 ; k++ ) {
-			j = 0;
-			order = gLucifer_CW;
-			lucIsosurface_SetupPointsY( points, array, i, j, k );
-			lucIsosurface_WallElement( self, points, order, J_AXIS );
-
-			j = ny - 1;
-			order = gLucifer_CCW;
-			lucIsosurface_SetupPointsY( points, array, i, j, k );
-			lucIsosurface_WallElement( self, points, order, J_AXIS );
-		}
-	}
-	Memory_Free( points );
-	Memory_Free( midVertices );
-}
-
-void lucIsosurface_SetupPointsX( Vertex** points, Vertex*** array, Index i, Index j, Index k ){
-	points[LEFT_BOTTOM]  = &array[i][ j ][ k ];
-	points[RIGHT_BOTTOM] = &array[i][j+1][ k ];
-	points[LEFT_TOP]     = &array[i][ j ][k+1];
-	points[RIGHT_TOP]    = &array[i][j+1][k+1];
-}
-
-void lucIsosurface_SetupPointsY( Vertex** points, Vertex*** array, Index i, Index j, Index k ){
-	points[LEFT_BOTTOM]  = &array[ i ][j][ k ];
-	points[RIGHT_BOTTOM] = &array[i+1][j][ k ];
-	points[LEFT_TOP]     = &array[ i ][j][k+1];
-	points[RIGHT_TOP]    = &array[i+1][j][k+1];
-}
-
-void lucIsosurface_SetupPointsZ( Vertex** points, Vertex*** array, Index i, Index j, Index k ){
-	points[LEFT_BOTTOM]  = &array[ i ][ j ][k];
-	points[RIGHT_BOTTOM] = &array[i+1][ j ][k];
-	points[LEFT_TOP]     = &array[ i ][j+1][k];
-	points[RIGHT_TOP]    = &array[i+1][j+1][k];
-}
-
-void lucIsosurface_WallElement( lucIsosurface* self, Vertex** points, char order, Dimension_Index axis ) {
-	double value  = self->isovalue;
-	char   cubeType = 0;
-
-	/* find cube type */
-	if (points[LEFT_BOTTOM]->value  > value) cubeType += 1;
-	if (points[RIGHT_BOTTOM]->value > value) cubeType += 2;
-	if (points[LEFT_TOP]->value     > value) cubeType += 4;
-	if (points[RIGHT_TOP]->value    > value) cubeType += 8;
-
-	/* Create Points */
-	lucIsosurface_CreateIntermediatePoints( self, points, axis );
-	
-	lucIsosurface_MarchingRectangles( self, points, cubeType, order );
-}	
-
-void lucIsosurface_AddWallTriangle( lucIsosurface* self, int a , int b, int c, Vertex** points, char order) {
-	int n = self->triangleCount;
-	if ( n > self->trianglesAlloced - 1 ) {
-		self->trianglesAlloced = self->trianglesAlloced + 100;
-		self->triangleList = Memory_Realloc_Array( self->triangleList, Surface_Triangle, self->trianglesAlloced );
-	}
-	
-	if (order == gLucifer_CCW) {
-		memcpy( self->triangleList[n].pos1, points[a]->pos, 3*sizeof(double) );
-		memcpy( self->triangleList[n].pos2, points[c]->pos, 3*sizeof(double) );
-		memcpy( self->triangleList[n].pos3, points[b]->pos, 3*sizeof(double) );
-	}
-	else {
-		memcpy( self->triangleList[n].pos1, points[a]->pos, 3*sizeof(double) );
-		memcpy( self->triangleList[n].pos2, points[b]->pos, 3*sizeof(double) );
-		memcpy( self->triangleList[n].pos3, points[c]->pos, 3*sizeof(double) );
-	}
-
-	/* Calculate Normal */
-	StGermain_NormalToPlane( self->triangleList[n].normal1 , 
-		self->triangleList[n].pos1, self->triangleList[n].pos2, self->triangleList[n].pos3 );
-
-	memcpy( self->triangleList[n].normal2, self->triangleList[n].normal1 , 3 * sizeof(double) );
-	memcpy( self->triangleList[n].normal3, self->triangleList[n].normal1 , 3 * sizeof(double) );
-	self->triangleCount++;
-	
-}
-
-void lucIsosurface_CreateIntermediatePoints( lucIsosurface* self, Vertex **points, Dimension_Index axis ) {
-	double value = self->isovalue;
-	Dimension_Index A = ( axis == I_AXIS ? J_AXIS : I_AXIS );
-	Dimension_Index B = ( axis == K_AXIS ? J_AXIS : K_AXIS );
-	double dA = points[RIGHT_TOP]->pos[A] - points[LEFT_BOTTOM]->pos[A];
-	double dB = points[RIGHT_TOP]->pos[B] - points[LEFT_BOTTOM]->pos[B];
-
-	memcpy( points[ LEFT ]->pos, points[ LEFT_BOTTOM ]->pos, 3*sizeof(double) );
-	points[ LEFT ]->pos[B] += dB * (value - points[LEFT_BOTTOM]->value) 
-				/ (points[LEFT_TOP]->value - points[LEFT_BOTTOM]->value ) ;
-	
-	memcpy( points[ RIGHT ]->pos, points[ RIGHT_BOTTOM ]->pos, 3*sizeof(double) );
-	points[ RIGHT ]->pos[B] += dB * (value - points[RIGHT_BOTTOM]->value) 
-				/ (points[RIGHT_TOP]->value - points[RIGHT_BOTTOM]->value ) ;
-	
-	memcpy( points[ BOTTOM ]->pos, points[ LEFT_BOTTOM ]->pos, 3*sizeof(double) );
-	points[ BOTTOM ]->pos[A] += dA * (value - points[LEFT_BOTTOM]->value) 
-				/ (points[RIGHT_BOTTOM]->value - points[LEFT_BOTTOM]->value ) ;
-	
-	memcpy( points[ TOP ]->pos, points[ LEFT_TOP ]->pos, 3*sizeof(double) );
-	points[ TOP ]->pos[A] += dA * (value - points[LEFT_TOP]->value) 
-				/ (points[RIGHT_TOP]->value - points[LEFT_TOP]->value ) ;
-}		
-
-void lucIsosurface_MarchingRectangles( lucIsosurface* self, Vertex** points, char cubeType, char order) {
-	switch (cubeType) {
-		case 0:
-			/*  @@  */
-			/*  @@  */
-			break;
-		case 1:		
-			/*  @@  */
-			/*  #@  */
-			lucIsosurface_AddWallTriangle( self, LEFT_BOTTOM , LEFT, BOTTOM, points, order);
-			break;
-		case 2:
-			/*  @@  */
-			/*  @#  */	
-			lucIsosurface_AddWallTriangle(self, BOTTOM , RIGHT, RIGHT_BOTTOM, points, order);
-			break;
-		case 3:
-			/*  @@  */
-			/*  ##  */	
-			lucIsosurface_AddWallTriangle( self, LEFT_BOTTOM , LEFT, RIGHT, points, order);
-			lucIsosurface_AddWallTriangle(self, LEFT_BOTTOM , RIGHT, RIGHT_BOTTOM, points, order);
-			break;
-		case 4:
-			/*  #@  */
-			/*  @@  */
-			lucIsosurface_AddWallTriangle(self, LEFT_TOP , TOP, LEFT, points, order);
-			break;
-		case 5:
-			/*  #@  */
-			/*  #@  */
-			lucIsosurface_AddWallTriangle(self, LEFT_TOP , TOP, LEFT_BOTTOM, points, order);
-			lucIsosurface_AddWallTriangle(self, TOP , BOTTOM, LEFT_BOTTOM, points, order);
-			break;
-		case 6:
-			/*  #@  */
-			/*  @#  */
-			lucIsosurface_AddWallTriangle(self, LEFT_TOP , TOP, LEFT, points, order);
-			lucIsosurface_AddWallTriangle(self, BOTTOM , RIGHT, RIGHT_BOTTOM, points, order);
-			break;
-		case 7:
-			/*  #@  */
-			/*  ##  */
-			lucIsosurface_AddWallTriangle(self, RIGHT , RIGHT_BOTTOM, TOP, points, order);
-			lucIsosurface_AddWallTriangle(self, TOP , RIGHT_BOTTOM, LEFT_TOP, points, order);
-			lucIsosurface_AddWallTriangle(self, LEFT_TOP , RIGHT_BOTTOM, LEFT_BOTTOM, points, order);
-			break;
-		case 8:
-			/*  @#  */
-			/*  @@  */
-			lucIsosurface_AddWallTriangle(self, TOP , RIGHT_TOP, RIGHT, points, order);
-			break;
-		case 9:
-			/*  @#  */
-			/*  #@  */
-			lucIsosurface_AddWallTriangle(self, TOP , RIGHT_TOP, RIGHT, points, order);
-			lucIsosurface_AddWallTriangle(self, LEFT_BOTTOM , LEFT, BOTTOM, points, order);
-			break;
-		case 10:
-			/*  @#  */
-			/*  @#  */
-			lucIsosurface_AddWallTriangle(self, TOP , RIGHT_TOP, RIGHT_BOTTOM, points, order);
-			lucIsosurface_AddWallTriangle(self, BOTTOM , TOP, RIGHT_BOTTOM, points, order);
-			
-			break;
-		case 11:
-			/*  @#  */
-			/*  ##  */
-			lucIsosurface_AddWallTriangle(self, TOP , LEFT_BOTTOM, LEFT, points, order);
-			lucIsosurface_AddWallTriangle(self, RIGHT_TOP , LEFT_BOTTOM, TOP, points, order);
-			lucIsosurface_AddWallTriangle(self, RIGHT_BOTTOM , LEFT_BOTTOM, RIGHT_TOP, points, order);
-			break;
-		case 12:
-			/*  ##  */
-			/*  @@  */
-			lucIsosurface_AddWallTriangle(self, LEFT , LEFT_TOP, RIGHT, points, order);
-			lucIsosurface_AddWallTriangle(self, RIGHT , LEFT_TOP, RIGHT_TOP, points, order);
-			break;
-		case 13:
-			/*  ##  */
-			/*  #@  */
-			lucIsosurface_AddWallTriangle(self, BOTTOM , RIGHT_TOP, RIGHT, points, order);
-			lucIsosurface_AddWallTriangle(self, LEFT_BOTTOM , RIGHT_TOP, BOTTOM, points, order);
-			lucIsosurface_AddWallTriangle(self, LEFT_TOP , RIGHT_TOP, LEFT_BOTTOM, points, order);
-			break;
-		case 14:
-			/*  ##  */
-			/*  @#  */
-			lucIsosurface_AddWallTriangle(self, LEFT , LEFT_TOP, BOTTOM, points, order);
-			lucIsosurface_AddWallTriangle(self, BOTTOM , LEFT_TOP, RIGHT_BOTTOM, points, order);
-			lucIsosurface_AddWallTriangle(self, RIGHT_BOTTOM , LEFT_TOP, RIGHT_TOP, points, order);
-			break;
-		case 15:
-			/*  ##  */
-			/*  ##  */
-			lucIsosurface_AddWallTriangle(self, LEFT_TOP , RIGHT_TOP, RIGHT_BOTTOM, points, order);
-			lucIsosurface_AddWallTriangle(self, RIGHT_BOTTOM , LEFT_BOTTOM, LEFT_TOP, points, order);
-			break;
-		default:
-			Journal_Printf( self->errorStream, "In func %s: Cannot understand cube type %d\n", __func__, cubeType );
-			abort();
-	}
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Isosurface.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/Isosurface.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,1213 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Isosurface.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "Isosurface.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucIsosurface_Type = "lucIsosurface";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucIsosurface* _lucIsosurface_New(  LUCISOSURFACE_DEFARGS  ) 
+{
+	lucIsosurface*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucIsosurface) );
+	self = (lucIsosurface*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucIsosurface_Init( 
+		lucIsosurface*                                     self,
+		FieldVariable*                                     isosurfaceField,
+		double                                             isovalue,
+		IJK                                                resolution,
+		Bool                                               drawWalls,
+		Bool                                               wireframe,
+		Bool                                               cullFrontFace,
+		Bool                                               cullBackFace,
+		Name                                               colourName,
+		lucColourMap*                                      colourMap,
+		FieldVariable*                                     colourField,
+		FieldVariable*                                     maskField,
+		lucDrawingObjectMask*                              mask )
+{
+	self->isosurfaceField = isosurfaceField;
+	self->isovalue        = isovalue;
+	lucColour_FromString( &self->colour, colourName );
+	memcpy( self->resolution, resolution, sizeof(IJK) );
+	self->drawWalls       = drawWalls;
+	self->wireframe       = wireframe;
+	self->cullFrontFace   = cullFrontFace;
+	self->cullBackFace    = cullBackFace;
+	self->colourMap       = colourMap;
+	self->colourField     = colourField;
+	self->maskField       = maskField;
+	memcpy( &self->mask, mask, sizeof(lucDrawingObjectMask) );
+
+	self->trianglesAlloced = 100;
+	self->triangleList = Memory_Alloc_Array( Surface_Triangle, self->trianglesAlloced, "triangleList" );
+}
+
+void _lucIsosurface_Delete( void* drawingObject ) {
+	lucIsosurface*  self = (lucIsosurface*)drawingObject;
+
+	Memory_Free( self->triangleList );
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucIsosurface_Print( void* drawingObject, Stream* stream ) {
+	lucIsosurface*  self = (lucIsosurface*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucIsosurface_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucIsosurface*  self = (lucIsosurface*)drawingObject;
+	lucIsosurface* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucIsosurface_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucIsosurface);
+	Type                                                             type = lucIsosurface_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucIsosurface_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucIsosurface_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucIsosurface_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucIsosurface_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucIsosurface_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucIsosurface_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucIsosurface_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucIsosurface_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucIsosurface_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucIsosurface_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucIsosurface_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucIsosurface_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucIsosurface_New(  LUCISOSURFACE_PASSARGS  );
+}
+
+void _lucIsosurface_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucIsosurface*         self               = (lucIsosurface*)drawingObject;
+	FieldVariable*         isosurfaceField;
+	FieldVariable*         colourField;
+	FieldVariable*         maskField;
+	lucColourMap*          colourMap;
+	Index                  defaultResolution;
+	IJK                    resolution;
+	double                 isovalue;
+	lucDrawingObjectMask   mask;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	isosurfaceField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"IsosurfaceField", FieldVariable, True, data  );
+	colourMap       = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
+	colourField     = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourField", FieldVariable, False, data  );
+	maskField       = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaskField", FieldVariable, False, data  );
+
+	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 64  );
+	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
+	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
+	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
+
+	lucDrawingObjectMask_Construct( &mask, self->name, cf, data );
+
+	isovalue = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"isovalue", 0.0  );
+	
+	_lucIsosurface_Init( 
+			self, 
+			isosurfaceField,
+			isovalue,
+			resolution,
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawWalls", False  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"wireframe", False  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFrontFace", False  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullBackFace", False  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "White"  ),
+			colourMap,
+			colourField,
+			maskField,
+			&mask );
+}
+
+void _lucIsosurface_Build( void* drawingObject, void* data ) {}
+void _lucIsosurface_Initialise( void* drawingObject, void* data ) {}
+void _lucIsosurface_Execute( void* drawingObject, void* data ) {}
+void _lucIsosurface_Destroy( void* drawingObject, void* data ) {}
+
+void _lucIsosurface_Setup( void* drawingObject, void* _context ) {
+	lucIsosurface*           self            = (lucIsosurface*)drawingObject;
+	DomainContext*   context         = (DomainContext*) _context;
+	FieldVariable*           isosurfaceField = self->isosurfaceField;
+	int                      i, j, k;
+	int                      nx, ny, nz;
+	double                   dx, dy, dz;
+	Vertex***                vertex;
+	Coord                    pos;
+	Coord                    min;
+	Coord                    max;
+	Dimension_Index          dim             = context->dim;
+
+	lucOpenGLDrawingObject_SyncShadowValues( self, self->isosurfaceField );
+
+	/* Initialise Variables */
+	self->triangleCount = 0;
+	nx = self->resolution[ I_AXIS ];
+	ny = self->resolution[ J_AXIS ];
+	nz = self->resolution[ K_AXIS ];
+	
+	FieldVariable_GetMinAndMaxLocalCoords( isosurfaceField, min, max );
+	dx = (max[0] - min[0])/((double) nx - 1);
+	dy = (max[1] - min[1])/((double) ny - 1);
+	dz = (max[2] - min[2])/((double) nz - 1);
+	if (dim == 2) {
+		dz = 0.0;
+		nz = 1;
+	}
+	
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	vertex = Memory_Alloc_3DArray( Vertex , nx, ny, nz , (Name)"Vertex array" );
+
+	/* Sample Field in in regular grid */
+	for ( i = 0 ; i < nx ; i++ ) {
+		for ( j = 0 ; j < ny ; j++ ) {
+			for ( k = 0 ; k < nz ; k++ ) {
+				pos[ I_AXIS ] = min[ I_AXIS ] + dx * (double) i;
+				pos[ J_AXIS ] = min[ J_AXIS ] + dy * (double) j;
+				pos[ K_AXIS ] = min[ K_AXIS ] + dz * (double ) k;
+
+				memcpy( vertex[i][j][k].pos, pos, 3 * sizeof(double) );
+				
+				if ( i == 0 )
+					pos[ I_AXIS ] = min[ I_AXIS ] + 0.001 * dx; 
+				if ( j == 0 )
+					pos[ J_AXIS ] = min[ J_AXIS ] + 0.001 * dy; 
+				if ( k == 0 )
+					pos[ K_AXIS ] = min[ K_AXIS ] + 0.001 * dz; 
+				if ( i == nx - 1 )
+					pos[ I_AXIS ] = max[ I_AXIS ] - 0.001 * dx;
+				if ( j == ny - 1 )
+					pos[ J_AXIS ] = max[ J_AXIS ] - 0.001 * dy;
+				if ( k == nz - 1 )
+					pos[ K_AXIS ] = max[ K_AXIS ] - 0.001 * dz;
+				FieldVariable_InterpolateValueAt( isosurfaceField, pos, &vertex[i][j][k].value );
+			}
+		}
+	}
+	if (dim == 3) {
+		/* Find normals */
+		lucIsosurface_Normals( self, vertex );
+		
+		/* Find Surface with Marching Cubes */
+		lucIsosurface_MarchingCubes( self, vertex );
+	}
+	if (dim == 2 || self->drawWalls)
+		lucIsosurface_DrawWalls( self, vertex );
+
+	/* Free memory */
+	Memory_Free( vertex );
+
+	/* Call parents setup function */
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+
+
+
+	#define lucIsosurface_GetColourForPos( self, pos, min, max, fudgeFactor ) \
+		do { \
+			double          __value; \
+			Coord           __interpolationPos; \
+			if ( self->colourField && self->colourMap ) { \
+				memcpy( __interpolationPos, pos, sizeof(Coord) ); \
+				if ( __interpolationPos[ I_AXIS ] >= max[ I_AXIS ] ) \
+					__interpolationPos[ I_AXIS ] = max[ I_AXIS ] - fudgeFactor[ I_AXIS ]; \
+				if ( __interpolationPos[ J_AXIS ] >= max[ J_AXIS ] ) \
+					__interpolationPos[ J_AXIS ] = max[ J_AXIS ] - fudgeFactor[ J_AXIS ]; \
+				if ( __interpolationPos[ K_AXIS ] >= max[ K_AXIS ] ) \
+					__interpolationPos[ K_AXIS ] = max[ K_AXIS ] - fudgeFactor[ K_AXIS ]; \
+				FieldVariable_InterpolateValueAt( self->colourField, __interpolationPos, &__value ); \
+				lucColourMap_SetOpenGLColourFromValue( self->colourMap, __value ); \
+			} \
+		} while (0)
+	
+void _lucIsosurface_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucIsosurface*           self          = (lucIsosurface*)drawingObject;
+	FieldVariable*           colourField   = self->colourField;
+	lucColourMap*            colourMap     = self->colourMap;
+	Coord                    min;
+	Coord                    max;
+	XYZ                      fudgeFactor   = { 0.0, 0.0, 0.0 };
+	Index                    dof_I;
+
+	lucOpenGLDrawingObject_SyncShadowValues( self, self->isosurfaceField );
+	lucOpenGLDrawingObject_SyncShadowValues( self, colourField );
+	lucOpenGLDrawingObject_SyncShadowValues( self, self->maskField );
+
+	/* Calibrate Colour Map using Colour Variable */
+	if ( colourMap && colourField ) {
+		lucColourMap_CalibrateFromFieldVariable( colourMap, colourField );
+		FieldVariable_GetMinAndMaxGlobalCoords( colourField, min, max );
+		for ( dof_I = 0 ; dof_I < 3 ; dof_I++ )
+			fudgeFactor[ dof_I ] = 0.001 * (max[ dof_I ] - min[ dof_I ]);
+		FieldVariable_GetMinAndMaxLocalCoords( colourField, min, max );
+	}
+	else if ( colourMap ) 
+		lucColourMap_CalibrateFromFieldVariable( colourMap, self->isosurfaceField );	
+	glEnable(GL_LIGHTING);
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucIsosurface_CleanUp( void* drawingObject, void* _context ) {
+	lucIsosurface*            self            = (lucIsosurface*) drawingObject;
+	
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+
+void _lucIsosurface_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucIsosurface*           self          = (lucIsosurface*)drawingObject;
+	FieldVariable*           colourField   = self->colourField;
+	FieldVariable*           maskField     = self->maskField;
+	Surface_Triangle*        triangleList  = self->triangleList;
+	Surface_Triangle*        currentTriangle;
+	Index                    triangle_I;
+	Index                    triangleCount = self->triangleCount;
+	lucColourMap*            colourMap     = self->colourMap;
+	Coord                    min;
+	Coord                    max;
+	XYZ                      fudgeFactor   = { 0.0, 0.0, 0.0 };
+	Index                    dof_I;
+
+	lucOpenGLDrawingObject_SyncShadowValues( self, self->isosurfaceField );
+	lucOpenGLDrawingObject_SyncShadowValues( self, colourField );
+	lucOpenGLDrawingObject_SyncShadowValues( self, maskField );
+
+	/* Give option to draw surface as wireframe */
+	if (self->wireframe) 
+		glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
+	else 
+		glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );	
+
+	/* Set up Face Culling */
+	if (self->cullBackFace) {
+		if (self->cullFrontFace) 
+			glCullFace( GL_FRONT_AND_BACK );
+		else 
+			glCullFace( GL_BACK );
+		glEnable( GL_CULL_FACE );
+	}
+	else if( self->cullFrontFace ) {
+		glCullFace( GL_FRONT );
+		glEnable( GL_CULL_FACE );
+	}
+
+	/* Calibrate Colour Map using Colour Variable */
+	if ( colourMap && colourField ) {
+		lucColourMap_CalibrateFromFieldVariable( colourMap, colourField );
+		FieldVariable_GetMinAndMaxGlobalCoords( colourField, min, max );
+		for ( dof_I = 0 ; dof_I < 3 ; dof_I++ )
+			fudgeFactor[ dof_I ] = 0.001 * (max[ dof_I ] - min[ dof_I ]);
+		FieldVariable_GetMinAndMaxLocalCoords( colourField, min, max );
+	}
+	else if ( colourMap ) 
+		lucColourMap_CalibrateFromFieldVariable( colourMap, self->isosurfaceField );
+
+
+	glFrontFace(GL_CW);
+	glBegin(GL_TRIANGLES);
+
+	if ( ! self->colourMap || ! colourField ) {
+		lucColour_SetOpenGLColour( &self->colour );
+	}
+	else if ( !colourField ) {
+		lucColourMap_SetOpenGLColourFromValue( colourMap, self->isovalue );
+	}
+	
+	for( triangle_I = 0 ; triangle_I < triangleCount ; triangle_I++) {
+		currentTriangle = (Surface_Triangle*) &triangleList[triangle_I];
+
+		/* Test for masked triangle */
+		if ( maskField != NULL ) {
+			if (lucIsosurface_TestMask( self, currentTriangle->pos1 ) == False) continue;
+			if (lucIsosurface_TestMask( self, currentTriangle->pos2 ) == False) continue;
+			if (lucIsosurface_TestMask( self, currentTriangle->pos3 ) == False) continue;
+		}
+
+		/* Plot First Vertex */
+		lucIsosurface_GetColourForPos( self, currentTriangle->pos1, min, max, fudgeFactor );
+		glNormal3dv(currentTriangle->normal1);
+		glVertex3dv(currentTriangle->pos1);
+		
+		/* Plot Second Vertex */
+		lucIsosurface_GetColourForPos( self, currentTriangle->pos3, min, max, fudgeFactor );
+		glNormal3dv(currentTriangle->normal3);
+		glVertex3dv(currentTriangle->pos3);	
+		
+		/* Plot Third Vertex */
+		lucIsosurface_GetColourForPos( self, currentTriangle->pos2, min, max, fudgeFactor );
+		glNormal3dv(currentTriangle->normal2);
+		glVertex3dv(currentTriangle->pos2);
+	}
+	glEnd();
+}
+
+Bool lucIsosurface_TestMask( lucIsosurface* self, Coord pos ) {
+	double value;
+
+	FieldVariable_InterpolateValueAt( self->maskField, pos, &value );
+
+	return lucDrawingObjectMask_Test( &self->mask, value );
+}
+
+/*
+   Given a grid cell and an isolevel, calculate the triangular
+   facets required to represent the isosurface through the cell.
+   Return the number of triangular facets, the array "triangleList"
+   will be loaded up with the vertices at most 5 triangular facets.
+	0 will be returned if the grid cell is either totally above
+   of totally below the isolevel.
+*/
+
+void VertexInterp(double isolevel, Vertex* point, Vertex* vertex1, Vertex* vertex2 ) ;
+double getQuadraticDerive(double y1, double y2, double y3, double x1, double x2, double x3) ;
+
+/* This algorithm for constructing an isosurface is taken from:
+Lorensen, William and Harvey E. Cline. Marching Cubes: A High Resolution 3D Surface Construction Algorithm. Computer Graphics (SIGGRAPH 87 Proceedings) 21(4) July 1987, p. 163-170) http://www.cs.duke.edu/education/courses/fall01/cps124/resources/p163-lorensen.pdf 
+The lookup table is taken from http://astronomy.swin.edu.au/~pbourke/modelling/polygonise/ 
+*/
+void lucIsosurface_MarchingCubes( lucIsosurface* self, Vertex*** vertex ) {
+	double isolevel = self->isovalue;
+	int i,j,k,n;
+	int triangleCount = 0;
+	int nx = self->resolution[ I_AXIS ];
+	int ny = self->resolution[ J_AXIS ];
+	int nz = self->resolution[ K_AXIS ];
+	int cubeindex;
+	Vertex points[12];
+
+int edgeTable[256]={
+0x0  , 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c,
+0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00,
+0x190, 0x99 , 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c,
+0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90,
+0x230, 0x339, 0x33 , 0x13a, 0x636, 0x73f, 0x435, 0x53c,
+0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30,
+0x3a0, 0x2a9, 0x1a3, 0xaa , 0x7a6, 0x6af, 0x5a5, 0x4ac,
+0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0,
+0x460, 0x569, 0x663, 0x76a, 0x66 , 0x16f, 0x265, 0x36c,
+0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60,
+0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff , 0x3f5, 0x2fc,
+0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0,
+0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55 , 0x15c,
+0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950,
+0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc ,
+0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0,
+0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc,
+0xcc , 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0,
+0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c,
+0x15c, 0x55 , 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650,
+0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc,
+0x2fc, 0x3f5, 0xff , 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0,
+0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c,
+0x36c, 0x265, 0x16f, 0x66 , 0x76a, 0x663, 0x569, 0x460,
+0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac,
+0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa , 0x1a3, 0x2a9, 0x3a0,
+0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c,
+0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33 , 0x339, 0x230,
+0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c,
+0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99 , 0x190,
+0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c,
+0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0   };
+int triTable[256][16] =
+{{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1},
+{3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1},
+{3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1},
+{3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1},
+{9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1},
+{9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
+{2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1},
+{8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1},
+{9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
+{4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1},
+{3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1},
+{1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1},
+{4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1},
+{4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1},
+{9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
+{5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1},
+{2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1},
+{9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
+{0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
+{2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1},
+{10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1},
+{4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1},
+{5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1},
+{5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1},
+{9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1},
+{0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1},
+{1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1},
+{10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1},
+{8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1},
+{2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1},
+{7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1},
+{9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1},
+{2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1},
+{11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1},
+{9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1},
+{5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1},
+{11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1},
+{11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
+{1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1},
+{9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1},
+{5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1},
+{2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
+{0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
+{5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1},
+{6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1},
+{3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1},
+{6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1},
+{5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1},
+{1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
+{10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1},
+{6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1},
+{8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1},
+{7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1},
+{3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
+{5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1},
+{0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1},
+{9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1},
+{8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1},
+{5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1},
+{0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1},
+{6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1},
+{10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1},
+{10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1},
+{8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1},
+{1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1},
+{3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1},
+{0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1},
+{10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1},
+{3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1},
+{6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1},
+{9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1},
+{8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1},
+{3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1},
+{6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1},
+{0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1},
+{10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1},
+{10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1},
+{2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1},
+{7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1},
+{7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1},
+{2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1},
+{1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1},
+{11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1},
+{8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1},
+{0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1},
+{7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
+{10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
+{2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
+{6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1},
+{7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1},
+{2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1},
+{1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1},
+{10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1},
+{10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1},
+{0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1},
+{7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1},
+{6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1},
+{8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1},
+{9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1},
+{6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1},
+{4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1},
+{10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1},
+{8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1},
+{0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1},
+{1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1},
+{8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1},
+{10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1},
+{4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1},
+{10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
+{5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
+{11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1},
+{9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
+{6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1},
+{7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1},
+{3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1},
+{7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1},
+{9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1},
+{3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1},
+{6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1},
+{9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1},
+{1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1},
+{4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1},
+{7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1},
+{6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1},
+{3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1},
+{0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1},
+{6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1},
+{0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1},
+{11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1},
+{6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1},
+{5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1},
+{9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1},
+{1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1},
+{1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1},
+{10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1},
+{0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1},
+{5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1},
+{10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1},
+{11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1},
+{9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1},
+{7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1},
+{2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1},
+{8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1},
+{9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1},
+{9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1},
+{1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1},
+{9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1},
+{9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1},
+{5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1},
+{0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1},
+{10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1},
+{2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1},
+{0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1},
+{0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1},
+{9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1},
+{5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1},
+{3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1},
+{5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1},
+{8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1},
+{0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1},
+{9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1},
+{0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1},
+{1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1},
+{3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1},
+{4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1},
+{9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1},
+{11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1},
+{11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1},
+{2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1},
+{9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1},
+{3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1},
+{1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1},
+{4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1},
+{4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1},
+{0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1},
+{3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1},
+{3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1},
+{0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1},
+{9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1},
+{1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}};
+
+
+	for ( i = 0 ; i < nx - 1  ; i++ ) {
+		for ( j = 0 ; j < ny - 1 ; j++ ) {
+			for ( k = 0 ; k < nz - 1 ; k++ ) {
+				/* Determine the index into the edge table which tells us which vertices are inside of the surface */
+				cubeindex = 0;
+				if (vertex[i][j][k].value       < isolevel) cubeindex |= 1;	
+				if (vertex[i+1][j][k].value     < isolevel) cubeindex |= 2;
+				if (vertex[i+1][j][k+1].value   < isolevel) cubeindex |= 4;
+				if (vertex[i][j][k+1].value     < isolevel) cubeindex |= 8;
+				if (vertex[i][j+1][k].value     < isolevel) cubeindex |= 16;
+				if (vertex[i+1][j+1][k].value   < isolevel) cubeindex |= 32;
+				if (vertex[i+1][j+1][k+1].value < isolevel) cubeindex |= 64;
+				if (vertex[i][j+1][k+1].value   < isolevel) cubeindex |= 128;
+				
+				/* Cube is entirely in/out of the surface */
+				if (edgeTable[cubeindex] == 0) continue;
+					
+				/* Find the vertices where the surface intersects the cube */
+				if (edgeTable[cubeindex] & 1)
+					VertexInterp(isolevel, &points[0], &vertex[i][j][k] , &vertex[i+1][j][k]);
+				if (edgeTable[cubeindex] & 2)
+					VertexInterp(isolevel, &points[1], &vertex[i+1][j][k] , &vertex[i+1][j][k+1] );
+				if (edgeTable[cubeindex] & 4)
+					VertexInterp(isolevel, &points[2], &vertex[i+1][j][k+1] , &vertex[i][j][k+1] );
+				if (edgeTable[cubeindex] & 8)
+					VertexInterp(isolevel, &points[3], &vertex[i][j][k+1] , &vertex[i][j][k] );
+				if (edgeTable[cubeindex] & 16)
+					VertexInterp(isolevel, &points[4], &vertex[i][j+1][k] , &vertex[i+1][j+1][k] );
+				if (edgeTable[cubeindex] & 32)
+					VertexInterp(isolevel, &points[5], &vertex[i+1][j+1][k] , &vertex[i+1][j+1][k+1] );
+				if (edgeTable[cubeindex] & 64)
+					VertexInterp(isolevel, &points[6], &vertex[i+1][j+1][k+1] , &vertex[i][j+1][k+1] );
+				if (edgeTable[cubeindex] & 128)
+					VertexInterp(isolevel, &points[7], &vertex[i][j+1][k+1] , &vertex[i][j+1][k] );
+				if (edgeTable[cubeindex] & 256)
+					VertexInterp(isolevel, &points[8], &vertex[i][j][k] , &vertex[i][j+1][k] );
+				if (edgeTable[cubeindex] & 512)
+					VertexInterp(isolevel, &points[9], &vertex[i+1][j][k] , &vertex[i+1][j+1][k] );
+				if (edgeTable[cubeindex] & 1024)
+					VertexInterp(isolevel, &points[10], &vertex[i+1][j][k+1] , &vertex[i+1][j+1][k+1] );
+				if (edgeTable[cubeindex] & 2048)
+					VertexInterp(isolevel, &points[11], &vertex[i][j][k+1] , &vertex[i][j+1][k+1] );
+
+				/* Create the triangle */
+				for ( n = 0 ; triTable[cubeindex][n] != -1 ; n += 3 ) {
+					if (triangleCount > self->trianglesAlloced - 1 ) {
+						self->trianglesAlloced = self->trianglesAlloced + 100;
+						self->triangleList = Memory_Realloc_Array( self->triangleList, Surface_Triangle, self->trianglesAlloced );
+					}
+					/* Get positions */
+					memcpy( self->triangleList[triangleCount].pos1 , points[ triTable[cubeindex][n  ] ].pos , 3 * sizeof(double) );
+					memcpy( self->triangleList[triangleCount].pos2 , points[ triTable[cubeindex][n+1] ].pos , 3 * sizeof(double) );
+					memcpy( self->triangleList[triangleCount].pos3 , points[ triTable[cubeindex][n+2] ].pos , 3 * sizeof(double) );
+
+					/* Get Normals */
+					memcpy( self->triangleList[triangleCount].normal1 , points[ triTable[cubeindex][n  ] ].normal , 3 * sizeof(double) );
+					memcpy( self->triangleList[triangleCount].normal2 , points[ triTable[cubeindex][n+1] ].normal , 3 * sizeof(double) );
+					memcpy( self->triangleList[triangleCount].normal3 , points[ triTable[cubeindex][n+2] ].normal , 3 * sizeof(double) );
+
+					triangleCount++;
+				}
+			}
+		}
+	}
+	self->triangleCount = triangleCount;
+}
+
+/*
+   Linearly interpolate the position where an isosurface cuts
+   an edge between two vertices, each with their own scalar value
+*/
+void VertexInterp(double isolevel, Vertex* point, Vertex* vertex1, Vertex* vertex2 ) {
+	double mu;
+
+	if (fabs(isolevel - vertex1->value) < 0.00001) {
+		memcpy( point, vertex1, sizeof(Vertex) );
+		return;
+	}
+	if (fabs(isolevel - vertex2->value) < 0.00001) {
+		memcpy( point, vertex2, sizeof(Vertex) );
+		return;
+	}
+	if (fabs(vertex1->value - vertex2->value) < 0.00001) {
+		memcpy( point, vertex1, sizeof(Vertex) );
+		return;
+	}
+		
+	mu = (isolevel - vertex1->value) / (vertex2->value - vertex1->value);
+	
+	point->pos[0] = vertex1->pos[0] + mu * (vertex2->pos[0] - vertex1->pos[0]);
+	point->pos[1] = vertex1->pos[1] + mu * (vertex2->pos[1] - vertex1->pos[1]);
+	point->pos[2] = vertex1->pos[2] + mu * (vertex2->pos[2] - vertex1->pos[2]);
+
+	point->normal[0] = vertex1->normal[0] + mu * (vertex2->normal[0] - vertex1->normal[0]);
+	point->normal[1] = vertex1->normal[1] + mu * (vertex2->normal[1] - vertex1->normal[1]);
+	point->normal[2] = vertex1->normal[2] + mu * (vertex2->normal[2] - vertex1->normal[2]);
+}
+
+void lucIsosurface_Normals( lucIsosurface* self, Vertex*** vertex ) {
+	int i, j, k;
+	int nx = self->resolution[ I_AXIS ];
+	int ny = self->resolution[ J_AXIS ];
+	int nz = self->resolution[ K_AXIS ];
+
+	for ( i = 0 ; i < nx ; i++ ) {
+		for ( j = 0 ; j < ny ; j++ ) {
+			for ( k = 0 ; k < nz ; k++ ) {
+				/* Set up component in x direction */
+				if (i == 0) {
+					vertex[i][j][k].normal[0] = (vertex[i+1][j][k].value - vertex[i][j][k].value) / 
+									(vertex[i+1][j][k].pos[0] - vertex[i][j][k].pos[0] ) ;
+				}
+				else if (i == nx - 1)  {
+					vertex[i][j][k].normal[0] = (vertex[i][j][k].value - vertex[i-1][j][k].value) / 
+									(vertex[i][j][k].pos[0] - vertex[i-1][j][k].pos[0] ) ;
+				}
+				else {	
+					vertex[i][j][k].normal[0] = getQuadraticDerive(	
+					                              vertex[i-1][j][k].value, vertex[i][j][k].value, vertex[i+1][j][k].value,
+					                              vertex[i-1][j][k].pos[0], vertex[i][j][k].pos[0], vertex[i+1][j][k].pos[0]);
+				}
+				
+				/* Set up component in y direction */
+				if (j == 0) {
+					vertex[i][j][k].normal[1] = (vertex[i][j+1][k].value - vertex[i][j][k].value) / 
+									(vertex[i][j+1][k].pos[1] - vertex[i][j][k].pos[1] ) ;
+				}
+				else if (j == ny - 1)  {
+					vertex[i][j][k].normal[1] = (vertex[i][j][k].value - vertex[i][j-1][k].value) / 
+									(vertex[i][j][k].pos[1] - vertex[i][j-1][k].pos[1] ) ;
+				}
+				else {	
+					vertex[i][j][k].normal[1] = getQuadraticDerive(	
+					                              vertex[i][j-1][k].value, vertex[i][j][k].value, vertex[i][j+1][k].value,
+					                              vertex[i][j-1][k].pos[1], vertex[i][j][k].pos[1], vertex[i][j+1][k].pos[1]);
+				}			
+				
+				/* Set up component in z direction */
+				if (k == 0) {
+					vertex[i][j][k].normal[2] = (vertex[i][j][k+1].value - vertex[i][j][k].value) / 
+									(vertex[i][j][k+1].pos[2] - vertex[i][j][k].pos[2] ) ;
+				}
+				else if (k == nz - 1)  {
+					vertex[i][j][k].normal[2] = (vertex[i][j][k].value - vertex[i][j][k-1].value) / 
+									(vertex[i][j][k].pos[2] - vertex[i][j][k-1].pos[2] ) ;
+				}
+				else {	
+					vertex[i][j][k].normal[2] = getQuadraticDerive(	
+					                              vertex[i][j][k-1].value, vertex[i][j][k].value, vertex[i][j][k+1].value,
+					                              vertex[i][j][k-1].pos[2], vertex[i][j][k].pos[2], vertex[i][j][k+1].pos[2]);
+				}														
+				StGermain_VectorNormalise(vertex[i][j][k].normal, 3);	
+			}
+		}
+	}
+}
+
+double getQuadraticDerive(double y1, double y2, double y3, double x1, double x2, double x3) {
+	double dy12, dy32;
+	double dx12sq, dx32sq, dx12, dx32;
+	double a, b;
+	double result;
+
+	if (fabs(y2 - y1) < 0.0001 && fabs(y3 - y1) < 0.0001) {
+		return 0.0;
+	}
+	//  Get the problem variables
+	dy12 = y1-y2;
+	dy32 = y3-y2;
+	dx12 = x1-x2;
+	dx32 = x3-x2;
+	dx12sq = (x1*x1)-(x2*x2);
+	dx32sq = (x3*x3)-(x2*x2);
+	
+	//  Get a
+	a = dx12 * dy32 / dx32;
+	a -= dy12;
+	a /= ((dx32sq/dx32) + dx12sq);
+	
+	//  Get b
+	b = dy32;
+	b -= a * dx32sq;
+	b /= dx32;
+	
+	//  Now get the derivative
+	result = 2*a*x2 + b;
+	
+	return result;
+}
+
+
+#define gLucifer_CW	0
+#define gLucifer_CCW	1
+
+#define LEFT_BOTTOM     0
+#define RIGHT_BOTTOM    1
+#define LEFT_TOP        2
+#define RIGHT_TOP       3
+#define LEFT            4
+#define RIGHT           5
+#define TOP	            6
+#define BOTTOM          7
+
+void lucIsosurface_DrawWalls( lucIsosurface* self, Vertex ***array ) {
+	int nx = self->resolution[ I_AXIS ];
+	int ny = self->resolution[ J_AXIS ];
+	int nz = self->resolution[ K_AXIS ];
+	int i, j, k;
+	Vertex ** points;
+	Vertex * midVertices;
+	char order;
+
+	/* Allocate Memory */
+	points = Memory_Alloc_Array( Vertex* , 8, "array for marching squares");
+	midVertices = Memory_Alloc_Array( Vertex , 4, "array for marching squares");
+	points[LEFT] = &midVertices[0];
+	points[RIGHT] = &midVertices[1];
+	points[TOP] = &midVertices[2];
+	points[BOTTOM] = &midVertices[3];
+	
+	for ( i = 0 ; i < nx - 1 ; i++ ) {
+		for ( j = 0 ; j < ny - 1 ; j++ ) {
+			k = 0;
+			order = gLucifer_CCW;
+			lucIsosurface_SetupPointsZ( points, array, i, j, k );
+			lucIsosurface_WallElement( self, points, order, K_AXIS );
+
+			k = nz - 1;
+			order = gLucifer_CW;
+			lucIsosurface_SetupPointsZ( points, array, i, j, k );
+			lucIsosurface_WallElement( self, points, order, K_AXIS );
+		}
+	}
+	for ( k = 0 ; k < nz - 1 ; k++ ) {
+		for ( j = 0 ; j < ny - 1 ; j++ ) {
+			i = 0;
+			order = gLucifer_CW;
+			lucIsosurface_SetupPointsX( points, array, i, j, k );
+			lucIsosurface_WallElement( self, points, order, I_AXIS );
+
+			i = nx - 1;
+			order = gLucifer_CCW;
+			lucIsosurface_SetupPointsX( points, array, i, j, k );
+			lucIsosurface_WallElement( self, points, order, I_AXIS );
+
+		}
+	}
+	for ( i = 0 ; i < nx - 1 ; i++ ) {
+		for ( k = 0 ; k < nz - 1 ; k++ ) {
+			j = 0;
+			order = gLucifer_CW;
+			lucIsosurface_SetupPointsY( points, array, i, j, k );
+			lucIsosurface_WallElement( self, points, order, J_AXIS );
+
+			j = ny - 1;
+			order = gLucifer_CCW;
+			lucIsosurface_SetupPointsY( points, array, i, j, k );
+			lucIsosurface_WallElement( self, points, order, J_AXIS );
+		}
+	}
+	Memory_Free( points );
+	Memory_Free( midVertices );
+}
+
+void lucIsosurface_SetupPointsX( Vertex** points, Vertex*** array, Index i, Index j, Index k ){
+	points[LEFT_BOTTOM]  = &array[i][ j ][ k ];
+	points[RIGHT_BOTTOM] = &array[i][j+1][ k ];
+	points[LEFT_TOP]     = &array[i][ j ][k+1];
+	points[RIGHT_TOP]    = &array[i][j+1][k+1];
+}
+
+void lucIsosurface_SetupPointsY( Vertex** points, Vertex*** array, Index i, Index j, Index k ){
+	points[LEFT_BOTTOM]  = &array[ i ][j][ k ];
+	points[RIGHT_BOTTOM] = &array[i+1][j][ k ];
+	points[LEFT_TOP]     = &array[ i ][j][k+1];
+	points[RIGHT_TOP]    = &array[i+1][j][k+1];
+}
+
+void lucIsosurface_SetupPointsZ( Vertex** points, Vertex*** array, Index i, Index j, Index k ){
+	points[LEFT_BOTTOM]  = &array[ i ][ j ][k];
+	points[RIGHT_BOTTOM] = &array[i+1][ j ][k];
+	points[LEFT_TOP]     = &array[ i ][j+1][k];
+	points[RIGHT_TOP]    = &array[i+1][j+1][k];
+}
+
+void lucIsosurface_WallElement( lucIsosurface* self, Vertex** points, char order, Dimension_Index axis ) {
+	double value  = self->isovalue;
+	char   cubeType = 0;
+
+	/* find cube type */
+	if (points[LEFT_BOTTOM]->value  > value) cubeType += 1;
+	if (points[RIGHT_BOTTOM]->value > value) cubeType += 2;
+	if (points[LEFT_TOP]->value     > value) cubeType += 4;
+	if (points[RIGHT_TOP]->value    > value) cubeType += 8;
+
+	/* Create Points */
+	lucIsosurface_CreateIntermediatePoints( self, points, axis );
+	
+	lucIsosurface_MarchingRectangles( self, points, cubeType, order );
+}	
+
+void lucIsosurface_AddWallTriangle( lucIsosurface* self, int a , int b, int c, Vertex** points, char order) {
+	int n = self->triangleCount;
+	if ( n > self->trianglesAlloced - 1 ) {
+		self->trianglesAlloced = self->trianglesAlloced + 100;
+		self->triangleList = Memory_Realloc_Array( self->triangleList, Surface_Triangle, self->trianglesAlloced );
+	}
+	
+	if (order == gLucifer_CCW) {
+		memcpy( self->triangleList[n].pos1, points[a]->pos, 3*sizeof(double) );
+		memcpy( self->triangleList[n].pos2, points[c]->pos, 3*sizeof(double) );
+		memcpy( self->triangleList[n].pos3, points[b]->pos, 3*sizeof(double) );
+	}
+	else {
+		memcpy( self->triangleList[n].pos1, points[a]->pos, 3*sizeof(double) );
+		memcpy( self->triangleList[n].pos2, points[b]->pos, 3*sizeof(double) );
+		memcpy( self->triangleList[n].pos3, points[c]->pos, 3*sizeof(double) );
+	}
+
+	/* Calculate Normal */
+	StGermain_NormalToPlane( self->triangleList[n].normal1 , 
+		self->triangleList[n].pos1, self->triangleList[n].pos2, self->triangleList[n].pos3 );
+
+	memcpy( self->triangleList[n].normal2, self->triangleList[n].normal1 , 3 * sizeof(double) );
+	memcpy( self->triangleList[n].normal3, self->triangleList[n].normal1 , 3 * sizeof(double) );
+	self->triangleCount++;
+	
+}
+
+void lucIsosurface_CreateIntermediatePoints( lucIsosurface* self, Vertex **points, Dimension_Index axis ) {
+	double value = self->isovalue;
+	Dimension_Index A = ( axis == I_AXIS ? J_AXIS : I_AXIS );
+	Dimension_Index B = ( axis == K_AXIS ? J_AXIS : K_AXIS );
+	double dA = points[RIGHT_TOP]->pos[A] - points[LEFT_BOTTOM]->pos[A];
+	double dB = points[RIGHT_TOP]->pos[B] - points[LEFT_BOTTOM]->pos[B];
+
+	memcpy( points[ LEFT ]->pos, points[ LEFT_BOTTOM ]->pos, 3*sizeof(double) );
+	points[ LEFT ]->pos[B] += dB * (value - points[LEFT_BOTTOM]->value) 
+				/ (points[LEFT_TOP]->value - points[LEFT_BOTTOM]->value ) ;
+	
+	memcpy( points[ RIGHT ]->pos, points[ RIGHT_BOTTOM ]->pos, 3*sizeof(double) );
+	points[ RIGHT ]->pos[B] += dB * (value - points[RIGHT_BOTTOM]->value) 
+				/ (points[RIGHT_TOP]->value - points[RIGHT_BOTTOM]->value ) ;
+	
+	memcpy( points[ BOTTOM ]->pos, points[ LEFT_BOTTOM ]->pos, 3*sizeof(double) );
+	points[ BOTTOM ]->pos[A] += dA * (value - points[LEFT_BOTTOM]->value) 
+				/ (points[RIGHT_BOTTOM]->value - points[LEFT_BOTTOM]->value ) ;
+	
+	memcpy( points[ TOP ]->pos, points[ LEFT_TOP ]->pos, 3*sizeof(double) );
+	points[ TOP ]->pos[A] += dA * (value - points[LEFT_TOP]->value) 
+				/ (points[RIGHT_TOP]->value - points[LEFT_TOP]->value ) ;
+}		
+
+void lucIsosurface_MarchingRectangles( lucIsosurface* self, Vertex** points, char cubeType, char order) {
+	switch (cubeType) {
+		case 0:
+			/*  @@  */
+			/*  @@  */
+			break;
+		case 1:		
+			/*  @@  */
+			/*  #@  */
+			lucIsosurface_AddWallTriangle( self, LEFT_BOTTOM , LEFT, BOTTOM, points, order);
+			break;
+		case 2:
+			/*  @@  */
+			/*  @#  */	
+			lucIsosurface_AddWallTriangle(self, BOTTOM , RIGHT, RIGHT_BOTTOM, points, order);
+			break;
+		case 3:
+			/*  @@  */
+			/*  ##  */	
+			lucIsosurface_AddWallTriangle( self, LEFT_BOTTOM , LEFT, RIGHT, points, order);
+			lucIsosurface_AddWallTriangle(self, LEFT_BOTTOM , RIGHT, RIGHT_BOTTOM, points, order);
+			break;
+		case 4:
+			/*  #@  */
+			/*  @@  */
+			lucIsosurface_AddWallTriangle(self, LEFT_TOP , TOP, LEFT, points, order);
+			break;
+		case 5:
+			/*  #@  */
+			/*  #@  */
+			lucIsosurface_AddWallTriangle(self, LEFT_TOP , TOP, LEFT_BOTTOM, points, order);
+			lucIsosurface_AddWallTriangle(self, TOP , BOTTOM, LEFT_BOTTOM, points, order);
+			break;
+		case 6:
+			/*  #@  */
+			/*  @#  */
+			lucIsosurface_AddWallTriangle(self, LEFT_TOP , TOP, LEFT, points, order);
+			lucIsosurface_AddWallTriangle(self, BOTTOM , RIGHT, RIGHT_BOTTOM, points, order);
+			break;
+		case 7:
+			/*  #@  */
+			/*  ##  */
+			lucIsosurface_AddWallTriangle(self, RIGHT , RIGHT_BOTTOM, TOP, points, order);
+			lucIsosurface_AddWallTriangle(self, TOP , RIGHT_BOTTOM, LEFT_TOP, points, order);
+			lucIsosurface_AddWallTriangle(self, LEFT_TOP , RIGHT_BOTTOM, LEFT_BOTTOM, points, order);
+			break;
+		case 8:
+			/*  @#  */
+			/*  @@  */
+			lucIsosurface_AddWallTriangle(self, TOP , RIGHT_TOP, RIGHT, points, order);
+			break;
+		case 9:
+			/*  @#  */
+			/*  #@  */
+			lucIsosurface_AddWallTriangle(self, TOP , RIGHT_TOP, RIGHT, points, order);
+			lucIsosurface_AddWallTriangle(self, LEFT_BOTTOM , LEFT, BOTTOM, points, order);
+			break;
+		case 10:
+			/*  @#  */
+			/*  @#  */
+			lucIsosurface_AddWallTriangle(self, TOP , RIGHT_TOP, RIGHT_BOTTOM, points, order);
+			lucIsosurface_AddWallTriangle(self, BOTTOM , TOP, RIGHT_BOTTOM, points, order);
+			
+			break;
+		case 11:
+			/*  @#  */
+			/*  ##  */
+			lucIsosurface_AddWallTriangle(self, TOP , LEFT_BOTTOM, LEFT, points, order);
+			lucIsosurface_AddWallTriangle(self, RIGHT_TOP , LEFT_BOTTOM, TOP, points, order);
+			lucIsosurface_AddWallTriangle(self, RIGHT_BOTTOM , LEFT_BOTTOM, RIGHT_TOP, points, order);
+			break;
+		case 12:
+			/*  ##  */
+			/*  @@  */
+			lucIsosurface_AddWallTriangle(self, LEFT , LEFT_TOP, RIGHT, points, order);
+			lucIsosurface_AddWallTriangle(self, RIGHT , LEFT_TOP, RIGHT_TOP, points, order);
+			break;
+		case 13:
+			/*  ##  */
+			/*  #@  */
+			lucIsosurface_AddWallTriangle(self, BOTTOM , RIGHT_TOP, RIGHT, points, order);
+			lucIsosurface_AddWallTriangle(self, LEFT_BOTTOM , RIGHT_TOP, BOTTOM, points, order);
+			lucIsosurface_AddWallTriangle(self, LEFT_TOP , RIGHT_TOP, LEFT_BOTTOM, points, order);
+			break;
+		case 14:
+			/*  ##  */
+			/*  @#  */
+			lucIsosurface_AddWallTriangle(self, LEFT , LEFT_TOP, BOTTOM, points, order);
+			lucIsosurface_AddWallTriangle(self, BOTTOM , LEFT_TOP, RIGHT_BOTTOM, points, order);
+			lucIsosurface_AddWallTriangle(self, RIGHT_BOTTOM , LEFT_TOP, RIGHT_TOP, points, order);
+			break;
+		case 15:
+			/*  ##  */
+			/*  ##  */
+			lucIsosurface_AddWallTriangle(self, LEFT_TOP , RIGHT_TOP, RIGHT_BOTTOM, points, order);
+			lucIsosurface_AddWallTriangle(self, RIGHT_BOTTOM , LEFT_BOTTOM, LEFT_TOP, points, order);
+			break;
+		default:
+			Journal_Printf( self->errorStream, "In func %s: Cannot understand cube type %d\n", __func__, cubeType );
+			abort();
+	}
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/MeshViewer.c
--- a/DrawingObjects/src/MeshViewer.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,624 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-#ifdef GLUCIFER_USE_PICELLERATOR
-	#include <PICellerator/PICellerator.h>
-#endif
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "MeshViewer.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-
-/* Textual name of this class - This is a global pointer which is used for 
-   times when you need to refer to class and not a particular instance of a class */
-const Type lucMeshViewer_Type = "lucMeshViewer";
-
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucMeshViewer* _lucMeshViewer_New(  LUCMESHVIEWER_DEFARGS  ) 
-{
-	lucMeshViewer*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of 
-	   parent and continue up the hierarchy tree. At the beginning of the tree 
-	   it will allocate memory of the size of object and initialise all the 
-	   memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucMeshViewer) );
-	self = (lucMeshViewer*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucMeshViewer_Init( 
-                lucMeshViewer*                                            self,
-		Mesh*                                                     mesh,
-		Name                                                      localColourName,
-		Name                                                      shadowColourName,
-		Name                                                      vacantColourName,
-		float                                                        lineWidth )
-{
-	self->mesh  = mesh;
-	lucColour_FromString( &self->localColour, localColourName );
-	lucColour_FromString( &self->shadowColour, shadowColourName );
-	lucColour_FromString( &self->vacantColour, vacantColourName );
-    self->lineWidth = lineWidth;
-	
-	assert( Stg_Class_IsInstance( mesh, Mesh_Type ) );
-
-	self->renderEdges = NULL;
-}
-
-void _lucMeshViewer_Delete( void* drawingObject ) {
-	lucMeshViewer*  self = (lucMeshViewer*)drawingObject;
-
-	if ( self->edges )
-		Memory_Free( self->edges );
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucMeshViewer_Print( void* drawingObject, Stream* stream ) {
-	lucMeshViewer*  self = (lucMeshViewer*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucMeshViewer_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucMeshViewer*  self = (lucMeshViewer*)drawingObject;
-	lucMeshViewer* newDrawingObject;
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-	memcpy( &(newDrawingObject->localColour),       &(self->localColour),       sizeof(lucColour) );
-	memcpy( &(newDrawingObject->shadowColour),       &(self->shadowColour),       sizeof(lucColour) );
-	memcpy( &(newDrawingObject->vacantColour),       &(self->vacantColour),       sizeof(lucColour) );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucMeshViewer_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucMeshViewer);
-	Type                                                             type = lucMeshViewer_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucMeshViewer_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucMeshViewer_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucMeshViewer_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucMeshViewer_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucMeshViewer_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucMeshViewer_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucMeshViewer_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucMeshViewer_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucMeshViewer_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucMeshViewer_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucMeshViewer_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucMeshViewer_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucMeshViewer_New(  LUCMESHVIEWER_PASSARGS  );
-}
-
-void _lucMeshViewer_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucMeshViewer*         self = (lucMeshViewer*)drawingObject;
-	Mesh*                  mesh;
-	
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-	
-	mesh = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Mesh", Mesh, True, data  );
-
-	self->nodeNumbers = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"nodeNumbers", False );
-	self->elementNumbers = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"elementNumbers", False );
-	self->displayNodes = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"displayNodes", False );
-
-	_lucMeshViewer_Init( 
-			self, 
-		        mesh,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"localColour", "black"  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"shadowColour", "blue"  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"vacantColour", "Grey"  ),
-	        (float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0 )
-			 );
-}
-
-void _lucMeshViewer_Build( void* drawingObject, void* data ) {
-}
-
-void _lucMeshViewer_Initialise( void* drawingObject, void* data ) {
-	lucMeshViewer*	self = (lucMeshViewer*)drawingObject;
-
-	assert( self );
-
-	if( Mesh_HasIncidence( self->mesh, MT_EDGE, MT_VERTEX ) )
-		self->renderEdges = lucMeshViewer_RenderEdges_WithInc;
-	else {
-		lucMeshViewer_BuildEdges( self );
-		self->renderEdges = lucMeshViewer_RenderEdges;
-	}
-}
-
-void _lucMeshViewer_Execute( void* drawingObject, void* data ) {
-}
-
-void _lucMeshViewer_Destroy( void* drawingObject, void* data ) {
-}
-
-void _lucMeshViewer_Setup( void* drawingObject, void* _context ) {
-	lucMeshViewer*          self                = (lucMeshViewer*)drawingObject;
-	
-	_lucOpenGLDrawingObject_Setup( self, _context );
-	 lucMeshViewer_UpdateVariables( self );
-	
-}
-
-void lucMeshViewer_UpdateVariables( void* drawingObject ) {
-}
-
-void _lucMeshViewer_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucMeshViewer*          self          = (lucMeshViewer*)drawingObject;
-	lucCamera*               camera        = viewportInfo->viewport->camera;
-	XYZ                      normal;
-
-	StGermain_VectorSubtraction( normal, camera->coord, camera->focalPoint, 3 );
-	glNormal3dv(normal);
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-
-	/* Prints the node numbers */
-	if( self->nodeNumbers )
-		lucMeshViewer_PrintAllNodesNumber( self );
-}
-
-void _lucMeshViewer_CleanUp( void* drawingObject, void* context ) {
-	lucMeshViewer*          self          = (lucMeshViewer*)drawingObject;
-	
-	_lucOpenGLDrawingObject_CleanUp( self, context );
-}
-
-void _lucMeshViewer_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucMeshViewer*	self = (lucMeshViewer*)drawingObject;
-
-	glPointSize( 1.0 );
-	glLineWidth( self->lineWidth );
-	
-	/* Plot the mesh */
-	lucMeshViewer_Render( drawingObject );
-}
-
-#if 0
-void lucMeshViewer_RenderGlobal( void* drawingObject ) {
-	lucMeshViewer*		self = (lucMeshViewer*)drawingObject;
-	unsigned	edge_I;
-	unsigned	vert_I;
-	
-	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
-	
-	/* Render vertices */
-	glBegin( GL_POINTS );
-	for( vert_I = 0; vert_I < self->vertCnt * 3; vert_I += 3 ) {
-		glVertex3dv( &self->verts[vert_I] );
-	}
-	glEnd();
-	
-	/* Render edges */
-	glBegin( GL_LINES );
-	for( edge_I = 0; edge_I < self->edgeCnt * 2; edge_I += 2 ) {
-		unsigned	vert_I = self->edges[edge_I] * 3;
-		unsigned	vert_J = self->edges[edge_I + 1] * 3;
-		
-		glVertex3dv( &self->verts[vert_I] );
-		glVertex3dv( &self->verts[vert_J] );
-	}
-	glEnd();
-}
-
-void lucMeshViewer_PrintAllElementsNumber( void* drawingObject, Partition_Index rank ) {
-	lucMeshViewer*	     self = (lucMeshViewer*)drawingObject;
-	Coord                avgCoord;
-	Coord                offset;
-	char                 elementNumString[100];
-	Dimension_Index      dim_I;
-	Node_LocalIndex      node_lI;
-	Node_Index           elNode_I;
-	Element_LocalIndex   element_lI;
-
-
-	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
-	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
-
-	/* Prints the element numbers */
-	offset[0] = -0.01;
-	offset[1] = -0.01;
-	offset[2] = 0;
-	for ( element_lI = 0; element_lI < self->mesh->elementLocalCount; element_lI++ ) 
-	{	
-		sprintf( elementNumString, "el%u", element_lI );
-
-		for ( dim_I=0; dim_I < 3; dim_I++) {	
-			avgCoord[dim_I] = 0;
-		}
-		for ( elNode_I=0; elNode_I < self->mesh->elementNodeCountTbl[element_lI]; elNode_I++ ) {
-			node_lI = self->mesh->elementNodeTbl[element_lI][elNode_I];
-			for ( dim_I=0; dim_I < ((HexaEL*)(self->mesh->layout->elementLayout))->dim; dim_I++) {	
-				avgCoord[dim_I] += self->mesh->nodeCoord[node_lI][dim_I];
-			}	
-		}
-		for ( dim_I=0; dim_I < ((HexaEL*)(self->mesh->layout->elementLayout))->dim; dim_I++) {	
-			avgCoord[dim_I] /= (double)self->mesh->elementNodeCountTbl[element_lI];
-		}
-
-		if ( ((HexaEL*)(self->mesh->layout->elementLayout))->dim == 2) {
-			glRasterPos2f( (float)avgCoord[0] + offset[0], (float)avgCoord[1] + offset[1] );		
-		}	
-		else {  
-			glRasterPos3f( (float)avgCoord[0] + offset[0], (float)avgCoord[1] + offset[1],
-				(float)avgCoord[2] + offset[2] );
-		}	
-
-		lucPrintString( elementNumString );
-	}
-	glEnable(GL_LIGHTING);
-
-
-}
-#endif
-
-void lucMeshViewer_PrintAllNodesNumber( void* drawingObject ) {
-	lucMeshViewer*	self = (lucMeshViewer*)drawingObject;
-	double*			coord;
-	char				nodeNumString[100];
-	unsigned			node_lI, nodeLocalCount, dim;
-
-	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
-    lucSetFontCharset(FONT_SMALL);
-	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
-
-	nodeLocalCount = Mesh_GetLocalSize( self->mesh, MT_VERTEX );
-	dim = Mesh_GetDimSize( self->mesh );
-	/* Prints the node numbers */
-	for ( node_lI = 0; node_lI < nodeLocalCount; node_lI++ ) 
-	{	
-		sprintf( nodeNumString, "nl%u", node_lI );
-		coord = Mesh_GetVertex( self->mesh, node_lI );
-		if ( dim == 2) {
-			/* the magic Owen showed me, JG */
-			lucPrint3d( ((float)coord[0]), ((float)coord[1]), 0, nodeNumString );
-		} else {
-			lucPrint3d( ((float)coord[0]), ((float)coord[1]), (float)coord[2], nodeNumString );
-		}
-
-	}
-    lucSetFontCharset(FONT_DEFAULT);
-	glEnable(GL_LIGHTING);
-
-}
-
-#if 0
-void lucMeshViewer_PrintNodeNumber( void* drawingObject, Coord coord, int* nodeNumber ) {
-	lucMeshViewer*	     self = (lucMeshViewer*)drawingObject;
-	char                 nodeNumString[100];
-
-	unsigned dim  = ((HexaEL*)(self->mesh->layout->elementLayout))->dim ;
-
-	lucMeshViewer_ClosestNode(self, coord, nodeNumber);
-	
-	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
-	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
-
-	/* Prints the node numbers */
-	sprintf( nodeNumString, "nl%u", *nodeNumber );
-	if (dim == 2)
-		glRasterPos2f( (float)coord[0] + 0.015, (float)coord[1] + 0.015 );		
-	else   
-		glRasterPos3f( (float)coord[0] + 0.015, (float)coord[1] + 0.015, (float)coord[2] + 0.015 );
-
-	lucPrintString( nodeNumString );
-}
-
-void lucMeshViewer_PrintElementNumber( void* drawingObject, Coord coord, int* elementNumber ) {
-	lucMeshViewer*	     self = (lucMeshViewer*)drawingObject;
-	Coord                avgCoord;
-	Coord                offset;
-	char                 elementNumString[100];
-	Dimension_Index      dim_I;
-	Node_LocalIndex      node_lI;
-	Node_Index           elNode_I;
-	Element_LocalIndex   element_lI;
-
-        lucMeshViewer_FindElementNumber(drawingObject, coord, elementNumber);
-
-	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
-	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
-
-	/* Prints the element numbers */
-	offset[0] = -0.01;
-	offset[1] = -0.01;
-	offset[2] = 0;
-	element_lI = *elementNumber;
-	
-	sprintf( elementNumString, "el%u", element_lI );
-
-	for ( dim_I=0; dim_I < 3; dim_I++) {	
-		avgCoord[dim_I] = 0;
-	}
-	for ( elNode_I=0; elNode_I < self->mesh->elementNodeCountTbl[element_lI]; elNode_I++ ) {
-		node_lI = self->mesh->elementNodeTbl[element_lI][elNode_I];
-		for ( dim_I=0; dim_I < ((HexaEL*)(self->mesh->layout->elementLayout))->dim; dim_I++) {	
-			avgCoord[dim_I] += self->mesh->nodeCoord[node_lI][dim_I];
-		}	
-	}
-	for ( dim_I=0; dim_I < ((HexaEL*)(self->mesh->layout->elementLayout))->dim; dim_I++) {	
-		avgCoord[dim_I] /= (double)self->mesh->elementNodeCountTbl[element_lI];
-	}
-
-	if ( ((HexaEL*)(self->mesh->layout->elementLayout))->dim == 2) {
-		glRasterPos2f( (float)avgCoord[0] + offset[0], (float)avgCoord[1] + offset[1] );		
-	}	
-	else {  
-		glRasterPos3f( (float)avgCoord[0] + offset[0], (float)avgCoord[1] + offset[1],
-			(float)avgCoord[2] + offset[2] );
-	}	
-
-	lucPrintString( elementNumString );
-	glEnable(GL_LIGHTING);
-}
-#endif
-
-void lucMeshViewer_RenderLocal( void* drawingObject ) {
-	lucMeshViewer*	self = (lucMeshViewer*)drawingObject;
-	Mesh*		mesh;
-	vertexFuncType*	vertexFunc;
-
-	assert( self );
-	assert( Mesh_GetDomainSize( self->mesh, MT_VERTEX ) );
-	assert( self->renderEdges );
-
-	/* Shortcuts. */
-	glDisable(GL_LIGHTING); /* lighting is just not set up correctly */
-	mesh = self->mesh;
-
-	/* Pick the correct dimension. */
-	if( Mesh_GetDimSize( mesh ) == 3 )
-		vertexFunc = glVertex3dv;
-	else
-		vertexFunc = glVertex2dv;
-
-
-	/* Set color. */
-	lucColour_SetOpenGLColour( &self->localColour );
-    
-	/* Render vertices. */
-	if(self->displayNodes){
-		unsigned	nVerts;
-		unsigned	v_i;
-
-		nVerts = Mesh_GetLocalSize( mesh, MT_VERTEX );
-		glPointSize( 5 );
-		glBegin( GL_POINTS );
-		for( v_i = 0; v_i < nVerts; v_i ++ )
-			vertexFunc( Mesh_GetVertex( mesh, v_i ) );
-		glEnd();
-	}
-
-	/* Render edges */
-	self->renderEdges( self, vertexFunc );
-
-/* For now we are doing any text printing in the Draw call as fonts have their own display lists and coord system */
-#if 0
-	/* Prints the element numbers */
-	if( self->elementNumbers )
-		lucMeshViewer_PrintAllElementsNumber( self );
-#endif
-
-	/* Prints the node numbers /
-	if( self->nodeNumbers )
-		lucMeshViewer_PrintAllNodesNumber( self );
-		*/
-}
-
-#if 0
-void lucMeshViewer_RenderShadow( void* drawingObject, Partition_Index rank ) {
-	lucMeshViewer*		self = (lucMeshViewer*)drawingObject;
-	unsigned	sEdge_I;
-	
-	assert( rank < self->rankCnt );
-	
-	if( !self->shadowEdgeCnts[rank] || !self->shadowEdges[rank] ) {
-		return;
-	}
-	
-	glColor3f( self->shadowColour.red, self->shadowColour.green, self->shadowColour.blue );
-	
-
-	/* Render edges */
-	glBegin( GL_LINES );
-	for( sEdge_I = 0; sEdge_I < self->shadowEdgeCnts[rank]; sEdge_I++ ) {
-		unsigned	  edge_I = self->shadowEdges[rank][sEdge_I] * 2;
-		Node_DomainIndex  node1_dI = Mesh_NodeMapGlobalToDomain( self->mesh, self->edges[edge_I] );
-		Node_DomainIndex  node2_dI = Mesh_NodeMapGlobalToDomain( self->mesh, self->edges[edge_I + 1] );
-		double*         coord1;
-		double*         coord2;
-
-		coord1 = self->mesh->nodeCoord[node1_dI];
-		coord2 = self->mesh->nodeCoord[node2_dI];
-		
-		glVertex3dv( coord1 );
-		glVertex3dv( coord2 );
-	}
-	glEnd();
-}
-
-void lucMeshViewer_RenderVacant( void* drawingObject, Partition_Index rank ) {
-	lucMeshViewer*		self = (lucMeshViewer*)drawingObject;
-	unsigned	     lEdge_I;
-	unsigned	     edge_I;
-	Node_LocalIndex      node1_lI;
-	Node_LocalIndex      node2_lI;
-	double*              coord1;
-	double*              coord2;
-	
-	assert( rank < self->rankCnt );
-	
-	assert( rank < self->rankCnt );
-	
-	if( !self->vacantEdgeCnts || !self->vacantEdgeCnts[rank] || !self->vacantEdges || !self->vacantEdges[rank] ) {
-		return;
-	}
-	
-	glColor3f( self->vacantColour.red, self->vacantColour.green, self->vacantColour.blue );
-	
-	glBegin( GL_LINES );
-	for( lEdge_I = 0; lEdge_I < self->localEdgeCnts[rank]; lEdge_I++ ) {
-		edge_I = self->localEdges[rank][lEdge_I] * 2;
-
-		node1_lI = Mesh_NodeMapGlobalToLocal( self->mesh, self->edges[edge_I] );
-		node2_lI = Mesh_NodeMapGlobalToLocal( self->mesh, self->edges[edge_I + 1] );
-
-		coord1 = self->mesh->nodeCoord[node1_lI];	
-		coord2 = self->mesh->nodeCoord[node2_lI];	
-		
-		glVertex3dv( coord1 );
-		glVertex3dv( coord2 );
-	}
-	glEnd();
-}
-#endif
-
-void lucMeshViewer_Render( void* drawingObject ) {
-	lucMeshViewer*		self = (lucMeshViewer*)drawingObject;
-
-	lucMeshViewer_RenderLocal( self );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Private Member functions
-*/
-
-void lucMeshViewer_BuildEdges( lucMeshViewer* self ) {
-#if 0
-	unsigned	e_i;
-
-	assert( self );
-	
-	self->nEdges = Mesh_GetLocalSize( self->mesh, MT_EDGE );
-	self->edges = Memory_Alloc_2DArray( unsigned, self->nEdges, 2, (Name)"edges" );
-
-	for( e_i = 0; e_i < self->nEdges; e_i++ ) {
-		/* Find node IDs for each edge */
-		
-	}
-		
-	nVerts = Mesh_GetLocalSize(  );
-	done = AllocArray( Bool, nVerts );
-#endif
-}
-
-void lucMeshViewer_RenderEdges_WithInc( lucMeshViewer* self, vertexFuncType* vertexFunc ) {
-	unsigned	nEdges;
-	int	nIncVerts, *incVerts;
-	IArray*		inc;
-	unsigned	e_i;
-
-	assert( self );
-	assert( Mesh_GetDomainSize( self->mesh, MT_EDGE ) && 
-		Mesh_HasIncidence( self->mesh, MT_EDGE, MT_VERTEX ) );
-
-	nEdges = Mesh_GetLocalSize( self->mesh, MT_EDGE );
-	glDisable(GL_LIGHTING);
-	glBegin( GL_LINES );
-	inc = IArray_New();
-	for( e_i = 0; e_i < nEdges; e_i++ ) {
-		Mesh_GetIncidence( self->mesh, MT_EDGE, e_i, MT_VERTEX, inc );
-		nIncVerts = IArray_GetSize( inc );
-		incVerts = IArray_GetPtr( inc );
-		assert( nIncVerts == 2 );
-
-		vertexFunc( Mesh_GetVertex( self->mesh, incVerts[0] ) );
-		vertexFunc( Mesh_GetVertex( self->mesh, incVerts[1] ) );
-	}
-    glEnd();
-	glEnable(GL_LIGHTING);
-
-	NewClass_Delete( inc );
-}
-
-void lucMeshViewer_RenderEdges( lucMeshViewer* self, vertexFuncType* vertexFunc ) {
-	unsigned	nEdges, **edges;
-	unsigned	e_i;
-
-	assert( self );
-	assert( self->nEdges && self->edges );
-
-	nEdges = self->nEdges;
-	edges = self->edges;
-	glDisable(GL_LIGHTING);
-	glBegin( GL_LINES );
-	for( e_i = 0; e_i < nEdges; e_i++ ) {
-		vertexFunc( Mesh_GetVertex( self->mesh, edges[e_i][0] ) );
-		vertexFunc( Mesh_GetVertex( self->mesh, edges[e_i][1] ) );
-	}
-	glEnd();
-	glEnable(GL_LIGHTING);
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/MeshViewer.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/MeshViewer.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,624 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+#ifdef GLUCIFER_USE_PICELLERATOR
+	#include <PICellerator/PICellerator.h>
+#endif
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "MeshViewer.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+
+/* Textual name of this class - This is a global pointer which is used for 
+   times when you need to refer to class and not a particular instance of a class */
+const Type lucMeshViewer_Type = "lucMeshViewer";
+
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucMeshViewer* _lucMeshViewer_New(  LUCMESHVIEWER_DEFARGS  ) 
+{
+	lucMeshViewer*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of 
+	   parent and continue up the hierarchy tree. At the beginning of the tree 
+	   it will allocate memory of the size of object and initialise all the 
+	   memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucMeshViewer) );
+	self = (lucMeshViewer*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucMeshViewer_Init( 
+                lucMeshViewer*                                            self,
+		Mesh*                                                     mesh,
+		Name                                                      localColourName,
+		Name                                                      shadowColourName,
+		Name                                                      vacantColourName,
+		float                                                        lineWidth )
+{
+	self->mesh  = mesh;
+	lucColour_FromString( &self->localColour, localColourName );
+	lucColour_FromString( &self->shadowColour, shadowColourName );
+	lucColour_FromString( &self->vacantColour, vacantColourName );
+    self->lineWidth = lineWidth;
+	
+	assert( Stg_Class_IsInstance( mesh, Mesh_Type ) );
+
+	self->renderEdges = NULL;
+}
+
+void _lucMeshViewer_Delete( void* drawingObject ) {
+	lucMeshViewer*  self = (lucMeshViewer*)drawingObject;
+
+	if ( self->edges )
+		Memory_Free( self->edges );
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucMeshViewer_Print( void* drawingObject, Stream* stream ) {
+	lucMeshViewer*  self = (lucMeshViewer*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucMeshViewer_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucMeshViewer*  self = (lucMeshViewer*)drawingObject;
+	lucMeshViewer* newDrawingObject;
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+	memcpy( &(newDrawingObject->localColour),       &(self->localColour),       sizeof(lucColour) );
+	memcpy( &(newDrawingObject->shadowColour),       &(self->shadowColour),       sizeof(lucColour) );
+	memcpy( &(newDrawingObject->vacantColour),       &(self->vacantColour),       sizeof(lucColour) );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucMeshViewer_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucMeshViewer);
+	Type                                                             type = lucMeshViewer_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucMeshViewer_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucMeshViewer_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucMeshViewer_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucMeshViewer_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucMeshViewer_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucMeshViewer_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucMeshViewer_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucMeshViewer_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucMeshViewer_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucMeshViewer_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucMeshViewer_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucMeshViewer_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucMeshViewer_New(  LUCMESHVIEWER_PASSARGS  );
+}
+
+void _lucMeshViewer_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucMeshViewer*         self = (lucMeshViewer*)drawingObject;
+	Mesh*                  mesh;
+	
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+	
+	mesh = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Mesh", Mesh, True, data  );
+
+	self->nodeNumbers = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"nodeNumbers", False );
+	self->elementNumbers = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"elementNumbers", False );
+	self->displayNodes = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"displayNodes", False );
+
+	_lucMeshViewer_Init( 
+			self, 
+		        mesh,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"localColour", "black"  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"shadowColour", "blue"  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"vacantColour", "Grey"  ),
+	        (float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0 )
+			 );
+}
+
+void _lucMeshViewer_Build( void* drawingObject, void* data ) {
+}
+
+void _lucMeshViewer_Initialise( void* drawingObject, void* data ) {
+	lucMeshViewer*	self = (lucMeshViewer*)drawingObject;
+
+	assert( self );
+
+	if( Mesh_HasIncidence( self->mesh, MT_EDGE, MT_VERTEX ) )
+		self->renderEdges = lucMeshViewer_RenderEdges_WithInc;
+	else {
+		lucMeshViewer_BuildEdges( self );
+		self->renderEdges = lucMeshViewer_RenderEdges;
+	}
+}
+
+void _lucMeshViewer_Execute( void* drawingObject, void* data ) {
+}
+
+void _lucMeshViewer_Destroy( void* drawingObject, void* data ) {
+}
+
+void _lucMeshViewer_Setup( void* drawingObject, void* _context ) {
+	lucMeshViewer*          self                = (lucMeshViewer*)drawingObject;
+	
+	_lucOpenGLDrawingObject_Setup( self, _context );
+	 lucMeshViewer_UpdateVariables( self );
+	
+}
+
+void lucMeshViewer_UpdateVariables( void* drawingObject ) {
+}
+
+void _lucMeshViewer_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucMeshViewer*          self          = (lucMeshViewer*)drawingObject;
+	lucCamera*               camera        = viewportInfo->viewport->camera;
+	XYZ                      normal;
+
+	StGermain_VectorSubtraction( normal, camera->coord, camera->focalPoint, 3 );
+	glNormal3dv(normal);
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+
+	/* Prints the node numbers */
+	if( self->nodeNumbers )
+		lucMeshViewer_PrintAllNodesNumber( self );
+}
+
+void _lucMeshViewer_CleanUp( void* drawingObject, void* context ) {
+	lucMeshViewer*          self          = (lucMeshViewer*)drawingObject;
+	
+	_lucOpenGLDrawingObject_CleanUp( self, context );
+}
+
+void _lucMeshViewer_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucMeshViewer*	self = (lucMeshViewer*)drawingObject;
+
+	glPointSize( 1.0 );
+	glLineWidth( self->lineWidth );
+	
+	/* Plot the mesh */
+	lucMeshViewer_Render( drawingObject );
+}
+
+#if 0
+void lucMeshViewer_RenderGlobal( void* drawingObject ) {
+	lucMeshViewer*		self = (lucMeshViewer*)drawingObject;
+	unsigned	edge_I;
+	unsigned	vert_I;
+	
+	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
+	
+	/* Render vertices */
+	glBegin( GL_POINTS );
+	for( vert_I = 0; vert_I < self->vertCnt * 3; vert_I += 3 ) {
+		glVertex3dv( &self->verts[vert_I] );
+	}
+	glEnd();
+	
+	/* Render edges */
+	glBegin( GL_LINES );
+	for( edge_I = 0; edge_I < self->edgeCnt * 2; edge_I += 2 ) {
+		unsigned	vert_I = self->edges[edge_I] * 3;
+		unsigned	vert_J = self->edges[edge_I + 1] * 3;
+		
+		glVertex3dv( &self->verts[vert_I] );
+		glVertex3dv( &self->verts[vert_J] );
+	}
+	glEnd();
+}
+
+void lucMeshViewer_PrintAllElementsNumber( void* drawingObject, Partition_Index rank ) {
+	lucMeshViewer*	     self = (lucMeshViewer*)drawingObject;
+	Coord                avgCoord;
+	Coord                offset;
+	char                 elementNumString[100];
+	Dimension_Index      dim_I;
+	Node_LocalIndex      node_lI;
+	Node_Index           elNode_I;
+	Element_LocalIndex   element_lI;
+
+
+	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
+	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
+
+	/* Prints the element numbers */
+	offset[0] = -0.01;
+	offset[1] = -0.01;
+	offset[2] = 0;
+	for ( element_lI = 0; element_lI < self->mesh->elementLocalCount; element_lI++ ) 
+	{	
+		sprintf( elementNumString, "el%u", element_lI );
+
+		for ( dim_I=0; dim_I < 3; dim_I++) {	
+			avgCoord[dim_I] = 0;
+		}
+		for ( elNode_I=0; elNode_I < self->mesh->elementNodeCountTbl[element_lI]; elNode_I++ ) {
+			node_lI = self->mesh->elementNodeTbl[element_lI][elNode_I];
+			for ( dim_I=0; dim_I < ((HexaEL*)(self->mesh->layout->elementLayout))->dim; dim_I++) {	
+				avgCoord[dim_I] += self->mesh->nodeCoord[node_lI][dim_I];
+			}	
+		}
+		for ( dim_I=0; dim_I < ((HexaEL*)(self->mesh->layout->elementLayout))->dim; dim_I++) {	
+			avgCoord[dim_I] /= (double)self->mesh->elementNodeCountTbl[element_lI];
+		}
+
+		if ( ((HexaEL*)(self->mesh->layout->elementLayout))->dim == 2) {
+			glRasterPos2f( (float)avgCoord[0] + offset[0], (float)avgCoord[1] + offset[1] );		
+		}	
+		else {  
+			glRasterPos3f( (float)avgCoord[0] + offset[0], (float)avgCoord[1] + offset[1],
+				(float)avgCoord[2] + offset[2] );
+		}	
+
+		lucPrintString( elementNumString );
+	}
+	glEnable(GL_LIGHTING);
+
+
+}
+#endif
+
+void lucMeshViewer_PrintAllNodesNumber( void* drawingObject ) {
+	lucMeshViewer*	self = (lucMeshViewer*)drawingObject;
+	double*			coord;
+	char				nodeNumString[100];
+	unsigned			node_lI, nodeLocalCount, dim;
+
+	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
+    lucSetFontCharset(FONT_SMALL);
+	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
+
+	nodeLocalCount = Mesh_GetLocalSize( self->mesh, MT_VERTEX );
+	dim = Mesh_GetDimSize( self->mesh );
+	/* Prints the node numbers */
+	for ( node_lI = 0; node_lI < nodeLocalCount; node_lI++ ) 
+	{	
+		sprintf( nodeNumString, "nl%u", node_lI );
+		coord = Mesh_GetVertex( self->mesh, node_lI );
+		if ( dim == 2) {
+			/* the magic Owen showed me, JG */
+			lucPrint3d( ((float)coord[0]), ((float)coord[1]), 0, nodeNumString );
+		} else {
+			lucPrint3d( ((float)coord[0]), ((float)coord[1]), (float)coord[2], nodeNumString );
+		}
+
+	}
+    lucSetFontCharset(FONT_DEFAULT);
+	glEnable(GL_LIGHTING);
+
+}
+
+#if 0
+void lucMeshViewer_PrintNodeNumber( void* drawingObject, Coord coord, int* nodeNumber ) {
+	lucMeshViewer*	     self = (lucMeshViewer*)drawingObject;
+	char                 nodeNumString[100];
+
+	unsigned dim  = ((HexaEL*)(self->mesh->layout->elementLayout))->dim ;
+
+	lucMeshViewer_ClosestNode(self, coord, nodeNumber);
+	
+	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
+	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
+
+	/* Prints the node numbers */
+	sprintf( nodeNumString, "nl%u", *nodeNumber );
+	if (dim == 2)
+		glRasterPos2f( (float)coord[0] + 0.015, (float)coord[1] + 0.015 );		
+	else   
+		glRasterPos3f( (float)coord[0] + 0.015, (float)coord[1] + 0.015, (float)coord[2] + 0.015 );
+
+	lucPrintString( nodeNumString );
+}
+
+void lucMeshViewer_PrintElementNumber( void* drawingObject, Coord coord, int* elementNumber ) {
+	lucMeshViewer*	     self = (lucMeshViewer*)drawingObject;
+	Coord                avgCoord;
+	Coord                offset;
+	char                 elementNumString[100];
+	Dimension_Index      dim_I;
+	Node_LocalIndex      node_lI;
+	Node_Index           elNode_I;
+	Element_LocalIndex   element_lI;
+
+        lucMeshViewer_FindElementNumber(drawingObject, coord, elementNumber);
+
+	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
+	glColor3f( self->localColour.red, self->localColour.green, self->localColour.blue );
+
+	/* Prints the element numbers */
+	offset[0] = -0.01;
+	offset[1] = -0.01;
+	offset[2] = 0;
+	element_lI = *elementNumber;
+	
+	sprintf( elementNumString, "el%u", element_lI );
+
+	for ( dim_I=0; dim_I < 3; dim_I++) {	
+		avgCoord[dim_I] = 0;
+	}
+	for ( elNode_I=0; elNode_I < self->mesh->elementNodeCountTbl[element_lI]; elNode_I++ ) {
+		node_lI = self->mesh->elementNodeTbl[element_lI][elNode_I];
+		for ( dim_I=0; dim_I < ((HexaEL*)(self->mesh->layout->elementLayout))->dim; dim_I++) {	
+			avgCoord[dim_I] += self->mesh->nodeCoord[node_lI][dim_I];
+		}	
+	}
+	for ( dim_I=0; dim_I < ((HexaEL*)(self->mesh->layout->elementLayout))->dim; dim_I++) {	
+		avgCoord[dim_I] /= (double)self->mesh->elementNodeCountTbl[element_lI];
+	}
+
+	if ( ((HexaEL*)(self->mesh->layout->elementLayout))->dim == 2) {
+		glRasterPos2f( (float)avgCoord[0] + offset[0], (float)avgCoord[1] + offset[1] );		
+	}	
+	else {  
+		glRasterPos3f( (float)avgCoord[0] + offset[0], (float)avgCoord[1] + offset[1],
+			(float)avgCoord[2] + offset[2] );
+	}	
+
+	lucPrintString( elementNumString );
+	glEnable(GL_LIGHTING);
+}
+#endif
+
+void lucMeshViewer_RenderLocal( void* drawingObject ) {
+	lucMeshViewer*	self = (lucMeshViewer*)drawingObject;
+	Mesh*		mesh;
+	vertexFuncType*	vertexFunc;
+
+	assert( self );
+	assert( Mesh_GetDomainSize( self->mesh, MT_VERTEX ) );
+	assert( self->renderEdges );
+
+	/* Shortcuts. */
+	glDisable(GL_LIGHTING); /* lighting is just not set up correctly */
+	mesh = self->mesh;
+
+	/* Pick the correct dimension. */
+	if( Mesh_GetDimSize( mesh ) == 3 )
+		vertexFunc = glVertex3dv;
+	else
+		vertexFunc = glVertex2dv;
+
+
+	/* Set color. */
+	lucColour_SetOpenGLColour( &self->localColour );
+    
+	/* Render vertices. */
+	if(self->displayNodes){
+		unsigned	nVerts;
+		unsigned	v_i;
+
+		nVerts = Mesh_GetLocalSize( mesh, MT_VERTEX );
+		glPointSize( 5 );
+		glBegin( GL_POINTS );
+		for( v_i = 0; v_i < nVerts; v_i ++ )
+			vertexFunc( Mesh_GetVertex( mesh, v_i ) );
+		glEnd();
+	}
+
+	/* Render edges */
+	self->renderEdges( self, vertexFunc );
+
+/* For now we are doing any text printing in the Draw call as fonts have their own display lists and coord system */
+#if 0
+	/* Prints the element numbers */
+	if( self->elementNumbers )
+		lucMeshViewer_PrintAllElementsNumber( self );
+#endif
+
+	/* Prints the node numbers /
+	if( self->nodeNumbers )
+		lucMeshViewer_PrintAllNodesNumber( self );
+		*/
+}
+
+#if 0
+void lucMeshViewer_RenderShadow( void* drawingObject, Partition_Index rank ) {
+	lucMeshViewer*		self = (lucMeshViewer*)drawingObject;
+	unsigned	sEdge_I;
+	
+	assert( rank < self->rankCnt );
+	
+	if( !self->shadowEdgeCnts[rank] || !self->shadowEdges[rank] ) {
+		return;
+	}
+	
+	glColor3f( self->shadowColour.red, self->shadowColour.green, self->shadowColour.blue );
+	
+
+	/* Render edges */
+	glBegin( GL_LINES );
+	for( sEdge_I = 0; sEdge_I < self->shadowEdgeCnts[rank]; sEdge_I++ ) {
+		unsigned	  edge_I = self->shadowEdges[rank][sEdge_I] * 2;
+		Node_DomainIndex  node1_dI = Mesh_NodeMapGlobalToDomain( self->mesh, self->edges[edge_I] );
+		Node_DomainIndex  node2_dI = Mesh_NodeMapGlobalToDomain( self->mesh, self->edges[edge_I + 1] );
+		double*         coord1;
+		double*         coord2;
+
+		coord1 = self->mesh->nodeCoord[node1_dI];
+		coord2 = self->mesh->nodeCoord[node2_dI];
+		
+		glVertex3dv( coord1 );
+		glVertex3dv( coord2 );
+	}
+	glEnd();
+}
+
+void lucMeshViewer_RenderVacant( void* drawingObject, Partition_Index rank ) {
+	lucMeshViewer*		self = (lucMeshViewer*)drawingObject;
+	unsigned	     lEdge_I;
+	unsigned	     edge_I;
+	Node_LocalIndex      node1_lI;
+	Node_LocalIndex      node2_lI;
+	double*              coord1;
+	double*              coord2;
+	
+	assert( rank < self->rankCnt );
+	
+	assert( rank < self->rankCnt );
+	
+	if( !self->vacantEdgeCnts || !self->vacantEdgeCnts[rank] || !self->vacantEdges || !self->vacantEdges[rank] ) {
+		return;
+	}
+	
+	glColor3f( self->vacantColour.red, self->vacantColour.green, self->vacantColour.blue );
+	
+	glBegin( GL_LINES );
+	for( lEdge_I = 0; lEdge_I < self->localEdgeCnts[rank]; lEdge_I++ ) {
+		edge_I = self->localEdges[rank][lEdge_I] * 2;
+
+		node1_lI = Mesh_NodeMapGlobalToLocal( self->mesh, self->edges[edge_I] );
+		node2_lI = Mesh_NodeMapGlobalToLocal( self->mesh, self->edges[edge_I + 1] );
+
+		coord1 = self->mesh->nodeCoord[node1_lI];	
+		coord2 = self->mesh->nodeCoord[node2_lI];	
+		
+		glVertex3dv( coord1 );
+		glVertex3dv( coord2 );
+	}
+	glEnd();
+}
+#endif
+
+void lucMeshViewer_Render( void* drawingObject ) {
+	lucMeshViewer*		self = (lucMeshViewer*)drawingObject;
+
+	lucMeshViewer_RenderLocal( self );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Private Member functions
+*/
+
+void lucMeshViewer_BuildEdges( lucMeshViewer* self ) {
+#if 0
+	unsigned	e_i;
+
+	assert( self );
+	
+	self->nEdges = Mesh_GetLocalSize( self->mesh, MT_EDGE );
+	self->edges = Memory_Alloc_2DArray( unsigned, self->nEdges, 2, (Name)"edges" );
+
+	for( e_i = 0; e_i < self->nEdges; e_i++ ) {
+		/* Find node IDs for each edge */
+		
+	}
+		
+	nVerts = Mesh_GetLocalSize(  );
+	done = AllocArray( Bool, nVerts );
+#endif
+}
+
+void lucMeshViewer_RenderEdges_WithInc( lucMeshViewer* self, vertexFuncType* vertexFunc ) {
+	unsigned	nEdges;
+	int	nIncVerts, *incVerts;
+	IArray*		inc;
+	unsigned	e_i;
+
+	assert( self );
+	assert( Mesh_GetDomainSize( self->mesh, MT_EDGE ) && 
+		Mesh_HasIncidence( self->mesh, MT_EDGE, MT_VERTEX ) );
+
+	nEdges = Mesh_GetLocalSize( self->mesh, MT_EDGE );
+	glDisable(GL_LIGHTING);
+	glBegin( GL_LINES );
+	inc = IArray_New();
+	for( e_i = 0; e_i < nEdges; e_i++ ) {
+		Mesh_GetIncidence( self->mesh, MT_EDGE, e_i, MT_VERTEX, inc );
+		nIncVerts = IArray_GetSize( inc );
+		incVerts = IArray_GetPtr( inc );
+		assert( nIncVerts == 2 );
+
+		vertexFunc( Mesh_GetVertex( self->mesh, incVerts[0] ) );
+		vertexFunc( Mesh_GetVertex( self->mesh, incVerts[1] ) );
+	}
+    glEnd();
+	glEnable(GL_LIGHTING);
+
+	NewClass_Delete( inc );
+}
+
+void lucMeshViewer_RenderEdges( lucMeshViewer* self, vertexFuncType* vertexFunc ) {
+	unsigned	nEdges, **edges;
+	unsigned	e_i;
+
+	assert( self );
+	assert( self->nEdges && self->edges );
+
+	nEdges = self->nEdges;
+	edges = self->edges;
+	glDisable(GL_LIGHTING);
+	glBegin( GL_LINES );
+	for( e_i = 0; e_i < nEdges; e_i++ ) {
+		vertexFunc( Mesh_GetVertex( self->mesh, edges[e_i][0] ) );
+		vertexFunc( Mesh_GetVertex( self->mesh, edges[e_i][1] ) );
+	}
+	glEnd();
+	glEnable(GL_LIGHTING);
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/OpenGLDrawingObject.c
--- a/DrawingObjects/src/OpenGLDrawingObject.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OpenGLDrawingObject.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucOpenGLDrawingObject_Type = "lucOpenGLDrawingObject";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucOpenGLDrawingObject* _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_DEFARGS  ) 
-{
-	lucOpenGLDrawingObject*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucOpenGLDrawingObject) );
-	self = (lucOpenGLDrawingObject*) _lucDrawingObject_New(  LUCDRAWINGOBJECT_PASSARGS  );
-
-	self->_buildDisplayList = _buildDisplayList;
-	
-	return self;
-}
-
-void _lucOpenGLDrawingObject_Init( 
-		lucOpenGLDrawingObject*                            self )
-{
-    self->displayList = 0;
-}
-
-void _lucOpenGLDrawingObject_Delete( void* drawingObject ) {
-	lucOpenGLDrawingObject*  self = (lucOpenGLDrawingObject*)drawingObject;
-
-	_lucDrawingObject_Delete( self );
-}
-
-void _lucOpenGLDrawingObject_Print( void* drawingObject, Stream* stream ) {
-	lucOpenGLDrawingObject*  self = (lucOpenGLDrawingObject*)drawingObject;
-
-	_lucDrawingObject_Print( self, stream );
-
-	Journal_PrintValue( stream, self->displayList );
-}
-
-void* _lucOpenGLDrawingObject_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucOpenGLDrawingObject*  self = (lucOpenGLDrawingObject*)drawingObject;
-	lucOpenGLDrawingObject* newDrawingObject;
-
-	newDrawingObject = _lucDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newDrawingObject->displayList = self->displayList;
-
-	return (void*) newDrawingObject;
-}
-
-
-
-void _lucOpenGLDrawingObject_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucOpenGLDrawingObject*         self               = (lucOpenGLDrawingObject*)drawingObject;
-
-	/* Construct Parent */
-	_lucDrawingObject_AssignFromXML( self, cf, data );
-
-	_lucOpenGLDrawingObject_Init( self );
-}
-
-void _lucOpenGLDrawingObject_Build( void* drawingObject, void* data ) {}
-void _lucOpenGLDrawingObject_Initialise( void* drawingObject, void* data ) {}
-void _lucOpenGLDrawingObject_Execute( void* drawingObject, void* data ) {}
-void _lucOpenGLDrawingObject_Destroy( void* drawingObject, void* data ) {}
-
-/* Drawing Object implementations */
-void _lucOpenGLDrawingObject_Setup( void* drawingObject, void* context ) {
-	lucOpenGLDrawingObject*           self            = (lucOpenGLDrawingObject*)drawingObject;
-
-    /* Generate a display list id */
-	if (!self->displayList)	self->displayList = glGenLists( 1 );
-
-	/* Create/replace OpenGL display list */
-	glNewList( self->displayList, GL_COMPILE);
-
-	/* Run the virtual function for building the display list - 
-	 * this should contain as much of the opengl drawing primitives as possible */
-	lucOpenGLDrawingObject_BuildDisplayList( self, context );
-	
-	/* Tell OpenGL that we've finished creating the list now */
-	glEndList();	
-
-}
-	
-void _lucOpenGLDrawingObject_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucOpenGLDrawingObject*           self          = (lucOpenGLDrawingObject*)drawingObject;
-
-	/* We should make sure that the rendering engine for this window is the lucRenderingEngineGL */
-	Journal_Firewall( 
-			Stg_Class_IsInstance( window->renderingEngine, lucRenderingEngineGL_Type ),
-			self->errorStream,
-			"Error for %s '%s' - This class only works with rendering engines of type %s.\n"
-			"%s '%s' is using a rendering engine of type %s. Please correct this.\n", 
-			self->type, self->name, lucRenderingEngineGL_Type, window->type, window->name, window->renderingEngine->type );
-
-	/* All that we need to do to visualise this object now is to call the display list
-	 * this should have been created in the setup phase */
-	if (self->displayList) glCallList( self->displayList );
-}
-
-void _lucOpenGLDrawingObject_CleanUp( void* drawingObject, void* _context ) {
-	lucOpenGLDrawingObject*           self          = (lucOpenGLDrawingObject*)drawingObject;
-	
-	if (self->displayList) glDeleteLists( self->displayList, 1 );
-    self->displayList = 0;
-}
-
-/* Wrappers for virtual functions */
-void lucOpenGLDrawingObject_BuildDisplayList( void* drawingObject, void* context ) {
-	lucOpenGLDrawingObject*           self            = (lucOpenGLDrawingObject*)drawingObject;
-
-	self->_buildDisplayList( self, context );
-}
-
-/* HACK - a function to check whether a field is an FeVariable or not before it does an FeVariable_SyncShadowValues */
-void lucOpenGLDrawingObject_SyncShadowValues( void* drawingObject, void* field ) {
-	if ( field && Stg_Class_IsInstance( field, FeVariable_Type ) )
-		FeVariable_SyncShadowValues( field );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/OpenGLDrawingObject.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/OpenGLDrawingObject.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,186 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OpenGLDrawingObject.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucOpenGLDrawingObject_Type = "lucOpenGLDrawingObject";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucOpenGLDrawingObject* _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_DEFARGS  ) 
+{
+	lucOpenGLDrawingObject*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucOpenGLDrawingObject) );
+	self = (lucOpenGLDrawingObject*) _lucDrawingObject_New(  LUCDRAWINGOBJECT_PASSARGS  );
+
+	self->_buildDisplayList = _buildDisplayList;
+	
+	return self;
+}
+
+void _lucOpenGLDrawingObject_Init( 
+		lucOpenGLDrawingObject*                            self )
+{
+    self->displayList = 0;
+}
+
+void _lucOpenGLDrawingObject_Delete( void* drawingObject ) {
+	lucOpenGLDrawingObject*  self = (lucOpenGLDrawingObject*)drawingObject;
+
+	_lucDrawingObject_Delete( self );
+}
+
+void _lucOpenGLDrawingObject_Print( void* drawingObject, Stream* stream ) {
+	lucOpenGLDrawingObject*  self = (lucOpenGLDrawingObject*)drawingObject;
+
+	_lucDrawingObject_Print( self, stream );
+
+	Journal_PrintValue( stream, self->displayList );
+}
+
+void* _lucOpenGLDrawingObject_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucOpenGLDrawingObject*  self = (lucOpenGLDrawingObject*)drawingObject;
+	lucOpenGLDrawingObject* newDrawingObject;
+
+	newDrawingObject = _lucDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newDrawingObject->displayList = self->displayList;
+
+	return (void*) newDrawingObject;
+}
+
+
+
+void _lucOpenGLDrawingObject_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucOpenGLDrawingObject*         self               = (lucOpenGLDrawingObject*)drawingObject;
+
+	/* Construct Parent */
+	_lucDrawingObject_AssignFromXML( self, cf, data );
+
+	_lucOpenGLDrawingObject_Init( self );
+}
+
+void _lucOpenGLDrawingObject_Build( void* drawingObject, void* data ) {}
+void _lucOpenGLDrawingObject_Initialise( void* drawingObject, void* data ) {}
+void _lucOpenGLDrawingObject_Execute( void* drawingObject, void* data ) {}
+void _lucOpenGLDrawingObject_Destroy( void* drawingObject, void* data ) {}
+
+/* Drawing Object implementations */
+void _lucOpenGLDrawingObject_Setup( void* drawingObject, void* context ) {
+	lucOpenGLDrawingObject*           self            = (lucOpenGLDrawingObject*)drawingObject;
+
+    /* Generate a display list id */
+	if (!self->displayList)	self->displayList = glGenLists( 1 );
+
+	/* Create/replace OpenGL display list */
+	glNewList( self->displayList, GL_COMPILE);
+
+	/* Run the virtual function for building the display list - 
+	 * this should contain as much of the opengl drawing primitives as possible */
+	lucOpenGLDrawingObject_BuildDisplayList( self, context );
+	
+	/* Tell OpenGL that we've finished creating the list now */
+	glEndList();	
+
+}
+	
+void _lucOpenGLDrawingObject_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucOpenGLDrawingObject*           self          = (lucOpenGLDrawingObject*)drawingObject;
+
+	/* We should make sure that the rendering engine for this window is the lucRenderingEngineGL */
+	Journal_Firewall( 
+			Stg_Class_IsInstance( window->renderingEngine, lucRenderingEngineGL_Type ),
+			self->errorStream,
+			"Error for %s '%s' - This class only works with rendering engines of type %s.\n"
+			"%s '%s' is using a rendering engine of type %s. Please correct this.\n", 
+			self->type, self->name, lucRenderingEngineGL_Type, window->type, window->name, window->renderingEngine->type );
+
+	/* All that we need to do to visualise this object now is to call the display list
+	 * this should have been created in the setup phase */
+	if (self->displayList) glCallList( self->displayList );
+}
+
+void _lucOpenGLDrawingObject_CleanUp( void* drawingObject, void* _context ) {
+	lucOpenGLDrawingObject*           self          = (lucOpenGLDrawingObject*)drawingObject;
+	
+	if (self->displayList) glDeleteLists( self->displayList, 1 );
+    self->displayList = 0;
+}
+
+/* Wrappers for virtual functions */
+void lucOpenGLDrawingObject_BuildDisplayList( void* drawingObject, void* context ) {
+	lucOpenGLDrawingObject*           self            = (lucOpenGLDrawingObject*)drawingObject;
+
+	self->_buildDisplayList( self, context );
+}
+
+/* HACK - a function to check whether a field is an FeVariable or not before it does an FeVariable_SyncShadowValues */
+void lucOpenGLDrawingObject_SyncShadowValues( void* drawingObject, void* field ) {
+	if ( field && Stg_Class_IsInstance( field, FeVariable_Type ) )
+		FeVariable_SyncShadowValues( field );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ScalarField.c
--- a/DrawingObjects/src/ScalarField.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,288 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: ScalarField.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/Base/CrossSection.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "ScalarFieldCrossSection.h"
-#include "ScalarField.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucScalarField_Type = "lucScalarField";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucScalarField* _lucScalarField_New(  LUCSCALARFIELD_DEFARGS  ) 
-{
-	lucScalarField*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucScalarField) );
-	self = (lucScalarField*) _lucScalarFieldCrossSection_New(  LUCSCALARFIELDCROSSSECTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucScalarField_Init( 
-		lucScalarField*                                              self,
-		Bool                                                         cullFace )
-{
-	self->cullFace = cullFace;
-}
-
-void _lucScalarField_Delete( void* drawingObject ) {
-	lucScalarField*  self = (lucScalarField*)drawingObject;
-
-	_lucScalarFieldCrossSection_Delete( self );
-}
-
-void _lucScalarField_Print( void* drawingObject, Stream* stream ) {
-	lucScalarField*  self = (lucScalarField*)drawingObject;
-
-	_lucScalarFieldCrossSection_Print( self, stream );
-}
-
-void* _lucScalarField_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucScalarField*  self = (lucScalarField*)drawingObject;
-	lucScalarField* newDrawingObject;
-
-	newDrawingObject = _lucScalarFieldCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucScalarField_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucScalarField);
-	Type                                                             type = lucScalarField_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucScalarField_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucScalarField_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucScalarField_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucScalarField_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucScalarField_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucScalarField_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucScalarField_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucScalarField_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucScalarField_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucScalarField_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucScalarField_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucScalarField_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucScalarField_New(  LUCSCALARFIELD_PASSARGS  );
-}
-
-void _lucScalarField_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucScalarField*  self = (lucScalarField*)drawingObject;
-
-	/* Construct Parent */
-	_lucScalarFieldCrossSection_AssignFromXML( self, cf, data );
-
-	_lucScalarField_Init( 
-			self, 
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFace", True )  );
-
-        self->useMesh = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useMesh", False  );
-}
-
-void _lucScalarField_Build( void* drawingObject, void* data ) {
-	lucScalarField*  self = (lucScalarField*)drawingObject;
-
-	/* Call parent function */
-	_lucScalarFieldCrossSection_Build( self, data );
-}
-void _lucScalarField_Initialise( void* drawingObject, void* data ) {
-	lucScalarField*  self = (lucScalarField*)drawingObject;
-
-	/* Call parent function */
-	_lucScalarFieldCrossSection_Initialise( self, data );
-}
-void _lucScalarField_Execute( void* drawingObject, void* data ) {}
-void _lucScalarField_Destroy( void* drawingObject, void* data ) {}
-
-void _lucScalarField_Setup( void* drawingObject, void* _context ) {
-	lucScalarField*          self          = (lucScalarField*)drawingObject;
-	
-	_lucScalarFieldCrossSection_Setup( self, _context );
-}
-	
-void _lucScalarField_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucScalarField*          self          = (lucScalarField*)drawingObject;
-	
-	_lucScalarFieldCrossSection_Draw( self, window, viewportInfo, _context );
-}
-
-void _lucScalarField_CleanUp( void* drawingObject, void* _context ) {
-	lucScalarField*          self          = (lucScalarField*)drawingObject;
-	
-	_lucScalarFieldCrossSection_CleanUp( self, _context );
-}
-
-void _lucScalarField_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucScalarField*          self          = (lucScalarField*)drawingObject;
-	DomainContext*   context       = (DomainContext*) _context;
-
-   lucCrossSection          crossSection;
-
-	if (context->dim == 2) 
-   {
-
-       if( self->useMesh )
-          lucScalarField_DrawWithMesh( self );
-       else {
-          lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
-       }
-	}
-	else 
-   {
-		if ( self->cullFace ) glEnable(GL_CULL_FACE);
-	
-		glFrontFace(GL_CCW);
-		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, I_AXIS, True));
-		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, J_AXIS, True));
-		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, True));
-
-		glFrontFace(GL_CW);
-		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, I_AXIS, True));
-		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, J_AXIS, True));
-		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, K_AXIS, True));
-
-		glDisable(GL_CULL_FACE);
-	}
-}
-
-void lucScalarField_DrawWithMesh( lucScalarField* self ) {
-   FeVariable*		var = (FeVariable*)self->fieldVariable;
-   FeMesh*			mesh = var->feMesh;
-   lucColourMap*	cmap = self->colourMap;
-   IArray*			inc;
-   double			value;
-   unsigned			/* nodes,*/ nElements/*, curNode */;
-   /* int nodeMap[4] = {0, 1, 3, 2}; */
-   double			xi[3], vertex[3];
-   int				ii, jj, kk;
-
-   lucOpenGLDrawingObject_SyncShadowValues( self, self->fieldVariable );
-   glDisable( GL_LIGHTING );
-   glNormal3f( 0.0, 0.0, 1.0 );
-   glBegin( GL_QUADS );
-   nElements = FeMesh_GetElementLocalSize( mesh );
-   inc = IArray_New();
-   for( ii = 0; ii < nElements; ii++ ) {
-      for( jj = 0; jj < 10; jj++ ) {
-         for( kk = 0; kk < 10; kk++ ) {
-
-            xi[0] = -1.0 + ((double)kk / 10.0) * 2.0;
-            xi[1] = -1.0 + ((double)jj / 10.0) * 2.0;
-            FeVariable_InterpolateWithinElement( var, ii, xi, &value );
-            lucColourMap_SetOpenGLColourFromValue( cmap, value );
-            FeMesh_CoordLocalToGlobal( mesh, ii, xi, vertex );
-            glVertex2dv( vertex );
-
-            xi[0] = -1.0 + ((double)(kk + 1) / 10.0) * 2.0;
-            xi[1] = -1.0 + ((double)jj / 10.0) * 2.0;
-            FeVariable_InterpolateWithinElement( var, ii, xi, &value );
-            lucColourMap_SetOpenGLColourFromValue( cmap, value );
-            FeMesh_CoordLocalToGlobal( mesh, ii, xi, vertex );
-            glVertex2dv( vertex );
-
-            xi[0] = -1.0 + ((double)(kk + 1) / 10.0) * 2.0;
-            xi[1] = -1.0 + ((double)(jj + 1) / 10.0) * 2.0;
-            FeVariable_InterpolateWithinElement( var, ii, xi, &value );
-            lucColourMap_SetOpenGLColourFromValue( cmap, value );
-            FeMesh_CoordLocalToGlobal( mesh, ii, xi, vertex );
-            glVertex2dv( vertex );
-
-            xi[0] = -1.0 + ((double)kk / 10.0) * 2.0;
-            xi[1] = -1.0 + ((double)(jj + 1) / 10.0) * 2.0;
-            FeVariable_InterpolateWithinElement( var, ii, xi, &value );
-            lucColourMap_SetOpenGLColourFromValue( cmap, value );
-            FeMesh_CoordLocalToGlobal( mesh, ii, xi, vertex );
-            glVertex2dv( vertex );
-         }
-      }
-
-#if 0
-      FeMesh_GetElementNodes( mesh, ii, inc );
-      assert( IArray_GetSize( inc ) == 4 );
-      nodes = IArray_GetPtr( inc );
-      for( jj = 0; jj < 4; jj++ ) {
-         curNode = nodes[nodeMap[jj]];
-         FeVariable_GetValueAtNode( var, curNode, &value );
-         lucColourMap_SetOpenGLColourFromValue( cmap, value );
-         glVertex2dv( Mesh_GetVertex( mesh, curNode ) );
-      }
-#endif
-   }
-   NewClass_Delete( inc );
-   glEnd();
-   glEnable(GL_LIGHTING);
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ScalarField.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/ScalarField.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,288 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: ScalarField.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "ScalarFieldCrossSection.h"
+#include "ScalarField.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucScalarField_Type = "lucScalarField";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucScalarField* _lucScalarField_New(  LUCSCALARFIELD_DEFARGS  ) 
+{
+	lucScalarField*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucScalarField) );
+	self = (lucScalarField*) _lucScalarFieldCrossSection_New(  LUCSCALARFIELDCROSSSECTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucScalarField_Init( 
+		lucScalarField*                                              self,
+		Bool                                                         cullFace )
+{
+	self->cullFace = cullFace;
+}
+
+void _lucScalarField_Delete( void* drawingObject ) {
+	lucScalarField*  self = (lucScalarField*)drawingObject;
+
+	_lucScalarFieldCrossSection_Delete( self );
+}
+
+void _lucScalarField_Print( void* drawingObject, Stream* stream ) {
+	lucScalarField*  self = (lucScalarField*)drawingObject;
+
+	_lucScalarFieldCrossSection_Print( self, stream );
+}
+
+void* _lucScalarField_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucScalarField*  self = (lucScalarField*)drawingObject;
+	lucScalarField* newDrawingObject;
+
+	newDrawingObject = _lucScalarFieldCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucScalarField_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucScalarField);
+	Type                                                             type = lucScalarField_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucScalarField_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucScalarField_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucScalarField_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucScalarField_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucScalarField_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucScalarField_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucScalarField_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucScalarField_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucScalarField_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucScalarField_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucScalarField_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucScalarField_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucScalarField_New(  LUCSCALARFIELD_PASSARGS  );
+}
+
+void _lucScalarField_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucScalarField*  self = (lucScalarField*)drawingObject;
+
+	/* Construct Parent */
+	_lucScalarFieldCrossSection_AssignFromXML( self, cf, data );
+
+	_lucScalarField_Init( 
+			self, 
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFace", True )  );
+
+        self->useMesh = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"useMesh", False  );
+}
+
+void _lucScalarField_Build( void* drawingObject, void* data ) {
+	lucScalarField*  self = (lucScalarField*)drawingObject;
+
+	/* Call parent function */
+	_lucScalarFieldCrossSection_Build( self, data );
+}
+void _lucScalarField_Initialise( void* drawingObject, void* data ) {
+	lucScalarField*  self = (lucScalarField*)drawingObject;
+
+	/* Call parent function */
+	_lucScalarFieldCrossSection_Initialise( self, data );
+}
+void _lucScalarField_Execute( void* drawingObject, void* data ) {}
+void _lucScalarField_Destroy( void* drawingObject, void* data ) {}
+
+void _lucScalarField_Setup( void* drawingObject, void* _context ) {
+	lucScalarField*          self          = (lucScalarField*)drawingObject;
+	
+	_lucScalarFieldCrossSection_Setup( self, _context );
+}
+	
+void _lucScalarField_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucScalarField*          self          = (lucScalarField*)drawingObject;
+	
+	_lucScalarFieldCrossSection_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucScalarField_CleanUp( void* drawingObject, void* _context ) {
+	lucScalarField*          self          = (lucScalarField*)drawingObject;
+	
+	_lucScalarFieldCrossSection_CleanUp( self, _context );
+}
+
+void _lucScalarField_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucScalarField*          self          = (lucScalarField*)drawingObject;
+	DomainContext*   context       = (DomainContext*) _context;
+
+   lucCrossSection          crossSection;
+
+	if (context->dim == 2) 
+   {
+
+       if( self->useMesh )
+          lucScalarField_DrawWithMesh( self );
+       else {
+          lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
+       }
+	}
+	else 
+   {
+		if ( self->cullFace ) glEnable(GL_CULL_FACE);
+	
+		glFrontFace(GL_CCW);
+		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, I_AXIS, True));
+		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, J_AXIS, True));
+		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, True));
+
+		glFrontFace(GL_CW);
+		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, I_AXIS, True));
+		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 0.0, J_AXIS, True));
+		lucScalarFieldCrossSection_DrawCrossSection( self, lucCrossSection_Set(&crossSection, 1.0, K_AXIS, True));
+
+		glDisable(GL_CULL_FACE);
+	}
+}
+
+void lucScalarField_DrawWithMesh( lucScalarField* self ) {
+   FeVariable*		var = (FeVariable*)self->fieldVariable;
+   FeMesh*			mesh = var->feMesh;
+   lucColourMap*	cmap = self->colourMap;
+   IArray*			inc;
+   double			value;
+   unsigned			/* nodes,*/ nElements/*, curNode */;
+   /* int nodeMap[4] = {0, 1, 3, 2}; */
+   double			xi[3], vertex[3];
+   int				ii, jj, kk;
+
+   lucOpenGLDrawingObject_SyncShadowValues( self, self->fieldVariable );
+   glDisable( GL_LIGHTING );
+   glNormal3f( 0.0, 0.0, 1.0 );
+   glBegin( GL_QUADS );
+   nElements = FeMesh_GetElementLocalSize( mesh );
+   inc = IArray_New();
+   for( ii = 0; ii < nElements; ii++ ) {
+      for( jj = 0; jj < 10; jj++ ) {
+         for( kk = 0; kk < 10; kk++ ) {
+
+            xi[0] = -1.0 + ((double)kk / 10.0) * 2.0;
+            xi[1] = -1.0 + ((double)jj / 10.0) * 2.0;
+            FeVariable_InterpolateWithinElement( var, ii, xi, &value );
+            lucColourMap_SetOpenGLColourFromValue( cmap, value );
+            FeMesh_CoordLocalToGlobal( mesh, ii, xi, vertex );
+            glVertex2dv( vertex );
+
+            xi[0] = -1.0 + ((double)(kk + 1) / 10.0) * 2.0;
+            xi[1] = -1.0 + ((double)jj / 10.0) * 2.0;
+            FeVariable_InterpolateWithinElement( var, ii, xi, &value );
+            lucColourMap_SetOpenGLColourFromValue( cmap, value );
+            FeMesh_CoordLocalToGlobal( mesh, ii, xi, vertex );
+            glVertex2dv( vertex );
+
+            xi[0] = -1.0 + ((double)(kk + 1) / 10.0) * 2.0;
+            xi[1] = -1.0 + ((double)(jj + 1) / 10.0) * 2.0;
+            FeVariable_InterpolateWithinElement( var, ii, xi, &value );
+            lucColourMap_SetOpenGLColourFromValue( cmap, value );
+            FeMesh_CoordLocalToGlobal( mesh, ii, xi, vertex );
+            glVertex2dv( vertex );
+
+            xi[0] = -1.0 + ((double)kk / 10.0) * 2.0;
+            xi[1] = -1.0 + ((double)(jj + 1) / 10.0) * 2.0;
+            FeVariable_InterpolateWithinElement( var, ii, xi, &value );
+            lucColourMap_SetOpenGLColourFromValue( cmap, value );
+            FeMesh_CoordLocalToGlobal( mesh, ii, xi, vertex );
+            glVertex2dv( vertex );
+         }
+      }
+
+#if 0
+      FeMesh_GetElementNodes( mesh, ii, inc );
+      assert( IArray_GetSize( inc ) == 4 );
+      nodes = IArray_GetPtr( inc );
+      for( jj = 0; jj < 4; jj++ ) {
+         curNode = nodes[nodeMap[jj]];
+         FeVariable_GetValueAtNode( var, curNode, &value );
+         lucColourMap_SetOpenGLColourFromValue( cmap, value );
+         glVertex2dv( Mesh_GetVertex( mesh, curNode ) );
+      }
+#endif
+   }
+   NewClass_Delete( inc );
+   glEnd();
+   glEnable(GL_LIGHTING);
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ScalarFieldCrossSection.c
--- a/DrawingObjects/src/ScalarFieldCrossSection.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: ScalarFieldCrossSection.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include <glucifer/Base/CrossSection.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "ScalarFieldCrossSection.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-#include <ctype.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucScalarFieldCrossSection_Type = "lucScalarFieldCrossSection";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucScalarFieldCrossSection* _lucScalarFieldCrossSection_New(  LUCSCALARFIELDCROSSSECTION_DEFARGS  ) 
-{
-	lucScalarFieldCrossSection*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucScalarFieldCrossSection) );
-	self = (lucScalarFieldCrossSection*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucScalarFieldCrossSection_Init( 
-		lucScalarFieldCrossSection*                                  self,
-		Name                                                         fieldVariableName,
-		lucColourMap*                                                colourMap,
-		IJK                                                          resolution,
-		lucCrossSection*                                             crossSection,
-		XYZ                                                          minCropValues,
-		XYZ                                                          maxCropValues ) 
-{
-//	self->fieldVariable = fieldVariable;
-	self->fieldVariableName = fieldVariableName;
-	self->colourMap = colourMap;
-	memcpy( self->resolution, resolution, sizeof(IJK) );
-	memcpy( self->minCropValues, minCropValues, sizeof(XYZ) );
-	memcpy( self->maxCropValues, maxCropValues, sizeof(XYZ) );
-	self->crossSection = crossSection;
-}
-
-void _lucScalarFieldCrossSection_Delete( void* drawingObject ) {
-	lucScalarFieldCrossSection*  self = (lucScalarFieldCrossSection*)drawingObject;
-
-   lucCrossSection_Delete(self->crossSection);
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucScalarFieldCrossSection_Print( void* drawingObject, Stream* stream ) {
-	lucScalarFieldCrossSection*  self = (lucScalarFieldCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucScalarFieldCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucScalarFieldCrossSection*  self = (lucScalarFieldCrossSection*)drawingObject;
-	lucScalarFieldCrossSection* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucScalarFieldCrossSection_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucScalarFieldCrossSection);
-	Type                                                             type = lucScalarFieldCrossSection_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucScalarFieldCrossSection_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucScalarFieldCrossSection_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucScalarFieldCrossSection_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucScalarFieldCrossSection_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucScalarFieldCrossSection_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucScalarFieldCrossSection_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucScalarFieldCrossSection_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucScalarFieldCrossSection_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucScalarFieldCrossSection_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucScalarFieldCrossSection_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucScalarFieldCrossSection_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucScalarFieldCrossSection_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucScalarFieldCrossSection_New(  LUCSCALARFIELDCROSSSECTION_PASSARGS  );
-}
-
-void _lucScalarFieldCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucScalarFieldCrossSection*     self = (lucScalarFieldCrossSection*)drawingObject;
-	lucColourMap*    colourMap;
-	Index            defaultResolution;
-	IJK              resolution;
-	Name             fieldVariableName;
-	XYZ              minCropValues;
-	XYZ              maxCropValues;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	fieldVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", "defaultName"  );
-
-	/* This variable is now construct in build phase.
-	   fieldVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, "FieldVariable", FieldVariable, True ) ;
-	*/
-
-
-	colourMap = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, True, data  ) ;
-
-	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 128  );
-	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
-	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
-	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
-			
-	/* Get Values with which to crop the cross section */
-	minCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropX", -HUGE_VAL  );
-	minCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropY", -HUGE_VAL  );
-	minCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropZ", -HUGE_VAL  );
-	maxCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropX", +HUGE_VAL  );
-	maxCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropY", +HUGE_VAL  );
-	maxCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropZ", +HUGE_VAL  );
-	
-	_lucScalarFieldCrossSection_Init( 
-			self, 
-			fieldVariableName,
-			colourMap,
-			resolution,
-			lucCrossSection_Read(cf, self->name),
-			minCropValues,
-			maxCropValues );
-}
-
-void _lucScalarFieldCrossSection_Build( void* drawingObject, void* data ) {
-	lucScalarFieldCrossSection*     self        = (lucScalarFieldCrossSection*)drawingObject;
-	AbstractContext*                context     = self->context;
-	Stg_ComponentFactory*           cf          = context->CF;
-	Stream*                         errorStream = Journal_Register( Error_Type, (Name)self->type  );
-
-	/* HACK - Get pointer to FieldVariable in build phase just to let FieldVariables be created in plugins */
-	self->fieldVariable = Stg_ComponentFactory_ConstructByName( cf, (Name)self->fieldVariableName, FieldVariable, True, data  ); 
-	Journal_Firewall( self->fieldVariable->fieldComponentCount == 1, errorStream,
-		"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
-		"can only visualise FieldVariables with 1 component. Did you mean to visualise the "
-		"magnitude of the given field?\n", __func__, self->fieldVariable->name,
-		self->fieldVariable->fieldComponentCount, self->type );
-}
-
-void _lucScalarFieldCrossSection_Initialise( void* drawingObject, void* data ) {}
-void _lucScalarFieldCrossSection_Execute( void* drawingObject, void* data ) {}
-void _lucScalarFieldCrossSection_Destroy( void* drawingObject, void* data ) {}
-
-void _lucScalarFieldCrossSection_Setup( void* drawingObject, void* _context ) {
-	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
-
-	lucColourMap_CalibrateFromFieldVariable( self->colourMap, self->fieldVariable );
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-	
-void _lucScalarFieldCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucScalarFieldCrossSection_CleanUp( void* drawingObject, void* _context ) {
-	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}
-
-void _lucScalarFieldCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
-	lucScalarFieldCrossSection_DrawCrossSection( self, self->crossSection );
-}
-
-#define FUDGE_FACTOR 0.0001
-
-void lucScalarFieldCrossSection_DrawCrossSection( void* drawingObject, lucCrossSection* crossSection ) {
-	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
-	FieldVariable* fieldVariable = self->fieldVariable;
-   Axis           axis = crossSection->axis;
-	Axis           aAxis;
-	Axis           bAxis;
-	Coord          min, globalMin;
-	Coord          max, globalMax;
-	Coord          pos;
-	Coord          interpolationCoord;
-	float          normal[3];
-	Index          aResolution;
-	Index          bResolution;
-	Index          aIndex;
-	Index          bIndex;
-	double         aLength;
-	double         bLength;
-	Dimension_Index dim_I;
-
-	/* Ensure the field is synchronised. */
-	lucOpenGLDrawingObject_SyncShadowValues( self, self->fieldVariable );
-	
-	glDisable(GL_LIGHTING);
-	
-	aAxis = ( axis == I_AXIS ? J_AXIS : I_AXIS );
-	bAxis = ( axis == K_AXIS ? J_AXIS : K_AXIS );
-	
-	aResolution = self->resolution[ aAxis ];
-	bResolution = self->resolution[ bAxis ];
-	
-	FieldVariable_GetMinAndMaxGlobalCoords( fieldVariable, globalMin, globalMax );
-	FieldVariable_GetMinAndMaxLocalCoords( fieldVariable, min, max );
-
-	/* Crop the size of the cros-section that you wish to draw */
-	for ( dim_I = 0 ; dim_I < fieldVariable->dim ; dim_I++ ) {
-		min[ dim_I ] = MAX( self->minCropValues[ dim_I ], min[ dim_I ]);
-		max[ dim_I ] = MIN( self->maxCropValues[ dim_I ], max[ dim_I ]);
-	}
-
-	/* Find position of cross section */
-	pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
-	Journal_DPrintfL( self->debugStream, 2, 
-			"%s called on field %s, with res[A] as %u, res[B] as %u, axis of cross section as %d, crossSection value as %g\n",
-			__func__, fieldVariable->name, aResolution, bResolution, axis, pos[axis]);
-	
-
-	/* Create normal */
-	normal[axis]  = 1.0;
-	normal[aAxis] = 0.0;
-	normal[bAxis] = 0.0;
-	glNormal3fv( normal );
-
-	aLength = (max[aAxis] - min[aAxis])/(double)aResolution;
-	bLength = (max[bAxis] - min[bAxis])/(double)bResolution;
-
-	Journal_DPrintfL( self->debugStream, 2, "Calculated aLength as %g, bLength as %g\n", aLength, bLength );
-
-	/* Plot a number of tiles with a colour map to represent scalar field */
-	/* OpenGL will interpolate colours within tile */
-	for ( aIndex = 0 ; aIndex < aResolution + 1 ; aIndex++ ) {
-		glBegin(GL_QUAD_STRIP);
-		for ( bIndex = 0 ; bIndex < bResolution + 2 ; bIndex++ ) {
-			/* Get position */
-			pos[ aAxis ] = min[ aAxis ] + (double)aIndex * aLength;
-			pos[ bAxis ] = min[ bAxis ] + (double)bIndex * bLength;
-
-			memcpy( interpolationCoord, pos, sizeof(Coord) );
-
-			if ( pos[ bAxis ] >= max[ bAxis ] ) { 
-				pos[ bAxis ] = max[ bAxis ];
-				interpolationCoord[ bAxis ] = max[ bAxis ] - FUDGE_FACTOR/bLength;
-			}
-			if (pos[ aAxis ] >= max[ aAxis ]) {
-				pos[ aAxis ] = max[ aAxis ];
-				interpolationCoord[ aAxis ] = max[ aAxis ] - FUDGE_FACTOR/aLength;
-			}
-			
-			/* Plot bottom left corner of coloured tile */
-			lucScalarFieldCrossSection_PlotColouredVertex( self, interpolationCoord, pos );
-
-			/* Plot top left corner of coloured tile */
-			pos[ aAxis ] += aLength;
-			if (pos[ aAxis ] >= max[ aAxis ]) {
-				pos[ aAxis ] = max[ aAxis ];
-				interpolationCoord[ aAxis ] = max[ aAxis ] - FUDGE_FACTOR/aLength;
-			}
-			else
-				interpolationCoord[ aAxis ] = pos[ aAxis ];
-			
-			lucScalarFieldCrossSection_PlotColouredVertex( self, interpolationCoord, pos );
-		}
-		glEnd();
-	}
-
-	glEnable(GL_LIGHTING);
-}
-
-Bool lucScalarFieldCrossSection_PlotColouredVertex( void* drawingObject, Coord interpolationCoord, Coord plotCoord ) {
-	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
-	Bool result;
-	FieldVariable* fieldVariable = self->fieldVariable;
-	lucColourMap*  cmap          = self->colourMap;
-	double         quantity;
-
-	Journal_DPrintfL( self->debugStream, 3, "%s called at interpolationCoord (%g,%g,%g)  - ",
-			__func__, interpolationCoord[0], interpolationCoord[1], interpolationCoord[2] );
-
-	/* Interpolate value to this position */
-	result = FieldVariable_InterpolateValueAt( fieldVariable, interpolationCoord, &quantity );
-	if ( LOCAL == result || SHADOW == result ) {
-		/* Get colour for this value from colour map */
-		lucColourMap_SetOpenGLColourFromValue( cmap, quantity );
-
-		Journal_DPrintfL( self->debugStream, 3, "%s is %g there.\n", fieldVariable->name, quantity );
-		
-		Journal_DPrintfL( self->debugStream, 3, "Plotting At Vertex (%g,%g,%g).\n", 
-				plotCoord[0], plotCoord[1], plotCoord[2]  );
-
-		/* Plot Vertex */
-		glVertex3dv(plotCoord);
-
-		return True;
-	}
-
-	Journal_DPrintfL( self->debugStream, 3, "%s NOT FOUND THERE.\n", fieldVariable->name );
-	/* If value could not be interpolated return warning */
-	return False;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ScalarFieldCrossSection.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/ScalarFieldCrossSection.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,367 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: ScalarFieldCrossSection.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include <glucifer/Base/CrossSection.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "ScalarFieldCrossSection.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+#include <ctype.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucScalarFieldCrossSection_Type = "lucScalarFieldCrossSection";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucScalarFieldCrossSection* _lucScalarFieldCrossSection_New(  LUCSCALARFIELDCROSSSECTION_DEFARGS  ) 
+{
+	lucScalarFieldCrossSection*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucScalarFieldCrossSection) );
+	self = (lucScalarFieldCrossSection*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucScalarFieldCrossSection_Init( 
+		lucScalarFieldCrossSection*                                  self,
+		Name                                                         fieldVariableName,
+		lucColourMap*                                                colourMap,
+		IJK                                                          resolution,
+		lucCrossSection*                                             crossSection,
+		XYZ                                                          minCropValues,
+		XYZ                                                          maxCropValues ) 
+{
+//	self->fieldVariable = fieldVariable;
+	self->fieldVariableName = fieldVariableName;
+	self->colourMap = colourMap;
+	memcpy( self->resolution, resolution, sizeof(IJK) );
+	memcpy( self->minCropValues, minCropValues, sizeof(XYZ) );
+	memcpy( self->maxCropValues, maxCropValues, sizeof(XYZ) );
+	self->crossSection = crossSection;
+}
+
+void _lucScalarFieldCrossSection_Delete( void* drawingObject ) {
+	lucScalarFieldCrossSection*  self = (lucScalarFieldCrossSection*)drawingObject;
+
+   lucCrossSection_Delete(self->crossSection);
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucScalarFieldCrossSection_Print( void* drawingObject, Stream* stream ) {
+	lucScalarFieldCrossSection*  self = (lucScalarFieldCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucScalarFieldCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucScalarFieldCrossSection*  self = (lucScalarFieldCrossSection*)drawingObject;
+	lucScalarFieldCrossSection* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucScalarFieldCrossSection_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucScalarFieldCrossSection);
+	Type                                                             type = lucScalarFieldCrossSection_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucScalarFieldCrossSection_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucScalarFieldCrossSection_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucScalarFieldCrossSection_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucScalarFieldCrossSection_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucScalarFieldCrossSection_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucScalarFieldCrossSection_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucScalarFieldCrossSection_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucScalarFieldCrossSection_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucScalarFieldCrossSection_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucScalarFieldCrossSection_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucScalarFieldCrossSection_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucScalarFieldCrossSection_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucScalarFieldCrossSection_New(  LUCSCALARFIELDCROSSSECTION_PASSARGS  );
+}
+
+void _lucScalarFieldCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucScalarFieldCrossSection*     self = (lucScalarFieldCrossSection*)drawingObject;
+	lucColourMap*    colourMap;
+	Index            defaultResolution;
+	IJK              resolution;
+	Name             fieldVariableName;
+	XYZ              minCropValues;
+	XYZ              maxCropValues;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	fieldVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", "defaultName"  );
+
+	/* This variable is now construct in build phase.
+	   fieldVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, "FieldVariable", FieldVariable, True ) ;
+	*/
+
+
+	colourMap = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, True, data  ) ;
+
+	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 128  );
+	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
+	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
+	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
+			
+	/* Get Values with which to crop the cross section */
+	minCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropX", -HUGE_VAL  );
+	minCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropY", -HUGE_VAL  );
+	minCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropZ", -HUGE_VAL  );
+	maxCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropX", +HUGE_VAL  );
+	maxCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropY", +HUGE_VAL  );
+	maxCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropZ", +HUGE_VAL  );
+	
+	_lucScalarFieldCrossSection_Init( 
+			self, 
+			fieldVariableName,
+			colourMap,
+			resolution,
+			lucCrossSection_Read(cf, self->name),
+			minCropValues,
+			maxCropValues );
+}
+
+void _lucScalarFieldCrossSection_Build( void* drawingObject, void* data ) {
+	lucScalarFieldCrossSection*     self        = (lucScalarFieldCrossSection*)drawingObject;
+	AbstractContext*                context     = self->context;
+	Stg_ComponentFactory*           cf          = context->CF;
+	Stream*                         errorStream = Journal_Register( Error_Type, (Name)self->type  );
+
+	/* HACK - Get pointer to FieldVariable in build phase just to let FieldVariables be created in plugins */
+	self->fieldVariable = Stg_ComponentFactory_ConstructByName( cf, (Name)self->fieldVariableName, FieldVariable, True, data  ); 
+	Journal_Firewall( self->fieldVariable->fieldComponentCount == 1, errorStream,
+		"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
+		"can only visualise FieldVariables with 1 component. Did you mean to visualise the "
+		"magnitude of the given field?\n", __func__, self->fieldVariable->name,
+		self->fieldVariable->fieldComponentCount, self->type );
+}
+
+void _lucScalarFieldCrossSection_Initialise( void* drawingObject, void* data ) {}
+void _lucScalarFieldCrossSection_Execute( void* drawingObject, void* data ) {}
+void _lucScalarFieldCrossSection_Destroy( void* drawingObject, void* data ) {}
+
+void _lucScalarFieldCrossSection_Setup( void* drawingObject, void* _context ) {
+	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
+
+	lucColourMap_CalibrateFromFieldVariable( self->colourMap, self->fieldVariable );
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+	
+void _lucScalarFieldCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucScalarFieldCrossSection_CleanUp( void* drawingObject, void* _context ) {
+	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+
+void _lucScalarFieldCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
+	lucScalarFieldCrossSection_DrawCrossSection( self, self->crossSection );
+}
+
+#define FUDGE_FACTOR 0.0001
+
+void lucScalarFieldCrossSection_DrawCrossSection( void* drawingObject, lucCrossSection* crossSection ) {
+	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
+	FieldVariable* fieldVariable = self->fieldVariable;
+   Axis           axis = crossSection->axis;
+	Axis           aAxis;
+	Axis           bAxis;
+	Coord          min, globalMin;
+	Coord          max, globalMax;
+	Coord          pos;
+	Coord          interpolationCoord;
+	float          normal[3];
+	Index          aResolution;
+	Index          bResolution;
+	Index          aIndex;
+	Index          bIndex;
+	double         aLength;
+	double         bLength;
+	Dimension_Index dim_I;
+
+	/* Ensure the field is synchronised. */
+	lucOpenGLDrawingObject_SyncShadowValues( self, self->fieldVariable );
+	
+	glDisable(GL_LIGHTING);
+	
+	aAxis = ( axis == I_AXIS ? J_AXIS : I_AXIS );
+	bAxis = ( axis == K_AXIS ? J_AXIS : K_AXIS );
+	
+	aResolution = self->resolution[ aAxis ];
+	bResolution = self->resolution[ bAxis ];
+	
+	FieldVariable_GetMinAndMaxGlobalCoords( fieldVariable, globalMin, globalMax );
+	FieldVariable_GetMinAndMaxLocalCoords( fieldVariable, min, max );
+
+	/* Crop the size of the cros-section that you wish to draw */
+	for ( dim_I = 0 ; dim_I < fieldVariable->dim ; dim_I++ ) {
+		min[ dim_I ] = MAX( self->minCropValues[ dim_I ], min[ dim_I ]);
+		max[ dim_I ] = MIN( self->maxCropValues[ dim_I ], max[ dim_I ]);
+	}
+
+	/* Find position of cross section */
+	pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
+	Journal_DPrintfL( self->debugStream, 2, 
+			"%s called on field %s, with res[A] as %u, res[B] as %u, axis of cross section as %d, crossSection value as %g\n",
+			__func__, fieldVariable->name, aResolution, bResolution, axis, pos[axis]);
+	
+
+	/* Create normal */
+	normal[axis]  = 1.0;
+	normal[aAxis] = 0.0;
+	normal[bAxis] = 0.0;
+	glNormal3fv( normal );
+
+	aLength = (max[aAxis] - min[aAxis])/(double)aResolution;
+	bLength = (max[bAxis] - min[bAxis])/(double)bResolution;
+
+	Journal_DPrintfL( self->debugStream, 2, "Calculated aLength as %g, bLength as %g\n", aLength, bLength );
+
+	/* Plot a number of tiles with a colour map to represent scalar field */
+	/* OpenGL will interpolate colours within tile */
+	for ( aIndex = 0 ; aIndex < aResolution + 1 ; aIndex++ ) {
+		glBegin(GL_QUAD_STRIP);
+		for ( bIndex = 0 ; bIndex < bResolution + 2 ; bIndex++ ) {
+			/* Get position */
+			pos[ aAxis ] = min[ aAxis ] + (double)aIndex * aLength;
+			pos[ bAxis ] = min[ bAxis ] + (double)bIndex * bLength;
+
+			memcpy( interpolationCoord, pos, sizeof(Coord) );
+
+			if ( pos[ bAxis ] >= max[ bAxis ] ) { 
+				pos[ bAxis ] = max[ bAxis ];
+				interpolationCoord[ bAxis ] = max[ bAxis ] - FUDGE_FACTOR/bLength;
+			}
+			if (pos[ aAxis ] >= max[ aAxis ]) {
+				pos[ aAxis ] = max[ aAxis ];
+				interpolationCoord[ aAxis ] = max[ aAxis ] - FUDGE_FACTOR/aLength;
+			}
+			
+			/* Plot bottom left corner of coloured tile */
+			lucScalarFieldCrossSection_PlotColouredVertex( self, interpolationCoord, pos );
+
+			/* Plot top left corner of coloured tile */
+			pos[ aAxis ] += aLength;
+			if (pos[ aAxis ] >= max[ aAxis ]) {
+				pos[ aAxis ] = max[ aAxis ];
+				interpolationCoord[ aAxis ] = max[ aAxis ] - FUDGE_FACTOR/aLength;
+			}
+			else
+				interpolationCoord[ aAxis ] = pos[ aAxis ];
+			
+			lucScalarFieldCrossSection_PlotColouredVertex( self, interpolationCoord, pos );
+		}
+		glEnd();
+	}
+
+	glEnable(GL_LIGHTING);
+}
+
+Bool lucScalarFieldCrossSection_PlotColouredVertex( void* drawingObject, Coord interpolationCoord, Coord plotCoord ) {
+	lucScalarFieldCrossSection*       self            = (lucScalarFieldCrossSection*)drawingObject;
+	Bool result;
+	FieldVariable* fieldVariable = self->fieldVariable;
+	lucColourMap*  cmap          = self->colourMap;
+	double         quantity;
+
+	Journal_DPrintfL( self->debugStream, 3, "%s called at interpolationCoord (%g,%g,%g)  - ",
+			__func__, interpolationCoord[0], interpolationCoord[1], interpolationCoord[2] );
+
+	/* Interpolate value to this position */
+	result = FieldVariable_InterpolateValueAt( fieldVariable, interpolationCoord, &quantity );
+	if ( LOCAL == result || SHADOW == result ) {
+		/* Get colour for this value from colour map */
+		lucColourMap_SetOpenGLColourFromValue( cmap, quantity );
+
+		Journal_DPrintfL( self->debugStream, 3, "%s is %g there.\n", fieldVariable->name, quantity );
+		
+		Journal_DPrintfL( self->debugStream, 3, "Plotting At Vertex (%g,%g,%g).\n", 
+				plotCoord[0], plotCoord[1], plotCoord[2]  );
+
+		/* Plot Vertex */
+		glVertex3dv(plotCoord);
+
+		return True;
+	}
+
+	Journal_DPrintfL( self->debugStream, 3, "%s NOT FOUND THERE.\n", fieldVariable->name );
+	/* If value could not be interpolated return warning */
+	return False;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ScalarFieldOnMesh.c
--- a/DrawingObjects/src/ScalarFieldOnMesh.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,211 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: ScalarField.c 564 2006-05-12 07:36:25Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "ScalarFieldOnMeshCrossSection.h"
-#include "ScalarFieldOnMesh.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucScalarFieldOnMesh_Type = "lucScalarFieldOnMesh";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucScalarFieldOnMesh* _lucScalarFieldOnMesh_New(  LUCSCALARFIELDONMESH_DEFARGS  ) 
-{
-	lucScalarFieldOnMesh*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucScalarFieldOnMesh) );
-	self = (lucScalarFieldOnMesh*) _lucScalarFieldOnMeshCrossSection_New(  LUCSCALARFIELDONMESHCROSSSECTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucScalarFieldOnMesh_Init( 
-		lucScalarFieldOnMesh*                                              self,
-		Bool                                                         cullFace )
-{
-	self->cullFace = cullFace;
-}
-
-void _lucScalarFieldOnMesh_Delete( void* drawingObject ) {
-	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
-
-	_lucScalarFieldOnMeshCrossSection_Delete( self );
-}
-
-void _lucScalarFieldOnMesh_Print( void* drawingObject, Stream* stream ) {
-	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
-
-	_lucScalarFieldOnMeshCrossSection_Print( self, stream );
-}
-
-void* _lucScalarFieldOnMesh_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
-	lucScalarFieldOnMesh* newDrawingObject;
-
-	newDrawingObject = _lucScalarFieldOnMeshCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucScalarFieldOnMesh_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucScalarFieldOnMesh);
-	Type                                                             type = lucScalarFieldOnMesh_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucScalarFieldOnMesh_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucScalarFieldOnMesh_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucScalarFieldOnMesh_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucScalarFieldOnMesh_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucScalarFieldOnMesh_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucScalarFieldOnMesh_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucScalarFieldOnMesh_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucScalarFieldOnMesh_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucScalarFieldOnMesh_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucScalarFieldOnMesh_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucScalarFieldOnMesh_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucScalarFieldOnMesh_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucScalarFieldOnMesh_New(  LUCSCALARFIELDONMESH_PASSARGS  );
-}
-
-void _lucScalarFieldOnMesh_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
-
-	/* Construct Parent */
-	_lucScalarFieldOnMeshCrossSection_AssignFromXML( self, cf, data );
-
-	_lucScalarFieldOnMesh_Init( 
-			self, 
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFace", True )  );
-}
-
-void _lucScalarFieldOnMesh_Build( void* drawingObject, void* data ) {
-	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
-
-	/* Call parent function */
-	_lucScalarFieldOnMeshCrossSection_Build( self, data );
-}
-void _lucScalarFieldOnMesh_Initialise( void* drawingObject, void* data ) {
-	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
-
-	/* Call parent function */
-	_lucScalarFieldOnMeshCrossSection_Initialise( self, data );
-}
-void _lucScalarFieldOnMesh_Execute( void* drawingObject, void* data ) {}
-void _lucScalarFieldOnMesh_Destroy( void* drawingObject, void* data ) {}
-
-void _lucScalarFieldOnMesh_Setup( void* drawingObject, void* _context ) {
-	lucScalarFieldOnMesh*          self          = (lucScalarFieldOnMesh*)drawingObject;
-	
-	_lucScalarFieldOnMeshCrossSection_Setup( self, _context );
-}
-	
-void _lucScalarFieldOnMesh_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucScalarFieldOnMesh*          self          = (lucScalarFieldOnMesh*)drawingObject;
-	
-	_lucScalarFieldOnMeshCrossSection_Draw( self, window, viewportInfo, _context );
-}
-
-void _lucScalarFieldOnMesh_CleanUp( void* drawingObject, void* _context ) {
-	lucScalarFieldOnMesh*          self          = (lucScalarFieldOnMesh*)drawingObject;
-	
-	_lucScalarFieldOnMeshCrossSection_CleanUp( self, _context );
-}
-
-void _lucScalarFieldOnMesh_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucScalarFieldOnMesh*  self          = (lucScalarFieldOnMesh*)drawingObject;
-	FeVariable*            fieldVariable = (FeVariable*) self->fieldVariable;
-	Mesh*                  mesh          = (Mesh*) fieldVariable->feMesh;
-	Grid*                  vertGrid;
-
-	vertGrid = *(Grid**)ExtensionManager_Get( mesh->info, mesh, self->vertexGridHandle );
-	
-	if (fieldVariable->dim == 2) {
-		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, K_AXIS );
-	}
-	else {
-		if ( self->cullFace ) 
-			glEnable(GL_CULL_FACE);
-	
-		glFrontFace(GL_CCW);
-		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, I_AXIS );
-		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ J_AXIS ] - 1, J_AXIS );
-		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, K_AXIS );
-	
-		glFrontFace(GL_CW);
-		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ I_AXIS ] - 1, I_AXIS );
-		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, J_AXIS );
-		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ K_AXIS ] - 1, K_AXIS );
-
-		glDisable(GL_CULL_FACE);
-	}
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ScalarFieldOnMesh.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/ScalarFieldOnMesh.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,211 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: ScalarField.c 564 2006-05-12 07:36:25Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "ScalarFieldOnMeshCrossSection.h"
+#include "ScalarFieldOnMesh.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucScalarFieldOnMesh_Type = "lucScalarFieldOnMesh";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucScalarFieldOnMesh* _lucScalarFieldOnMesh_New(  LUCSCALARFIELDONMESH_DEFARGS  ) 
+{
+	lucScalarFieldOnMesh*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucScalarFieldOnMesh) );
+	self = (lucScalarFieldOnMesh*) _lucScalarFieldOnMeshCrossSection_New(  LUCSCALARFIELDONMESHCROSSSECTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucScalarFieldOnMesh_Init( 
+		lucScalarFieldOnMesh*                                              self,
+		Bool                                                         cullFace )
+{
+	self->cullFace = cullFace;
+}
+
+void _lucScalarFieldOnMesh_Delete( void* drawingObject ) {
+	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
+
+	_lucScalarFieldOnMeshCrossSection_Delete( self );
+}
+
+void _lucScalarFieldOnMesh_Print( void* drawingObject, Stream* stream ) {
+	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
+
+	_lucScalarFieldOnMeshCrossSection_Print( self, stream );
+}
+
+void* _lucScalarFieldOnMesh_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
+	lucScalarFieldOnMesh* newDrawingObject;
+
+	newDrawingObject = _lucScalarFieldOnMeshCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucScalarFieldOnMesh_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucScalarFieldOnMesh);
+	Type                                                             type = lucScalarFieldOnMesh_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucScalarFieldOnMesh_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucScalarFieldOnMesh_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucScalarFieldOnMesh_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucScalarFieldOnMesh_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucScalarFieldOnMesh_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucScalarFieldOnMesh_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucScalarFieldOnMesh_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucScalarFieldOnMesh_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucScalarFieldOnMesh_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucScalarFieldOnMesh_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucScalarFieldOnMesh_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucScalarFieldOnMesh_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucScalarFieldOnMesh_New(  LUCSCALARFIELDONMESH_PASSARGS  );
+}
+
+void _lucScalarFieldOnMesh_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
+
+	/* Construct Parent */
+	_lucScalarFieldOnMeshCrossSection_AssignFromXML( self, cf, data );
+
+	_lucScalarFieldOnMesh_Init( 
+			self, 
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"cullFace", True )  );
+}
+
+void _lucScalarFieldOnMesh_Build( void* drawingObject, void* data ) {
+	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
+
+	/* Call parent function */
+	_lucScalarFieldOnMeshCrossSection_Build( self, data );
+}
+void _lucScalarFieldOnMesh_Initialise( void* drawingObject, void* data ) {
+	lucScalarFieldOnMesh*  self = (lucScalarFieldOnMesh*)drawingObject;
+
+	/* Call parent function */
+	_lucScalarFieldOnMeshCrossSection_Initialise( self, data );
+}
+void _lucScalarFieldOnMesh_Execute( void* drawingObject, void* data ) {}
+void _lucScalarFieldOnMesh_Destroy( void* drawingObject, void* data ) {}
+
+void _lucScalarFieldOnMesh_Setup( void* drawingObject, void* _context ) {
+	lucScalarFieldOnMesh*          self          = (lucScalarFieldOnMesh*)drawingObject;
+	
+	_lucScalarFieldOnMeshCrossSection_Setup( self, _context );
+}
+	
+void _lucScalarFieldOnMesh_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucScalarFieldOnMesh*          self          = (lucScalarFieldOnMesh*)drawingObject;
+	
+	_lucScalarFieldOnMeshCrossSection_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucScalarFieldOnMesh_CleanUp( void* drawingObject, void* _context ) {
+	lucScalarFieldOnMesh*          self          = (lucScalarFieldOnMesh*)drawingObject;
+	
+	_lucScalarFieldOnMeshCrossSection_CleanUp( self, _context );
+}
+
+void _lucScalarFieldOnMesh_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucScalarFieldOnMesh*  self          = (lucScalarFieldOnMesh*)drawingObject;
+	FeVariable*            fieldVariable = (FeVariable*) self->fieldVariable;
+	Mesh*                  mesh          = (Mesh*) fieldVariable->feMesh;
+	Grid*                  vertGrid;
+
+	vertGrid = *(Grid**)ExtensionManager_Get( mesh->info, mesh, self->vertexGridHandle );
+	
+	if (fieldVariable->dim == 2) {
+		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, K_AXIS );
+	}
+	else {
+		if ( self->cullFace ) 
+			glEnable(GL_CULL_FACE);
+	
+		glFrontFace(GL_CCW);
+		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, I_AXIS );
+		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ J_AXIS ] - 1, J_AXIS );
+		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, K_AXIS );
+	
+		glFrontFace(GL_CW);
+		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ I_AXIS ] - 1, I_AXIS );
+		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, 0, J_AXIS );
+		lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, vertGrid->sizes[ K_AXIS ] - 1, K_AXIS );
+
+		glDisable(GL_CULL_FACE);
+	}
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ScalarFieldOnMeshCrossSection.c
--- a/DrawingObjects/src/ScalarFieldOnMeshCrossSection.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,333 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: ScalarFieldCrossSection.c 568 2006-06-02 06:21:50Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#ifdef GLUCIFER_USE_PICELLERATOR
-	#include <StgFEM/StgFEM.h>
-	#include <PICellerator/PICellerator.h>
-#endif
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "ScalarFieldOnMeshCrossSection.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-#include <ctype.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucScalarFieldOnMeshCrossSection_Type = "lucScalarFieldOnMeshCrossSection";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucScalarFieldOnMeshCrossSection* _lucScalarFieldOnMeshCrossSection_New(  LUCSCALARFIELDONMESHCROSSSECTION_DEFARGS  ) 
-{
-	lucScalarFieldOnMeshCrossSection*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucScalarFieldOnMeshCrossSection) );
-	self = (lucScalarFieldOnMeshCrossSection*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucScalarFieldOnMeshCrossSection_Init( 
-		lucScalarFieldOnMeshCrossSection*                            self,
-		Name                                                         fieldVariableName,
-		lucColourMap*                                                colourMap,
-		Node_Index                                                   crossSection_I,
-		Axis                                                         crossSectionAxis,
-		XYZ                                                          minCropValues,
-		XYZ                                                          maxCropValues ) 
-{
-//	self->fieldVariable = fieldVariable;
-	self->fieldVariableName = fieldVariableName;
-	self->colourMap = colourMap;
-	self->crossSection_I = crossSection_I;
-	self->crossSectionAxis = crossSectionAxis;
-	memcpy( self->minCropValues, minCropValues, sizeof(XYZ) );
-	memcpy( self->maxCropValues, maxCropValues, sizeof(XYZ) );
-}
-
-void _lucScalarFieldOnMeshCrossSection_Delete( void* drawingObject ) {
-	lucScalarFieldOnMeshCrossSection*  self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucScalarFieldOnMeshCrossSection_Print( void* drawingObject, Stream* stream ) {
-	lucScalarFieldOnMeshCrossSection*  self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucScalarFieldOnMeshCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucScalarFieldOnMeshCrossSection*  self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-	lucScalarFieldOnMeshCrossSection* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucScalarFieldOnMeshCrossSection_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucScalarFieldOnMeshCrossSection);
-	Type                                                             type = lucScalarFieldOnMeshCrossSection_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucScalarFieldOnMeshCrossSection_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucScalarFieldOnMeshCrossSection_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucScalarFieldOnMeshCrossSection_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucScalarFieldOnMeshCrossSection_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucScalarFieldOnMeshCrossSection_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucScalarFieldOnMeshCrossSection_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucScalarFieldOnMeshCrossSection_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucScalarFieldOnMeshCrossSection_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucScalarFieldOnMeshCrossSection_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucScalarFieldOnMeshCrossSection_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucScalarFieldOnMeshCrossSection_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucScalarFieldOnMeshCrossSection_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucScalarFieldOnMeshCrossSection_New(  LUCSCALARFIELDONMESHCROSSSECTION_PASSARGS  );
-}
-
-void _lucScalarFieldOnMeshCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucScalarFieldOnMeshCrossSection*     self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-	lucColourMap*    colourMap;
-	char             axisChar;
-	Node_Index       value               = 0;
-	Axis             axis                = 0;
-	Name             crossSectionName;
-	Name             fieldVariableName;
-	XYZ              minCropValues;
-	XYZ              maxCropValues;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	fieldVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", "defaultName"  );
-	
-	/* This variable is now constructed in the build phase 	
-	fieldVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, "FieldVariable", FieldVariable, True ) ;
-	*/
-	
-	colourMap = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, True, data  );
-
-	crossSectionName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"crossSection", ""  );
-	if ( sscanf( crossSectionName, "%c=%d", &axisChar, &value ) == 2 ) {
-		if ( toupper( axisChar ) >= 'X' )
-			axis = toupper( axisChar ) - 'X';
-	}
-
-	/* Get Values with which to crop the cross section */
-	minCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropX", -HUGE_VAL  );
-	minCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropY", -HUGE_VAL  );
-	minCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropZ", -HUGE_VAL  );
-	maxCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropX", +HUGE_VAL  );
-	maxCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropY", +HUGE_VAL  );
-	maxCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropZ", +HUGE_VAL  );
-	
-	_lucScalarFieldOnMeshCrossSection_Init( 
-			self, 
-			fieldVariableName,
-			colourMap,
-			value,
-			axis,
-			minCropValues,
-			maxCropValues );
-}
-
-void _lucScalarFieldOnMeshCrossSection_Build( void* drawingObject, void* data ) {
-	lucScalarFieldOnMeshCrossSection*     self    = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-	FeVariable*                     feVariable;
-	Mesh*                           mesh;
-	Stream*                         errorStream = Journal_Register( Error_Type, (Name)self->type  );
-	
-
-	/* HACK - Get pointer to FieldVariable in build phase just to let FieldVariables be created in plugins */
-	feVariable =  Stg_ComponentFactory_ConstructByName( self->context->CF, (Name)self->fieldVariableName, FeVariable, True, 0 /* dummy */ );
-	self->fieldVariable = (FieldVariable* ) feVariable;
-
-	Journal_Firewall( self->fieldVariable->fieldComponentCount == 1, errorStream,
-		"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
-		"can only visualise FieldVariables with 1 component. Did you mean to visualise the "
-		"magnitude of the given field?\n", __func__, self->fieldVariable->name,
-		self->fieldVariable->fieldComponentCount, self->type );
-
-	Stg_Component_Build( feVariable, data, False );
-	mesh    = (Mesh*) feVariable->feMesh;
-
-	/* Store the Vertex Grid */
-	self->vertexGridHandle = ExtensionManager_GetHandle( mesh->info, (Name)"vertexGrid" );
-	if ( self->vertexGridHandle == (ExtensionInfo_Index)-1 )
-
-	Journal_Firewall( self->vertexGridHandle != (ExtensionInfo_Index )-1, errorStream,
-		"Error - in %s(): provided FieldVariable \"%s\" doesn't have a Vertex Grid.\n"
-		"Try visualising with lucScalarField instead.\n", __func__, self->fieldVariable->name );
-		
-}
-
-void _lucScalarFieldOnMeshCrossSection_Initialise( void* drawingObject, void* data ) {}
-void _lucScalarFieldOnMeshCrossSection_Execute( void* drawingObject, void* data ) {}
-void _lucScalarFieldOnMeshCrossSection_Destroy( void* drawingObject, void* data ) {}
-
-void _lucScalarFieldOnMeshCrossSection_Setup( void* drawingObject, void* _context ) {
-	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-
-	lucColourMap_CalibrateFromFieldVariable( self->colourMap, self->fieldVariable );
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-	
-void _lucScalarFieldOnMeshCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucScalarFieldOnMeshCrossSection_CleanUp( void* drawingObject, void* _context ) {
-	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}
-
-void _lucScalarFieldOnMeshCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-	lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, self->crossSection_I, self->crossSectionAxis );
-}
-
-void lucScalarFieldOnMeshCrossSection_DrawCrossSection( void* drawingObject, Node_LocalIndex crossSection_I, Axis axis ) {
-	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-	FeVariable*          fieldVariable = (FeVariable*) self->fieldVariable;
-	Mesh*                mesh          = (Mesh*) fieldVariable->feMesh;
-	Axis                 aAxis;
-	Axis                 bAxis;
-	Grid*                vertGrid;
-	IJK                  node_ijk;
-	float                normal[3];
-	Node_GlobalIndex     node_gI;
-	Node_DomainIndex     node_dI_1, node_dI_2;
-	Node_DomainIndex     nDomainNodes;
-
-	glDisable(GL_LIGHTING);
-	
-	/* Get Axis Directions */
-	aAxis = ( axis == I_AXIS ? J_AXIS : I_AXIS );
-	bAxis = ( axis == K_AXIS ? J_AXIS : K_AXIS );
-	
-	vertGrid = *(Grid**)ExtensionManager_Get( mesh->info, mesh, self->vertexGridHandle );
-	
-	Journal_DPrintfL( self->debugStream, 2, 
-			"%s called on field %s, with axis of cross section as %d, crossSection_I as %d\n",
-			__func__, fieldVariable->name, axis, crossSection_I );
-	
-	/* Create normal */
-	normal[axis]  = 1.0;
-	normal[aAxis] = 0.0;
-	normal[bAxis] = 0.0;
-	glNormal3fv( normal );
-
-	nDomainNodes = Mesh_GetDomainSize( mesh, MT_VERTEX );
-
-	/* Plots cross section */
-	node_ijk[ axis ] = crossSection_I;
-	for ( node_ijk[ aAxis ] = 0 ; node_ijk[ aAxis ] < vertGrid->sizes[ aAxis ] - 1 ; node_ijk[ aAxis ]++ ) {
-		glBegin(GL_QUAD_STRIP);
-		for ( node_ijk[ bAxis ] = 0 ; node_ijk[ bAxis ] < vertGrid->sizes[ bAxis ] ; node_ijk[ bAxis ]++ ) {
-			node_gI = Grid_Project( vertGrid, node_ijk );
-			/* Get Local Node Index */
-			if( !Mesh_GlobalToDomain( mesh, MT_VERTEX, node_gI, &node_dI_1 ) || node_dI_1 >= nDomainNodes ){
-				continue;
-			}
-			
-			node_ijk[ aAxis ]++;
-			node_gI = Grid_Project( vertGrid, node_ijk );
-			/* Get Local Node Index */
-			if( !Mesh_GlobalToDomain( mesh, MT_VERTEX, node_gI, &node_dI_2 ) || node_dI_2 >= nDomainNodes ){
-				continue;
-			}
-			lucScalarFieldOnMeshCrossSection_PlotColouredNode( self, node_dI_1 );
-			lucScalarFieldOnMeshCrossSection_PlotColouredNode( self, node_dI_2 );
-			node_ijk[ aAxis ]--;
-
-			/* TODO Cropping */
-		}
-		glEnd();
-	}
-	glEnable(GL_LIGHTING);
-}
-
-void lucScalarFieldOnMeshCrossSection_PlotColouredNode( void* drawingObject, Node_LocalIndex lNode_I ) {
-	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
-	FeVariable*    fieldVariable = (FeVariable*) self->fieldVariable;
-	lucColourMap*  cmap          = self->colourMap;
-	double         quantity;
-
-	/* Get colour for vertex */
-	FeVariable_GetValueAtNode( fieldVariable, lNode_I, &quantity );
-	lucColourMap_SetOpenGLColourFromValue( cmap, quantity );
-	
-	/* Plot vertex */
-	if ( fieldVariable->dim == 2 )
-		glVertex2dv( fieldVariable->feMesh->verts[lNode_I] );
-	else 
-		glVertex3dv( fieldVariable->feMesh->verts[lNode_I] );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/ScalarFieldOnMeshCrossSection.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/ScalarFieldOnMeshCrossSection.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,333 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: ScalarFieldCrossSection.c 568 2006-06-02 06:21:50Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#ifdef GLUCIFER_USE_PICELLERATOR
+	#include <StgFEM/StgFEM.h>
+	#include <PICellerator/PICellerator.h>
+#endif
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "ScalarFieldOnMeshCrossSection.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+#include <ctype.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucScalarFieldOnMeshCrossSection_Type = "lucScalarFieldOnMeshCrossSection";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucScalarFieldOnMeshCrossSection* _lucScalarFieldOnMeshCrossSection_New(  LUCSCALARFIELDONMESHCROSSSECTION_DEFARGS  ) 
+{
+	lucScalarFieldOnMeshCrossSection*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucScalarFieldOnMeshCrossSection) );
+	self = (lucScalarFieldOnMeshCrossSection*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucScalarFieldOnMeshCrossSection_Init( 
+		lucScalarFieldOnMeshCrossSection*                            self,
+		Name                                                         fieldVariableName,
+		lucColourMap*                                                colourMap,
+		Node_Index                                                   crossSection_I,
+		Axis                                                         crossSectionAxis,
+		XYZ                                                          minCropValues,
+		XYZ                                                          maxCropValues ) 
+{
+//	self->fieldVariable = fieldVariable;
+	self->fieldVariableName = fieldVariableName;
+	self->colourMap = colourMap;
+	self->crossSection_I = crossSection_I;
+	self->crossSectionAxis = crossSectionAxis;
+	memcpy( self->minCropValues, minCropValues, sizeof(XYZ) );
+	memcpy( self->maxCropValues, maxCropValues, sizeof(XYZ) );
+}
+
+void _lucScalarFieldOnMeshCrossSection_Delete( void* drawingObject ) {
+	lucScalarFieldOnMeshCrossSection*  self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucScalarFieldOnMeshCrossSection_Print( void* drawingObject, Stream* stream ) {
+	lucScalarFieldOnMeshCrossSection*  self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucScalarFieldOnMeshCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucScalarFieldOnMeshCrossSection*  self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+	lucScalarFieldOnMeshCrossSection* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucScalarFieldOnMeshCrossSection_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucScalarFieldOnMeshCrossSection);
+	Type                                                             type = lucScalarFieldOnMeshCrossSection_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucScalarFieldOnMeshCrossSection_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucScalarFieldOnMeshCrossSection_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucScalarFieldOnMeshCrossSection_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucScalarFieldOnMeshCrossSection_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucScalarFieldOnMeshCrossSection_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucScalarFieldOnMeshCrossSection_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucScalarFieldOnMeshCrossSection_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucScalarFieldOnMeshCrossSection_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucScalarFieldOnMeshCrossSection_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucScalarFieldOnMeshCrossSection_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucScalarFieldOnMeshCrossSection_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucScalarFieldOnMeshCrossSection_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucScalarFieldOnMeshCrossSection_New(  LUCSCALARFIELDONMESHCROSSSECTION_PASSARGS  );
+}
+
+void _lucScalarFieldOnMeshCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucScalarFieldOnMeshCrossSection*     self = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+	lucColourMap*    colourMap;
+	char             axisChar;
+	Node_Index       value               = 0;
+	Axis             axis                = 0;
+	Name             crossSectionName;
+	Name             fieldVariableName;
+	XYZ              minCropValues;
+	XYZ              maxCropValues;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	fieldVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"FieldVariable", "defaultName"  );
+	
+	/* This variable is now constructed in the build phase 	
+	fieldVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, "FieldVariable", FieldVariable, True ) ;
+	*/
+	
+	colourMap = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, True, data  );
+
+	crossSectionName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"crossSection", ""  );
+	if ( sscanf( crossSectionName, "%c=%d", &axisChar, &value ) == 2 ) {
+		if ( toupper( axisChar ) >= 'X' )
+			axis = toupper( axisChar ) - 'X';
+	}
+
+	/* Get Values with which to crop the cross section */
+	minCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropX", -HUGE_VAL  );
+	minCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropY", -HUGE_VAL  );
+	minCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minCropZ", -HUGE_VAL  );
+	maxCropValues[ I_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropX", +HUGE_VAL  );
+	maxCropValues[ J_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropY", +HUGE_VAL  );
+	maxCropValues[ K_AXIS ] = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxCropZ", +HUGE_VAL  );
+	
+	_lucScalarFieldOnMeshCrossSection_Init( 
+			self, 
+			fieldVariableName,
+			colourMap,
+			value,
+			axis,
+			minCropValues,
+			maxCropValues );
+}
+
+void _lucScalarFieldOnMeshCrossSection_Build( void* drawingObject, void* data ) {
+	lucScalarFieldOnMeshCrossSection*     self    = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+	FeVariable*                     feVariable;
+	Mesh*                           mesh;
+	Stream*                         errorStream = Journal_Register( Error_Type, (Name)self->type  );
+	
+
+	/* HACK - Get pointer to FieldVariable in build phase just to let FieldVariables be created in plugins */
+	feVariable =  Stg_ComponentFactory_ConstructByName( self->context->CF, (Name)self->fieldVariableName, FeVariable, True, 0 /* dummy */ );
+	self->fieldVariable = (FieldVariable* ) feVariable;
+
+	Journal_Firewall( self->fieldVariable->fieldComponentCount == 1, errorStream,
+		"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
+		"can only visualise FieldVariables with 1 component. Did you mean to visualise the "
+		"magnitude of the given field?\n", __func__, self->fieldVariable->name,
+		self->fieldVariable->fieldComponentCount, self->type );
+
+	Stg_Component_Build( feVariable, data, False );
+	mesh    = (Mesh*) feVariable->feMesh;
+
+	/* Store the Vertex Grid */
+	self->vertexGridHandle = ExtensionManager_GetHandle( mesh->info, (Name)"vertexGrid" );
+	if ( self->vertexGridHandle == (ExtensionInfo_Index)-1 )
+
+	Journal_Firewall( self->vertexGridHandle != (ExtensionInfo_Index )-1, errorStream,
+		"Error - in %s(): provided FieldVariable \"%s\" doesn't have a Vertex Grid.\n"
+		"Try visualising with lucScalarField instead.\n", __func__, self->fieldVariable->name );
+		
+}
+
+void _lucScalarFieldOnMeshCrossSection_Initialise( void* drawingObject, void* data ) {}
+void _lucScalarFieldOnMeshCrossSection_Execute( void* drawingObject, void* data ) {}
+void _lucScalarFieldOnMeshCrossSection_Destroy( void* drawingObject, void* data ) {}
+
+void _lucScalarFieldOnMeshCrossSection_Setup( void* drawingObject, void* _context ) {
+	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+
+	lucColourMap_CalibrateFromFieldVariable( self->colourMap, self->fieldVariable );
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+	
+void _lucScalarFieldOnMeshCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucScalarFieldOnMeshCrossSection_CleanUp( void* drawingObject, void* _context ) {
+	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+
+void _lucScalarFieldOnMeshCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+	lucScalarFieldOnMeshCrossSection_DrawCrossSection( self, self->crossSection_I, self->crossSectionAxis );
+}
+
+void lucScalarFieldOnMeshCrossSection_DrawCrossSection( void* drawingObject, Node_LocalIndex crossSection_I, Axis axis ) {
+	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+	FeVariable*          fieldVariable = (FeVariable*) self->fieldVariable;
+	Mesh*                mesh          = (Mesh*) fieldVariable->feMesh;
+	Axis                 aAxis;
+	Axis                 bAxis;
+	Grid*                vertGrid;
+	IJK                  node_ijk;
+	float                normal[3];
+	Node_GlobalIndex     node_gI;
+	Node_DomainIndex     node_dI_1, node_dI_2;
+	Node_DomainIndex     nDomainNodes;
+
+	glDisable(GL_LIGHTING);
+	
+	/* Get Axis Directions */
+	aAxis = ( axis == I_AXIS ? J_AXIS : I_AXIS );
+	bAxis = ( axis == K_AXIS ? J_AXIS : K_AXIS );
+	
+	vertGrid = *(Grid**)ExtensionManager_Get( mesh->info, mesh, self->vertexGridHandle );
+	
+	Journal_DPrintfL( self->debugStream, 2, 
+			"%s called on field %s, with axis of cross section as %d, crossSection_I as %d\n",
+			__func__, fieldVariable->name, axis, crossSection_I );
+	
+	/* Create normal */
+	normal[axis]  = 1.0;
+	normal[aAxis] = 0.0;
+	normal[bAxis] = 0.0;
+	glNormal3fv( normal );
+
+	nDomainNodes = Mesh_GetDomainSize( mesh, MT_VERTEX );
+
+	/* Plots cross section */
+	node_ijk[ axis ] = crossSection_I;
+	for ( node_ijk[ aAxis ] = 0 ; node_ijk[ aAxis ] < vertGrid->sizes[ aAxis ] - 1 ; node_ijk[ aAxis ]++ ) {
+		glBegin(GL_QUAD_STRIP);
+		for ( node_ijk[ bAxis ] = 0 ; node_ijk[ bAxis ] < vertGrid->sizes[ bAxis ] ; node_ijk[ bAxis ]++ ) {
+			node_gI = Grid_Project( vertGrid, node_ijk );
+			/* Get Local Node Index */
+			if( !Mesh_GlobalToDomain( mesh, MT_VERTEX, node_gI, &node_dI_1 ) || node_dI_1 >= nDomainNodes ){
+				continue;
+			}
+			
+			node_ijk[ aAxis ]++;
+			node_gI = Grid_Project( vertGrid, node_ijk );
+			/* Get Local Node Index */
+			if( !Mesh_GlobalToDomain( mesh, MT_VERTEX, node_gI, &node_dI_2 ) || node_dI_2 >= nDomainNodes ){
+				continue;
+			}
+			lucScalarFieldOnMeshCrossSection_PlotColouredNode( self, node_dI_1 );
+			lucScalarFieldOnMeshCrossSection_PlotColouredNode( self, node_dI_2 );
+			node_ijk[ aAxis ]--;
+
+			/* TODO Cropping */
+		}
+		glEnd();
+	}
+	glEnable(GL_LIGHTING);
+}
+
+void lucScalarFieldOnMeshCrossSection_PlotColouredNode( void* drawingObject, Node_LocalIndex lNode_I ) {
+	lucScalarFieldOnMeshCrossSection*       self            = (lucScalarFieldOnMeshCrossSection*)drawingObject;
+	FeVariable*    fieldVariable = (FeVariable*) self->fieldVariable;
+	lucColourMap*  cmap          = self->colourMap;
+	double         quantity;
+
+	/* Get colour for vertex */
+	FeVariable_GetValueAtNode( fieldVariable, lNode_I, &quantity );
+	lucColourMap_SetOpenGLColourFromValue( cmap, quantity );
+	
+	/* Plot vertex */
+	if ( fieldVariable->dim == 2 )
+		glVertex2dv( fieldVariable->feMesh->verts[lNode_I] );
+	else 
+		glVertex3dv( fieldVariable->feMesh->verts[lNode_I] );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmRGBColourViewer.c
--- a/DrawingObjects/src/SwarmRGBColourViewer.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "SwarmViewerBase.h"
-#include "SwarmViewer.h"
-#include "SwarmRGBColourViewer.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucSwarmRGBColourViewer_Type = "lucSwarmRGBColourViewer";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucSwarmRGBColourViewer* _lucSwarmRGBColourViewer_New(  LUCSWARMRGBCOLOURVIEWER_DEFARGS  ) 
-{
-	lucSwarmRGBColourViewer*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucSwarmRGBColourViewer) );
-	self = (lucSwarmRGBColourViewer*) _lucSwarmViewer_New(  LUCSWARMVIEWER_PASSARGS  );
-
-	return self;
-}
-
-void _lucSwarmRGBColourViewer_Init( 
-		lucSwarmRGBColourViewer*                                     self,
-		Name                                                         colourRedVariableName,
-		Name                                                         colourGreenVariableName,
-		Name                                                         colourBlueVariableName )
-{
-	self->colourRedVariableName           = colourRedVariableName;
-	self->colourGreenVariableName         = colourGreenVariableName;
-	self->colourBlueVariableName          = colourBlueVariableName;
-}
-
-void _lucSwarmRGBColourViewer_Delete( void* drawingObject ) {
-	lucSwarmRGBColourViewer*  self = (lucSwarmRGBColourViewer*)drawingObject;
-
-	_lucSwarmViewer_Delete( self );
-}
-
-void _lucSwarmRGBColourViewer_Print( void* drawingObject, Stream* stream ) {
-	lucSwarmRGBColourViewer*  self = (lucSwarmRGBColourViewer*)drawingObject;
-
-	_lucSwarmViewer_Print( self, stream );
-}
-
-void* _lucSwarmRGBColourViewer_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucSwarmRGBColourViewer*  self = (lucSwarmRGBColourViewer*)drawingObject;
-	lucSwarmRGBColourViewer* newDrawingObject;
-
-	newDrawingObject = _lucSwarmViewer_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucSwarmRGBColourViewer_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucSwarmRGBColourViewer);
-	Type                                                             type = lucSwarmRGBColourViewer_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucSwarmRGBColourViewer_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucSwarmRGBColourViewer_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucSwarmRGBColourViewer_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucSwarmRGBColourViewer_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucSwarmRGBColourViewer_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucSwarmRGBColourViewer_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucSwarmRGBColourViewer_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucSwarmRGBColourViewer_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucSwarmRGBColourViewer_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucSwarmRGBColourViewer_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucSwarmRGBColourViewer_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucSwarmRGBColourViewer_BuildDisplayList;
-	lucSwarmViewerBase_PlotParticleFunction*                _plotParticle = _lucSwarmViewer_PlotParticle;
-	lucSwarmViewerBase_SetParticleColourFunction*      _setParticleColour = _lucSwarmRGBColourViewer_SetParticleColour;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucSwarmRGBColourViewer_New(  LUCSWARMRGBCOLOURVIEWER_PASSARGS  );
-}
-
-void _lucSwarmRGBColourViewer_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucSwarmRGBColourViewer* self = (lucSwarmRGBColourViewer*)drawingObject;
-	Name                     colourRedVariableName;
-	Name                     colourGreenVariableName;
-	Name                     colourBlueVariableName;
-
-	/* Construct Parent */
-	_lucSwarmViewer_AssignFromXML( self, cf, data );
-
-	colourRedVariableName   = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourRedVariable", ""  );
-	colourGreenVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourGreenVariable", ""  );
-	colourBlueVariableName  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourBlueVariable", ""  );
-	
-	_lucSwarmRGBColourViewer_Init( 
-			self, 
-			colourRedVariableName, 
-			colourGreenVariableName, 
-			colourBlueVariableName );
-}
-
-void _lucSwarmRGBColourViewer_Build( void* drawingObject, void* data ) {}
-
-void _lucSwarmRGBColourViewer_Initialise( void* drawingObject, void* data ) {
-	lucSwarmRGBColourViewer*	self                   = (lucSwarmRGBColourViewer*)drawingObject;
-	SwarmVariable_Register*  	swarmVariable_Register = self->swarm->swarmVariable_Register;
-	Stream*                  	errorStr               = Journal_Register( Error_Type, (Name)self->type  );
-
-	_lucSwarmViewer_Initialise( self, data );
-
-	if ( 0 != strcmp( self->colourRedVariableName, "" ) ) {
-		self->colourRedVariable  = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourRedVariableName );
-		Journal_Firewall( self->colourRedVariable != NULL, errorStr,
-					"Error - for gLucifer drawing object \"%s\" - in %s(): Colour Variable name given was \"%s\", "
-					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-					self->name, __func__, self->colourRedVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->colourRedVariable, data, False );
-		Stg_Component_Initialise( self->colourRedVariable, data, False );
-
-	}
-
-	if ( 0 != strcmp( self->colourGreenVariableName, "" ) ) {
-		self->colourGreenVariable  = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourGreenVariableName );
-		Journal_Firewall( self->colourGreenVariable != NULL, errorStr,
-					"Error - for gLucifer drawing object \"%s\" - in %s(): Colour Variable name given was \"%s\", "
-					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-					self->name, __func__, self->colourGreenVariableName, self->swarm->name );
-	
-		Stg_Component_Build( self->colourGreenVariable, data, False );
-		Stg_Component_Initialise( self->colourGreenVariable, data, False );
-	}
-	
-	if ( 0 != strcmp( self->colourBlueVariableName, "" ) ) {
-		self->colourBlueVariable  = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourBlueVariableName );
-		Journal_Firewall( self->colourBlueVariable != NULL, errorStr,
-					"Error - for gLucifer drawing object \"%s\" - in %s(): Colour Variable name given was \"%s\", "
-					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-					self->name, __func__, self->colourBlueVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->colourBlueVariable, data, False );
-		Stg_Component_Initialise( self->colourBlueVariable, data, False );
-	}
-}
-
-
-void _lucSwarmRGBColourViewer_Execute( void* drawingObject, void* data ) {}
-void _lucSwarmRGBColourViewer_Destroy( void* drawingObject, void* data ) {}
-
-void _lucSwarmRGBColourViewer_Setup( void* drawingObject, void* _context ) {
-	lucSwarmRGBColourViewer*          self                = (lucSwarmRGBColourViewer*)drawingObject;
-	
-	lucSwarmRGBColourViewer_UpdateVariables( self );
-		
-	_lucSwarmViewer_Setup( self, _context );
-}
-
-void _lucSwarmRGBColourViewer_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	_lucSwarmViewer_Draw( drawingObject, window, viewportInfo, _context );
-}
-
-
-void _lucSwarmRGBColourViewer_CleanUp( void* drawingObject, void* context ) {
-	_lucSwarmViewer_CleanUp( drawingObject, context );
-}
-
-void _lucSwarmRGBColourViewer_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucSwarmRGBColourViewer*          self                = (lucSwarmRGBColourViewer*)drawingObject;
-	
-	_lucSwarmViewer_BuildDisplayList( self, _context );
-}
-
-void _lucSwarmRGBColourViewer_SetParticleColour( void* drawingObject, void* _context, Particle_Index lParticle_I ) {
-	lucSwarmRGBColourViewer* self                  = (lucSwarmRGBColourViewer*)drawingObject;
-	double                   colourValueRed        = 0.0;
-	double                   colourValueGreen      = 0.0;
-	double                   colourValueBlue       = 0.0;
-	double                   opacity               = 0.0;
-	lucColour                colour;
-
-	/* Copy the default colour */
-	memcpy( &colour, &self->colour, sizeof( lucColour ) );
-
-	/* Get Red colour */
-	if ( self->colourRedVariable ) {
-		SwarmVariable_ValueAt( self->colourRedVariable, lParticle_I, &colourValueRed );
-		colour.red = (float) colourValueRed;
-		/* Other way to do it... */
-		/* colour.red = Variable_GetValueFloat(colourRedVariable->variable, lParticle_I);*/
-	}
-		
-	/* Get Green colour */
-	if ( self->colourGreenVariable ){
-		SwarmVariable_ValueAt( self->colourGreenVariable, lParticle_I, &colourValueGreen );
-		colour.green = (float) colourValueGreen;
-	}
-	
-	/* Get Blue colour */
-	if ( self->colourBlueVariable ){
-		SwarmVariable_ValueAt( self->colourBlueVariable, lParticle_I, &colourValueBlue );
-		colour.blue = (float) colourValueBlue;
-	}
-	
-	/* Get Opacity Value */
-	if ( self->opacityVariable ){
-		SwarmVariable_ValueAt( self->opacityVariable, lParticle_I, &opacity );
-		colour.opacity = (float)opacity;	
-	}
-
-	lucColour_SetOpenGLColour( &colour );
-}
-
-
-
-
-void lucSwarmRGBColourViewer_UpdateVariables( void* drawingObject ) {
-	lucSwarmRGBColourViewer*          self                = (lucSwarmRGBColourViewer*)drawingObject;
-
-	lucSwarmViewerBase_UpdateVariables( drawingObject ) ;
-
-	if ( self->colourRedVariable && self->colourRedVariable->variable ) {
-		Variable_Update( self->colourRedVariable->variable );
-	}	
-	if ( self->colourGreenVariable && self->colourGreenVariable->variable ) {
-		Variable_Update( self->colourGreenVariable->variable );
-	}
-	if ( self->colourBlueVariable && self->colourBlueVariable->variable ) {
-		Variable_Update( self->colourBlueVariable->variable );
-	}
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmRGBColourViewer.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/SwarmRGBColourViewer.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,292 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "SwarmViewerBase.h"
+#include "SwarmViewer.h"
+#include "SwarmRGBColourViewer.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucSwarmRGBColourViewer_Type = "lucSwarmRGBColourViewer";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucSwarmRGBColourViewer* _lucSwarmRGBColourViewer_New(  LUCSWARMRGBCOLOURVIEWER_DEFARGS  ) 
+{
+	lucSwarmRGBColourViewer*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucSwarmRGBColourViewer) );
+	self = (lucSwarmRGBColourViewer*) _lucSwarmViewer_New(  LUCSWARMVIEWER_PASSARGS  );
+
+	return self;
+}
+
+void _lucSwarmRGBColourViewer_Init( 
+		lucSwarmRGBColourViewer*                                     self,
+		Name                                                         colourRedVariableName,
+		Name                                                         colourGreenVariableName,
+		Name                                                         colourBlueVariableName )
+{
+	self->colourRedVariableName           = colourRedVariableName;
+	self->colourGreenVariableName         = colourGreenVariableName;
+	self->colourBlueVariableName          = colourBlueVariableName;
+}
+
+void _lucSwarmRGBColourViewer_Delete( void* drawingObject ) {
+	lucSwarmRGBColourViewer*  self = (lucSwarmRGBColourViewer*)drawingObject;
+
+	_lucSwarmViewer_Delete( self );
+}
+
+void _lucSwarmRGBColourViewer_Print( void* drawingObject, Stream* stream ) {
+	lucSwarmRGBColourViewer*  self = (lucSwarmRGBColourViewer*)drawingObject;
+
+	_lucSwarmViewer_Print( self, stream );
+}
+
+void* _lucSwarmRGBColourViewer_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucSwarmRGBColourViewer*  self = (lucSwarmRGBColourViewer*)drawingObject;
+	lucSwarmRGBColourViewer* newDrawingObject;
+
+	newDrawingObject = _lucSwarmViewer_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucSwarmRGBColourViewer_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucSwarmRGBColourViewer);
+	Type                                                             type = lucSwarmRGBColourViewer_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucSwarmRGBColourViewer_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucSwarmRGBColourViewer_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucSwarmRGBColourViewer_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucSwarmRGBColourViewer_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucSwarmRGBColourViewer_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucSwarmRGBColourViewer_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucSwarmRGBColourViewer_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucSwarmRGBColourViewer_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucSwarmRGBColourViewer_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucSwarmRGBColourViewer_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucSwarmRGBColourViewer_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucSwarmRGBColourViewer_BuildDisplayList;
+	lucSwarmViewerBase_PlotParticleFunction*                _plotParticle = _lucSwarmViewer_PlotParticle;
+	lucSwarmViewerBase_SetParticleColourFunction*      _setParticleColour = _lucSwarmRGBColourViewer_SetParticleColour;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucSwarmRGBColourViewer_New(  LUCSWARMRGBCOLOURVIEWER_PASSARGS  );
+}
+
+void _lucSwarmRGBColourViewer_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucSwarmRGBColourViewer* self = (lucSwarmRGBColourViewer*)drawingObject;
+	Name                     colourRedVariableName;
+	Name                     colourGreenVariableName;
+	Name                     colourBlueVariableName;
+
+	/* Construct Parent */
+	_lucSwarmViewer_AssignFromXML( self, cf, data );
+
+	colourRedVariableName   = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourRedVariable", ""  );
+	colourGreenVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourGreenVariable", ""  );
+	colourBlueVariableName  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourBlueVariable", ""  );
+	
+	_lucSwarmRGBColourViewer_Init( 
+			self, 
+			colourRedVariableName, 
+			colourGreenVariableName, 
+			colourBlueVariableName );
+}
+
+void _lucSwarmRGBColourViewer_Build( void* drawingObject, void* data ) {}
+
+void _lucSwarmRGBColourViewer_Initialise( void* drawingObject, void* data ) {
+	lucSwarmRGBColourViewer*	self                   = (lucSwarmRGBColourViewer*)drawingObject;
+	SwarmVariable_Register*  	swarmVariable_Register = self->swarm->swarmVariable_Register;
+	Stream*                  	errorStr               = Journal_Register( Error_Type, (Name)self->type  );
+
+	_lucSwarmViewer_Initialise( self, data );
+
+	if ( 0 != strcmp( self->colourRedVariableName, "" ) ) {
+		self->colourRedVariable  = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourRedVariableName );
+		Journal_Firewall( self->colourRedVariable != NULL, errorStr,
+					"Error - for gLucifer drawing object \"%s\" - in %s(): Colour Variable name given was \"%s\", "
+					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+					self->name, __func__, self->colourRedVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->colourRedVariable, data, False );
+		Stg_Component_Initialise( self->colourRedVariable, data, False );
+
+	}
+
+	if ( 0 != strcmp( self->colourGreenVariableName, "" ) ) {
+		self->colourGreenVariable  = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourGreenVariableName );
+		Journal_Firewall( self->colourGreenVariable != NULL, errorStr,
+					"Error - for gLucifer drawing object \"%s\" - in %s(): Colour Variable name given was \"%s\", "
+					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+					self->name, __func__, self->colourGreenVariableName, self->swarm->name );
+	
+		Stg_Component_Build( self->colourGreenVariable, data, False );
+		Stg_Component_Initialise( self->colourGreenVariable, data, False );
+	}
+	
+	if ( 0 != strcmp( self->colourBlueVariableName, "" ) ) {
+		self->colourBlueVariable  = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourBlueVariableName );
+		Journal_Firewall( self->colourBlueVariable != NULL, errorStr,
+					"Error - for gLucifer drawing object \"%s\" - in %s(): Colour Variable name given was \"%s\", "
+					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+					self->name, __func__, self->colourBlueVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->colourBlueVariable, data, False );
+		Stg_Component_Initialise( self->colourBlueVariable, data, False );
+	}
+}
+
+
+void _lucSwarmRGBColourViewer_Execute( void* drawingObject, void* data ) {}
+void _lucSwarmRGBColourViewer_Destroy( void* drawingObject, void* data ) {}
+
+void _lucSwarmRGBColourViewer_Setup( void* drawingObject, void* _context ) {
+	lucSwarmRGBColourViewer*          self                = (lucSwarmRGBColourViewer*)drawingObject;
+	
+	lucSwarmRGBColourViewer_UpdateVariables( self );
+		
+	_lucSwarmViewer_Setup( self, _context );
+}
+
+void _lucSwarmRGBColourViewer_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	_lucSwarmViewer_Draw( drawingObject, window, viewportInfo, _context );
+}
+
+
+void _lucSwarmRGBColourViewer_CleanUp( void* drawingObject, void* context ) {
+	_lucSwarmViewer_CleanUp( drawingObject, context );
+}
+
+void _lucSwarmRGBColourViewer_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucSwarmRGBColourViewer*          self                = (lucSwarmRGBColourViewer*)drawingObject;
+	
+	_lucSwarmViewer_BuildDisplayList( self, _context );
+}
+
+void _lucSwarmRGBColourViewer_SetParticleColour( void* drawingObject, void* _context, Particle_Index lParticle_I ) {
+	lucSwarmRGBColourViewer* self                  = (lucSwarmRGBColourViewer*)drawingObject;
+	double                   colourValueRed        = 0.0;
+	double                   colourValueGreen      = 0.0;
+	double                   colourValueBlue       = 0.0;
+	double                   opacity               = 0.0;
+	lucColour                colour;
+
+	/* Copy the default colour */
+	memcpy( &colour, &self->colour, sizeof( lucColour ) );
+
+	/* Get Red colour */
+	if ( self->colourRedVariable ) {
+		SwarmVariable_ValueAt( self->colourRedVariable, lParticle_I, &colourValueRed );
+		colour.red = (float) colourValueRed;
+		/* Other way to do it... */
+		/* colour.red = Variable_GetValueFloat(colourRedVariable->variable, lParticle_I);*/
+	}
+		
+	/* Get Green colour */
+	if ( self->colourGreenVariable ){
+		SwarmVariable_ValueAt( self->colourGreenVariable, lParticle_I, &colourValueGreen );
+		colour.green = (float) colourValueGreen;
+	}
+	
+	/* Get Blue colour */
+	if ( self->colourBlueVariable ){
+		SwarmVariable_ValueAt( self->colourBlueVariable, lParticle_I, &colourValueBlue );
+		colour.blue = (float) colourValueBlue;
+	}
+	
+	/* Get Opacity Value */
+	if ( self->opacityVariable ){
+		SwarmVariable_ValueAt( self->opacityVariable, lParticle_I, &opacity );
+		colour.opacity = (float)opacity;	
+	}
+
+	lucColour_SetOpenGLColour( &colour );
+}
+
+
+
+
+void lucSwarmRGBColourViewer_UpdateVariables( void* drawingObject ) {
+	lucSwarmRGBColourViewer*          self                = (lucSwarmRGBColourViewer*)drawingObject;
+
+	lucSwarmViewerBase_UpdateVariables( drawingObject ) ;
+
+	if ( self->colourRedVariable && self->colourRedVariable->variable ) {
+		Variable_Update( self->colourRedVariable->variable );
+	}	
+	if ( self->colourGreenVariable && self->colourGreenVariable->variable ) {
+		Variable_Update( self->colourGreenVariable->variable );
+	}
+	if ( self->colourBlueVariable && self->colourBlueVariable->variable ) {
+		Variable_Update( self->colourBlueVariable->variable );
+	}
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmSquares.c
--- a/DrawingObjects/src/SwarmSquares.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,295 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: SwarmSquares.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "SwarmViewerBase.h"
-#include "SwarmViewer.h"
-#include "SwarmSquares.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucSwarmSquares_Type = "lucSwarmSquares";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucSwarmSquares* _lucSwarmSquares_New(  LUCSWARMSQUARES_DEFARGS  ) 
-{
-	lucSwarmSquares*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucSwarmSquares) );
-	self = (lucSwarmSquares*) _lucSwarmViewerBase_New(  LUCSWARMVIEWERBASE_PASSARGS  );
-	
-	return self;
-}
-
-void _lucSwarmSquares_Init( 
-		lucSwarmSquares*                                   self,
-		Name                                               colourVariableName,
-		lucColourMap*                                      colourMap,
-		Name                                               normalVariableName,
-		Name                                               planeVectorVariableName,
-		Name                                               lengthVariableName,
-		double                                             length )
-{
-	self->colourMap           = colourMap;
-	self->colourVariableName  = colourVariableName;
-	self->normalVariableName      = normalVariableName;
-	self->planeVectorVariableName = planeVectorVariableName;
-	self->lengthVariableName      = lengthVariableName;
-	self->length                  = length;
-}
-
-void _lucSwarmSquares_Delete( void* drawingObject ) {
-	lucSwarmSquares*  self = (lucSwarmSquares*)drawingObject;
-
-	_lucSwarmViewerBase_Delete( self );
-}
-
-void _lucSwarmSquares_Print( void* drawingObject, Stream* stream ) {
-	lucSwarmSquares*  self = (lucSwarmSquares*)drawingObject;
-
-	_lucSwarmViewerBase_Print( self, stream );
-}
-
-void* _lucSwarmSquares_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucSwarmSquares*  self = (lucSwarmSquares*)drawingObject;
-	lucSwarmSquares* newDrawingObject;
-
-	newDrawingObject = _lucSwarmViewerBase_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucSwarmSquares_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucSwarmSquares);
-	Type                                                             type = lucSwarmSquares_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucSwarmSquares_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucSwarmSquares_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucSwarmSquares_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucSwarmSquares_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucSwarmSquares_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucSwarmSquares_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucSwarmSquares_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucSwarmSquares_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucSwarmSquares_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucSwarmSquares_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucSwarmSquares_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucSwarmSquares_BuildDisplayList;
-	lucSwarmViewerBase_PlotParticleFunction*                _plotParticle = _lucSwarmSquares_PlotParticle;
-	lucSwarmViewerBase_SetParticleColourFunction*      _setParticleColour = _lucSwarmViewerBase_SetParticleColourDefault;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucSwarmSquares_New(  LUCSWARMSQUARES_PASSARGS  );
-}
-
-void _lucSwarmSquares_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucSwarmSquares*  self = (lucSwarmSquares*)drawingObject;
-	lucColourMap*           colourMap;
-	Name                    colourVariableName;
-	
-	/* Construct Parent */
-	_lucSwarmViewerBase_AssignFromXML( self, cf, data );
-	
-	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data   ) ;
-	colourVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourVariable", ""  );
-
-	_lucSwarmSquares_Init( 
-			self,
-			colourVariableName,
-			colourMap,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"NormalVariable", ""  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"PlaneVectorVariable", ""  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"LengthVariable", ""  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2 )  );
-}
-
-void _lucSwarmSquares_Build( void* drawingObject, void* data ) {}
-void _lucSwarmSquares_Initialise( void* drawingObject, void* data ) {
-	lucSwarmSquares*         self                   = (lucSwarmSquares*)drawingObject;
-	SwarmVariable_Register*  swarmVariable_Register = self->swarm->swarmVariable_Register;
-	Stream*                  errorStream            = Journal_MyStream( Error_Type, self );
-
-	_lucSwarmViewerBase_Initialise( self, data );
-
-	if ( 0 != strcmp( self->colourVariableName, "" ) ) {
-		self->colourVariable  = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourVariableName );
-		Journal_Firewall( self->colourVariable != NULL, errorStream,
-				  "Error - for gLucifer drawing object \"%s\" - in %s(): colour Variable name given was \"%s\", "
-				  "but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-				  self->name, __func__, self->colourVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->colourVariable, data, False );
-		Stg_Component_Initialise( self->colourVariable, data, False );
-
-	}
-	
-	if ( 0 != strcmp( self->normalVariableName, "" ) ) {
-		self->normalVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->normalVariableName );
-		Journal_Firewall( self->normalVariable != NULL, errorStream,
-					"Error - for gLucifer drawing object \"%s\" - in %s(): normal Variable name given was \"%s\", "
-					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-					self->name, __func__, self->normalVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->normalVariable, data, False );
-		Stg_Component_Initialise( self->normalVariable, data, False );
-	}
-
-	/*
-	self->planeVectorVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->planeVectorVariableName );
-	Journal_Firewall( self->planeVectorVariable != NULL, errorStream, 
-			"Error in func %s for %s '%s' - Cannot find SwarmVariable %s to be variable for plane vector.\n", 
-			__func__, self->type, self->name, self->planeVectorVariableName );
-	*/		
-	
-	if ( 0 != strcmp( self->lengthVariableName, "" ) ) {
-		self->lengthVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->lengthVariableName );
-		Journal_Firewall( self->lengthVariable != NULL, errorStream,
-					"Error - for gLucifer drawing object \"%s\" - in %s(): normal Variable name given was \"%s\", "
-					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-					self->name, __func__, self->lengthVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->lengthVariable, data, False );
-		Stg_Component_Initialise( self->lengthVariable, data, False );
-	}
-
-}
-void _lucSwarmSquares_Execute( void* drawingObject, void* data ) {}
-void _lucSwarmSquares_Destroy( void* drawingObject, void* data ) {}
-
-void _lucSwarmSquares_Setup( void* drawingObject, void* _context ) {
-	lucSwarmSquares_UpdateVariables( drawingObject );
-	_lucSwarmViewerBase_Setup( drawingObject, _context );
-}
-	
-void _lucSwarmSquares_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	_lucSwarmViewerBase_Draw( drawingObject, window, viewportInfo, _context );
-}
-
-void _lucSwarmSquares_CleanUp( void* drawingObject, void* _context ) {
-	_lucSwarmViewerBase_CleanUp( drawingObject, _context );
-}
-
-void _lucSwarmSquares_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucSwarmViewer*          self                = (lucSwarmViewer*)drawingObject;
-
-     /* 
-		Hack to allow the transparency to work properly 
-	 	See : http://www.oreillynet.com/pub/a/network/2000/06/23/magazine/opengl_render.html?page=2 
-	  	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
-		
-		This isn't so great either ... it's hard to overlay darker colours on 
-		light with this choice of blending.
-	 */
-	glEnable(GL_BLEND);
-	
-	
-	_lucSwarmViewerBase_BuildDisplayList( self, _context );
-	
-	/* glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); */
-}
-
-void _lucSwarmSquares_PlotParticle( void* drawingObject, void* _context, Particle_Index lParticle_I ) {
-	lucSwarmSquares*         self                = (lucSwarmSquares*)drawingObject;
-	DomainContext*   context             = (DomainContext*) _context;
-	GlobalParticle*          particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
-	SwarmVariable*           lengthVariable      = self->lengthVariable;
-	double*                  coord               = particle->coord;
-	double                   length              = self->length;
-	XYZ                      normal              = { 0, 0, 0 };
-	/*XYZ                      planeVector         = { 0, 0, 0 };*/
-
-	SwarmVariable_ValueAt( self->normalVariable, lParticle_I, normal );
-	/* SwarmVariable_ValueAt( self->planeVectorVariable, lParticle_I, planeVector );*/
-
-	if ( lengthVariable )
-		SwarmVariable_ValueAt( lengthVariable, lParticle_I, &length );
-
-	
-	/*  The fat square has a pizza box shape ... i.e. edges and two faces 
-		which have opposite normals */
-	
-	luc_OpenGlFatSquare( context->dim, coord, normal, NULL, length, length * 0.1);  
-	/* luc_OpenGlSquare( context->dim, coord, normal, NULL, length); */
-
-}
-
-void lucSwarmSquares_UpdateVariables( void* drawingObject ) {
-	lucSwarmSquares*          self                = (lucSwarmSquares*)drawingObject;
-	
-	lucSwarmViewerBase_UpdateVariables( drawingObject ) ;
-
-	if ( self->normalVariable && self->normalVariable->variable ) {
-		Variable_Update( self->normalVariable->variable );
-	}
-	if ( self->planeVectorVariable && self->planeVectorVariable->variable ) {
-		Variable_Update( self->planeVectorVariable->variable );
-	}
-	if ( self->lengthVariable && self->lengthVariable->variable ) {
-		Variable_Update( self->lengthVariable->variable );
-	}
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmSquares.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/SwarmSquares.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,295 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: SwarmSquares.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "SwarmViewerBase.h"
+#include "SwarmViewer.h"
+#include "SwarmSquares.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucSwarmSquares_Type = "lucSwarmSquares";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucSwarmSquares* _lucSwarmSquares_New(  LUCSWARMSQUARES_DEFARGS  ) 
+{
+	lucSwarmSquares*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucSwarmSquares) );
+	self = (lucSwarmSquares*) _lucSwarmViewerBase_New(  LUCSWARMVIEWERBASE_PASSARGS  );
+	
+	return self;
+}
+
+void _lucSwarmSquares_Init( 
+		lucSwarmSquares*                                   self,
+		Name                                               colourVariableName,
+		lucColourMap*                                      colourMap,
+		Name                                               normalVariableName,
+		Name                                               planeVectorVariableName,
+		Name                                               lengthVariableName,
+		double                                             length )
+{
+	self->colourMap           = colourMap;
+	self->colourVariableName  = colourVariableName;
+	self->normalVariableName      = normalVariableName;
+	self->planeVectorVariableName = planeVectorVariableName;
+	self->lengthVariableName      = lengthVariableName;
+	self->length                  = length;
+}
+
+void _lucSwarmSquares_Delete( void* drawingObject ) {
+	lucSwarmSquares*  self = (lucSwarmSquares*)drawingObject;
+
+	_lucSwarmViewerBase_Delete( self );
+}
+
+void _lucSwarmSquares_Print( void* drawingObject, Stream* stream ) {
+	lucSwarmSquares*  self = (lucSwarmSquares*)drawingObject;
+
+	_lucSwarmViewerBase_Print( self, stream );
+}
+
+void* _lucSwarmSquares_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucSwarmSquares*  self = (lucSwarmSquares*)drawingObject;
+	lucSwarmSquares* newDrawingObject;
+
+	newDrawingObject = _lucSwarmViewerBase_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucSwarmSquares_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucSwarmSquares);
+	Type                                                             type = lucSwarmSquares_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucSwarmSquares_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucSwarmSquares_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucSwarmSquares_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucSwarmSquares_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucSwarmSquares_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucSwarmSquares_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucSwarmSquares_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucSwarmSquares_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucSwarmSquares_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucSwarmSquares_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucSwarmSquares_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucSwarmSquares_BuildDisplayList;
+	lucSwarmViewerBase_PlotParticleFunction*                _plotParticle = _lucSwarmSquares_PlotParticle;
+	lucSwarmViewerBase_SetParticleColourFunction*      _setParticleColour = _lucSwarmViewerBase_SetParticleColourDefault;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucSwarmSquares_New(  LUCSWARMSQUARES_PASSARGS  );
+}
+
+void _lucSwarmSquares_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucSwarmSquares*  self = (lucSwarmSquares*)drawingObject;
+	lucColourMap*           colourMap;
+	Name                    colourVariableName;
+	
+	/* Construct Parent */
+	_lucSwarmViewerBase_AssignFromXML( self, cf, data );
+	
+	colourMap     =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data   ) ;
+	colourVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourVariable", ""  );
+
+	_lucSwarmSquares_Init( 
+			self,
+			colourVariableName,
+			colourMap,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"NormalVariable", ""  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"PlaneVectorVariable", ""  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"LengthVariable", ""  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2 )  );
+}
+
+void _lucSwarmSquares_Build( void* drawingObject, void* data ) {}
+void _lucSwarmSquares_Initialise( void* drawingObject, void* data ) {
+	lucSwarmSquares*         self                   = (lucSwarmSquares*)drawingObject;
+	SwarmVariable_Register*  swarmVariable_Register = self->swarm->swarmVariable_Register;
+	Stream*                  errorStream            = Journal_MyStream( Error_Type, self );
+
+	_lucSwarmViewerBase_Initialise( self, data );
+
+	if ( 0 != strcmp( self->colourVariableName, "" ) ) {
+		self->colourVariable  = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourVariableName );
+		Journal_Firewall( self->colourVariable != NULL, errorStream,
+				  "Error - for gLucifer drawing object \"%s\" - in %s(): colour Variable name given was \"%s\", "
+				  "but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+				  self->name, __func__, self->colourVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->colourVariable, data, False );
+		Stg_Component_Initialise( self->colourVariable, data, False );
+
+	}
+	
+	if ( 0 != strcmp( self->normalVariableName, "" ) ) {
+		self->normalVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->normalVariableName );
+		Journal_Firewall( self->normalVariable != NULL, errorStream,
+					"Error - for gLucifer drawing object \"%s\" - in %s(): normal Variable name given was \"%s\", "
+					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+					self->name, __func__, self->normalVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->normalVariable, data, False );
+		Stg_Component_Initialise( self->normalVariable, data, False );
+	}
+
+	/*
+	self->planeVectorVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->planeVectorVariableName );
+	Journal_Firewall( self->planeVectorVariable != NULL, errorStream, 
+			"Error in func %s for %s '%s' - Cannot find SwarmVariable %s to be variable for plane vector.\n", 
+			__func__, self->type, self->name, self->planeVectorVariableName );
+	*/		
+	
+	if ( 0 != strcmp( self->lengthVariableName, "" ) ) {
+		self->lengthVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->lengthVariableName );
+		Journal_Firewall( self->lengthVariable != NULL, errorStream,
+					"Error - for gLucifer drawing object \"%s\" - in %s(): normal Variable name given was \"%s\", "
+					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+					self->name, __func__, self->lengthVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->lengthVariable, data, False );
+		Stg_Component_Initialise( self->lengthVariable, data, False );
+	}
+
+}
+void _lucSwarmSquares_Execute( void* drawingObject, void* data ) {}
+void _lucSwarmSquares_Destroy( void* drawingObject, void* data ) {}
+
+void _lucSwarmSquares_Setup( void* drawingObject, void* _context ) {
+	lucSwarmSquares_UpdateVariables( drawingObject );
+	_lucSwarmViewerBase_Setup( drawingObject, _context );
+}
+	
+void _lucSwarmSquares_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	_lucSwarmViewerBase_Draw( drawingObject, window, viewportInfo, _context );
+}
+
+void _lucSwarmSquares_CleanUp( void* drawingObject, void* _context ) {
+	_lucSwarmViewerBase_CleanUp( drawingObject, _context );
+}
+
+void _lucSwarmSquares_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucSwarmViewer*          self                = (lucSwarmViewer*)drawingObject;
+
+     /* 
+		Hack to allow the transparency to work properly 
+	 	See : http://www.oreillynet.com/pub/a/network/2000/06/23/magazine/opengl_render.html?page=2 
+	  	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+		
+		This isn't so great either ... it's hard to overlay darker colours on 
+		light with this choice of blending.
+	 */
+	glEnable(GL_BLEND);
+	
+	
+	_lucSwarmViewerBase_BuildDisplayList( self, _context );
+	
+	/* glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); */
+}
+
+void _lucSwarmSquares_PlotParticle( void* drawingObject, void* _context, Particle_Index lParticle_I ) {
+	lucSwarmSquares*         self                = (lucSwarmSquares*)drawingObject;
+	DomainContext*   context             = (DomainContext*) _context;
+	GlobalParticle*          particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
+	SwarmVariable*           lengthVariable      = self->lengthVariable;
+	double*                  coord               = particle->coord;
+	double                   length              = self->length;
+	XYZ                      normal              = { 0, 0, 0 };
+	/*XYZ                      planeVector         = { 0, 0, 0 };*/
+
+	SwarmVariable_ValueAt( self->normalVariable, lParticle_I, normal );
+	/* SwarmVariable_ValueAt( self->planeVectorVariable, lParticle_I, planeVector );*/
+
+	if ( lengthVariable )
+		SwarmVariable_ValueAt( lengthVariable, lParticle_I, &length );
+
+	
+	/*  The fat square has a pizza box shape ... i.e. edges and two faces 
+		which have opposite normals */
+	
+	luc_OpenGlFatSquare( context->dim, coord, normal, NULL, length, length * 0.1);  
+	/* luc_OpenGlSquare( context->dim, coord, normal, NULL, length); */
+
+}
+
+void lucSwarmSquares_UpdateVariables( void* drawingObject ) {
+	lucSwarmSquares*          self                = (lucSwarmSquares*)drawingObject;
+	
+	lucSwarmViewerBase_UpdateVariables( drawingObject ) ;
+
+	if ( self->normalVariable && self->normalVariable->variable ) {
+		Variable_Update( self->normalVariable->variable );
+	}
+	if ( self->planeVectorVariable && self->planeVectorVariable->variable ) {
+		Variable_Update( self->planeVectorVariable->variable );
+	}
+	if ( self->lengthVariable && self->lengthVariable->variable ) {
+		Variable_Update( self->lengthVariable->variable );
+	}
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmVectors.c
--- a/DrawingObjects/src/SwarmVectors.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,273 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: SwarmVectors.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "SwarmViewerBase.h"
-#include "SwarmViewer.h"
-#include "SwarmVectors.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucSwarmVectors_Type = "lucSwarmVectors";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucSwarmVectors* _lucSwarmVectors_New(  LUCSWARMVECTORS_DEFARGS  ) 
-{
-	lucSwarmVectors*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucSwarmVectors) );
-	self = (lucSwarmVectors*) _lucSwarmViewerBase_New(  LUCSWARMVIEWERBASE_PASSARGS  );
-	
-	return self;
-}
-
-void _lucSwarmVectors_Init( 
-		lucSwarmVectors*                                   self,
-		Name                                               directionVariableName,
-		double                                             arrowHeadSize,
-		Name                                               thicknessVariableName,
-		double                                             thickness,
-		Name                                               lengthVariableName,
-		double                                             length )
-{
-	Stream* errorStream         = Journal_MyStream( Error_Type, self );
-	
-	self->directionVariableName = directionVariableName;
-	self->arrowHeadSize         = arrowHeadSize;
-	Journal_Firewall( ( arrowHeadSize <= 1 && arrowHeadSize >= 0 ), errorStream,
-			"Error in %s:\narrowHeadSize given for %s was not in the range [0, 1]. " 
-			"Please use an arrowHeadSize within this range\n", __func__, self->name );
-	self->thicknessVariableName = thicknessVariableName;
-	self->thickness             = thickness;
-	self->lengthVariableName    = lengthVariableName;
-	self->length                = length;
-}
-
-void _lucSwarmVectors_Delete( void* drawingObject ) {
-	lucSwarmVectors*  self = (lucSwarmVectors*)drawingObject;
-
-	_lucSwarmViewerBase_Delete( self );
-}
-
-void _lucSwarmVectors_Print( void* drawingObject, Stream* stream ) {
-	lucSwarmVectors*  self = (lucSwarmVectors*)drawingObject;
-
-	_lucSwarmViewerBase_Print( self, stream );
-}
-
-void* _lucSwarmVectors_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucSwarmVectors*  self = (lucSwarmVectors*)drawingObject;
-	lucSwarmVectors* newDrawingObject;
-
-	newDrawingObject = _lucSwarmViewerBase_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucSwarmVectors_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucSwarmVectors);
-	Type                                                             type = lucSwarmVectors_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucSwarmVectors_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucSwarmVectors_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucSwarmVectors_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucSwarmVectors_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucSwarmVectors_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucSwarmVectors_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucSwarmVectors_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucSwarmVectors_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucSwarmVectors_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucSwarmVectors_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucSwarmVectors_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucSwarmVectors_BuildDisplayList;
-	lucSwarmViewerBase_PlotParticleFunction*                _plotParticle = _lucSwarmVectors_PlotParticle;
-	lucSwarmViewerBase_SetParticleColourFunction*      _setParticleColour = _lucSwarmViewerBase_SetParticleColourDefault;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucSwarmVectors_New(  LUCSWARMVECTORS_PASSARGS  );
-}
-
-void _lucSwarmVectors_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucSwarmVectors*  self = (lucSwarmVectors*)drawingObject;
-
-	/* Construct Parent */
-	_lucSwarmViewerBase_AssignFromXML( self, cf, data );
-
-	_lucSwarmVectors_Init( 
-			self,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"DirectionVariable", ""  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.5  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ThicknessVariable", ""  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"thickness", 1.0  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"LengthVariable", ""  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2 )  );
-}
-
-void _lucSwarmVectors_Build( void* drawingObject, void* data ) {
-	lucSwarmVectors*         self                   = (lucSwarmVectors*)drawingObject;
-
-	_lucSwarmViewerBase_Build( self, data );
-}
-void _lucSwarmVectors_Initialise( void* drawingObject, void* data ) {
-	lucSwarmVectors*         self                   = (lucSwarmVectors*)drawingObject;
-	SwarmVariable_Register*  swarmVariable_Register = self->swarm->swarmVariable_Register;
-	Stream*                  errorStream            = Journal_MyStream( Error_Type, self );
-
-	_lucSwarmViewerBase_Initialise( self, data );
-
-	if ( 0 != strcmp( self->directionVariableName, "" ) ) {
-		self->directionVariable    = SwarmVariable_Register_GetByName( swarmVariable_Register, self->directionVariableName );
-		Journal_Firewall( self->directionVariable != NULL, errorStream, 
-				"Error in func %s for %s '%s' - Cannot find SwarmVariable %s to be variable for direction vector.\n", 
-				__func__, self->type, self->name, self->directionVariableName );
-		Stg_Component_Build( self->directionVariable, data, False );
-		Stg_Component_Initialise( self->directionVariable, data, False );
-	}
-
-	if ( 0 != strcmp( self->thicknessVariableName, "" ) ) {
-		self->thicknessVariable    = SwarmVariable_Register_GetByName( swarmVariable_Register, self->thicknessVariableName );
-		Journal_Firewall( self->thicknessVariable != NULL, errorStream,
-			"Error - for gLucifer drawing object \"%s\" - in %s(): thickness Variable name given was \"%s\", "
-			"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-			self->name, __func__, self->thicknessVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->thicknessVariable, data, False );
-		Stg_Component_Initialise( self->thicknessVariable, data, False );
-	}
-	if ( 0 != strcmp( self->lengthVariableName, "" ) ) {
-		self->lengthVariable       = SwarmVariable_Register_GetByName( swarmVariable_Register, self->lengthVariableName );
-		Journal_Firewall( self->lengthVariable != NULL, errorStream,
-			"Error - for gLucifer drawing object \"%s\" - in %s(): length Variable name given was \"%s\", "
-			"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-			self->name, __func__, self->lengthVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->lengthVariable, data, False );
-		Stg_Component_Initialise( self->lengthVariable, data, False );
-	}
-}
-void _lucSwarmVectors_Execute( void* drawingObject, void* data ) {}
-void _lucSwarmVectors_Destroy( void* drawingObject, void* data ) {}
-
-void _lucSwarmVectors_Setup( void* drawingObject, void* _context ) {
-	_lucSwarmViewerBase_Setup( drawingObject, _context );
-	lucSwarmVectors_UpdateVariables( drawingObject );
-}
-	
-void _lucSwarmVectors_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	_lucSwarmViewerBase_Draw( drawingObject, window, viewportInfo, _context );
-}
-
-void _lucSwarmVectors_CleanUp( void* drawingObject, void* _context ) {
-	_lucSwarmViewerBase_CleanUp( drawingObject, _context );
-}
-
-void _lucSwarmVectors_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucSwarmVectors*         self                = (lucSwarmVectors*)drawingObject;
-	
-	_lucSwarmViewerBase_BuildDisplayList( self, _context );
-}
-
-void _lucSwarmVectors_PlotParticle( void* drawingObject, void* _context, Particle_Index lParticle_I ) {
-	lucSwarmVectors*        self                = (lucSwarmVectors*)drawingObject;
-	DomainContext*   		context             = (DomainContext*) _context;
-	GlobalParticle*         particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
-	SwarmVariable*          lengthVariable      = self->lengthVariable;
-	SwarmVariable*          thicknessVariable   = self->thicknessVariable;
-	double*                 coord               = particle->coord;
-	double                  length              = self->length;
-	double                  thickness           = self->thickness;
-	XYZ                     direction           = { 0, 0, 0 };
-
-	if ( self->directionVariable )
-		SwarmVariable_ValueAt( self->directionVariable, lParticle_I, direction );
-
-	if ( lengthVariable )
-		SwarmVariable_ValueAt( lengthVariable, lParticle_I, &length );
-
-	if ( thicknessVariable )
-		SwarmVariable_ValueAt( thicknessVariable, lParticle_I, &thickness );
-
-	glLineWidth( (float) thickness );
-
-	luc_DrawVector( context->dim, coord, direction, length, self->arrowHeadSize );
-}
-
-void lucSwarmVectors_UpdateVariables( void* drawingObject ) {
-	lucSwarmVectors*          self                = (lucSwarmVectors*)drawingObject;
-	lucSwarmViewerBase_UpdateVariables( drawingObject ) ;
-
-	if ( self->directionVariable && self->directionVariable->variable ) {
-		Variable_Update( self->directionVariable->variable );
-	}
-	if ( self->thicknessVariable && self->thicknessVariable->variable ) {
-		Variable_Update( self->thicknessVariable->variable );
-	}
-	if ( self->lengthVariable && self->lengthVariable->variable ) {
-		Variable_Update( self->lengthVariable->variable );
-	}
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmVectors.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/SwarmVectors.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,273 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: SwarmVectors.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "SwarmViewerBase.h"
+#include "SwarmViewer.h"
+#include "SwarmVectors.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucSwarmVectors_Type = "lucSwarmVectors";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucSwarmVectors* _lucSwarmVectors_New(  LUCSWARMVECTORS_DEFARGS  ) 
+{
+	lucSwarmVectors*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucSwarmVectors) );
+	self = (lucSwarmVectors*) _lucSwarmViewerBase_New(  LUCSWARMVIEWERBASE_PASSARGS  );
+	
+	return self;
+}
+
+void _lucSwarmVectors_Init( 
+		lucSwarmVectors*                                   self,
+		Name                                               directionVariableName,
+		double                                             arrowHeadSize,
+		Name                                               thicknessVariableName,
+		double                                             thickness,
+		Name                                               lengthVariableName,
+		double                                             length )
+{
+	Stream* errorStream         = Journal_MyStream( Error_Type, self );
+	
+	self->directionVariableName = directionVariableName;
+	self->arrowHeadSize         = arrowHeadSize;
+	Journal_Firewall( ( arrowHeadSize <= 1 && arrowHeadSize >= 0 ), errorStream,
+			"Error in %s:\narrowHeadSize given for %s was not in the range [0, 1]. " 
+			"Please use an arrowHeadSize within this range\n", __func__, self->name );
+	self->thicknessVariableName = thicknessVariableName;
+	self->thickness             = thickness;
+	self->lengthVariableName    = lengthVariableName;
+	self->length                = length;
+}
+
+void _lucSwarmVectors_Delete( void* drawingObject ) {
+	lucSwarmVectors*  self = (lucSwarmVectors*)drawingObject;
+
+	_lucSwarmViewerBase_Delete( self );
+}
+
+void _lucSwarmVectors_Print( void* drawingObject, Stream* stream ) {
+	lucSwarmVectors*  self = (lucSwarmVectors*)drawingObject;
+
+	_lucSwarmViewerBase_Print( self, stream );
+}
+
+void* _lucSwarmVectors_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucSwarmVectors*  self = (lucSwarmVectors*)drawingObject;
+	lucSwarmVectors* newDrawingObject;
+
+	newDrawingObject = _lucSwarmViewerBase_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucSwarmVectors_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucSwarmVectors);
+	Type                                                             type = lucSwarmVectors_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucSwarmVectors_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucSwarmVectors_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucSwarmVectors_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucSwarmVectors_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucSwarmVectors_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucSwarmVectors_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucSwarmVectors_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucSwarmVectors_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucSwarmVectors_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucSwarmVectors_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucSwarmVectors_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucSwarmVectors_BuildDisplayList;
+	lucSwarmViewerBase_PlotParticleFunction*                _plotParticle = _lucSwarmVectors_PlotParticle;
+	lucSwarmViewerBase_SetParticleColourFunction*      _setParticleColour = _lucSwarmViewerBase_SetParticleColourDefault;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucSwarmVectors_New(  LUCSWARMVECTORS_PASSARGS  );
+}
+
+void _lucSwarmVectors_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucSwarmVectors*  self = (lucSwarmVectors*)drawingObject;
+
+	/* Construct Parent */
+	_lucSwarmViewerBase_AssignFromXML( self, cf, data );
+
+	_lucSwarmVectors_Init( 
+			self,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"DirectionVariable", ""  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.5  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ThicknessVariable", ""  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"thickness", 1.0  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"LengthVariable", ""  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2 )  );
+}
+
+void _lucSwarmVectors_Build( void* drawingObject, void* data ) {
+	lucSwarmVectors*         self                   = (lucSwarmVectors*)drawingObject;
+
+	_lucSwarmViewerBase_Build( self, data );
+}
+void _lucSwarmVectors_Initialise( void* drawingObject, void* data ) {
+	lucSwarmVectors*         self                   = (lucSwarmVectors*)drawingObject;
+	SwarmVariable_Register*  swarmVariable_Register = self->swarm->swarmVariable_Register;
+	Stream*                  errorStream            = Journal_MyStream( Error_Type, self );
+
+	_lucSwarmViewerBase_Initialise( self, data );
+
+	if ( 0 != strcmp( self->directionVariableName, "" ) ) {
+		self->directionVariable    = SwarmVariable_Register_GetByName( swarmVariable_Register, self->directionVariableName );
+		Journal_Firewall( self->directionVariable != NULL, errorStream, 
+				"Error in func %s for %s '%s' - Cannot find SwarmVariable %s to be variable for direction vector.\n", 
+				__func__, self->type, self->name, self->directionVariableName );
+		Stg_Component_Build( self->directionVariable, data, False );
+		Stg_Component_Initialise( self->directionVariable, data, False );
+	}
+
+	if ( 0 != strcmp( self->thicknessVariableName, "" ) ) {
+		self->thicknessVariable    = SwarmVariable_Register_GetByName( swarmVariable_Register, self->thicknessVariableName );
+		Journal_Firewall( self->thicknessVariable != NULL, errorStream,
+			"Error - for gLucifer drawing object \"%s\" - in %s(): thickness Variable name given was \"%s\", "
+			"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+			self->name, __func__, self->thicknessVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->thicknessVariable, data, False );
+		Stg_Component_Initialise( self->thicknessVariable, data, False );
+	}
+	if ( 0 != strcmp( self->lengthVariableName, "" ) ) {
+		self->lengthVariable       = SwarmVariable_Register_GetByName( swarmVariable_Register, self->lengthVariableName );
+		Journal_Firewall( self->lengthVariable != NULL, errorStream,
+			"Error - for gLucifer drawing object \"%s\" - in %s(): length Variable name given was \"%s\", "
+			"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+			self->name, __func__, self->lengthVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->lengthVariable, data, False );
+		Stg_Component_Initialise( self->lengthVariable, data, False );
+	}
+}
+void _lucSwarmVectors_Execute( void* drawingObject, void* data ) {}
+void _lucSwarmVectors_Destroy( void* drawingObject, void* data ) {}
+
+void _lucSwarmVectors_Setup( void* drawingObject, void* _context ) {
+	_lucSwarmViewerBase_Setup( drawingObject, _context );
+	lucSwarmVectors_UpdateVariables( drawingObject );
+}
+	
+void _lucSwarmVectors_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	_lucSwarmViewerBase_Draw( drawingObject, window, viewportInfo, _context );
+}
+
+void _lucSwarmVectors_CleanUp( void* drawingObject, void* _context ) {
+	_lucSwarmViewerBase_CleanUp( drawingObject, _context );
+}
+
+void _lucSwarmVectors_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucSwarmVectors*         self                = (lucSwarmVectors*)drawingObject;
+	
+	_lucSwarmViewerBase_BuildDisplayList( self, _context );
+}
+
+void _lucSwarmVectors_PlotParticle( void* drawingObject, void* _context, Particle_Index lParticle_I ) {
+	lucSwarmVectors*        self                = (lucSwarmVectors*)drawingObject;
+	DomainContext*   		context             = (DomainContext*) _context;
+	GlobalParticle*         particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
+	SwarmVariable*          lengthVariable      = self->lengthVariable;
+	SwarmVariable*          thicknessVariable   = self->thicknessVariable;
+	double*                 coord               = particle->coord;
+	double                  length              = self->length;
+	double                  thickness           = self->thickness;
+	XYZ                     direction           = { 0, 0, 0 };
+
+	if ( self->directionVariable )
+		SwarmVariable_ValueAt( self->directionVariable, lParticle_I, direction );
+
+	if ( lengthVariable )
+		SwarmVariable_ValueAt( lengthVariable, lParticle_I, &length );
+
+	if ( thicknessVariable )
+		SwarmVariable_ValueAt( thicknessVariable, lParticle_I, &thickness );
+
+	glLineWidth( (float) thickness );
+
+	luc_DrawVector( context->dim, coord, direction, length, self->arrowHeadSize );
+}
+
+void lucSwarmVectors_UpdateVariables( void* drawingObject ) {
+	lucSwarmVectors*          self                = (lucSwarmVectors*)drawingObject;
+	lucSwarmViewerBase_UpdateVariables( drawingObject ) ;
+
+	if ( self->directionVariable && self->directionVariable->variable ) {
+		Variable_Update( self->directionVariable->variable );
+	}
+	if ( self->thicknessVariable && self->thicknessVariable->variable ) {
+		Variable_Update( self->thicknessVariable->variable );
+	}
+	if ( self->lengthVariable && self->lengthVariable->variable ) {
+		Variable_Update( self->lengthVariable->variable );
+	}
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmViewer.c
--- a/DrawingObjects/src/SwarmViewer.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,245 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: SwarmViewer.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#ifdef GLUCIFER_USE_PICELLERATOR
-#include <StgFEM/StgFEM.h>
-#include <PICellerator/PICellerator.h>
-#endif
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-
-#include "OpenGLDrawingObject.h"
-#include "SwarmViewerBase.h"
-#include "SwarmViewer.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucSwarmViewer_Type = "lucSwarmViewer";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucSwarmViewer* _lucSwarmViewer_New(  LUCSWARMVIEWER_DEFARGS  ) 
-{
-	lucSwarmViewer*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucSwarmViewer) );
-	self = (lucSwarmViewer*) _lucSwarmViewerBase_New(  LUCSWARMVIEWERBASE_PASSARGS  );
-
-	return self;
-}
-
-void _lucSwarmViewer_Init( 
-	lucSwarmViewer*                                              self,
-	float                                                        pointSize, 
-	Bool													     pointSmoothing )
-{
-	self->pointSize           = pointSize;
-	self->pointSmoothing      = pointSmoothing;
-}
-
-void _lucSwarmViewer_Delete( void* drawingObject ) {
-	lucSwarmViewer*  self = (lucSwarmViewer*)drawingObject;
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucSwarmViewer_Print( void* drawingObject, Stream* stream ) {
-	lucSwarmViewer*  self = (lucSwarmViewer*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucSwarmViewer_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucSwarmViewer*  self = (lucSwarmViewer*)drawingObject;
-	lucSwarmViewer* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucSwarmViewer_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucSwarmViewer);
-	Type                                                             type = lucSwarmViewer_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucSwarmViewer_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucSwarmViewer_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucSwarmViewer_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucSwarmViewer_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucSwarmViewer_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucSwarmViewer_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucSwarmViewer_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucSwarmViewer_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucSwarmViewer_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucSwarmViewer_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucSwarmViewer_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucSwarmViewer_BuildDisplayList;
-	lucSwarmViewerBase_PlotParticleFunction*                _plotParticle = _lucSwarmViewer_PlotParticle;
-	lucSwarmViewerBase_SetParticleColourFunction*      _setParticleColour = _lucSwarmViewerBase_SetParticleColourDefault;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucSwarmViewer_New(  LUCSWARMVIEWER_PASSARGS  );
-}
-
-void _lucSwarmViewer_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucSwarmViewer*         self = (lucSwarmViewer*)drawingObject;
-
-	/* Construct Parent */
-	_lucSwarmViewerBase_AssignFromXML( self, cf, data );
-	
-	_lucSwarmViewer_Init( 
-		self, 
-		(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"pointSize", 1.0  ),
-		(Bool ) Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"pointSmoothing", 0 )
-	   );
-}
-
-void _lucSwarmViewer_Build( void* drawingObject, void* data ) {
-	_lucSwarmViewerBase_Build( drawingObject, data );
-}
-
-void _lucSwarmViewer_Initialise( void* drawingObject, void* data ) {
-	_lucSwarmViewerBase_Initialise( drawingObject, data );
-}
-
-
-void _lucSwarmViewer_Execute( void* drawingObject, void* data ) {}
-void _lucSwarmViewer_Destroy( void* drawingObject, void* data ) {}
-
-void _lucSwarmViewer_Setup( void* drawingObject, void* _context ) {
-	lucSwarmViewer*          self                = (lucSwarmViewer*)drawingObject;
-	
-	_lucSwarmViewerBase_Setup( self, _context );
-}
-
-void _lucSwarmViewer_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucSwarmViewer*          self          = (lucSwarmViewer*)drawingObject;
-	lucCamera*               camera        = viewportInfo->viewport->camera;
-	XYZ                      normal;
-
-	/* Draw the particles with a normal facing the camera 
-	 * these lines have to be here because the camera can move after building the display list */
-	StGermain_VectorSubtraction( normal, camera->coord, camera->focalPoint, 3 );
-	glNormal3dv(normal);
-
-	_lucSwarmViewerBase_Draw( self, window, viewportInfo, _context ); 
-}
-
-
-void _lucSwarmViewer_CleanUp( void* drawingObject, void* context ) {
-	lucSwarmViewer*          self          = (lucSwarmViewer*)drawingObject;
-	
-	_lucSwarmViewerBase_CleanUp( self, context );
-}
-
-void _lucSwarmViewer_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucSwarmViewer*          self                = (lucSwarmViewer*)drawingObject;
-
-	
-	/* lighting of small particle objects like particle dots seems to do more harm than good - 
-	   the gl lighting system doesn't seem to deal with lighting such tiny objects well. Lighting
-	   of particles doesn't really help the user anyway, so I've disabled it for now.
-	   PatrickSunter - 8 Jun 2006 */
-			
-	glDisable(GL_LIGHTING);
-		
-	if(self->pointSmoothing) { 
-        /* Round, smooth points */
-		glEnable(GL_POINT_SMOOTH);
-		/* Point smoothing will not work correctly with depth testing enabled*/
-	    glDepthFunc(GL_ALWAYS);
-    }
-	else 
-		glDisable(GL_POINT_SMOOTH);
-		
-	glPointSize( self->pointSize );
-	
-	glBegin( GL_POINTS );
-	_lucSwarmViewerBase_BuildDisplayList( self, _context );
-	glEnd( );
-
-	/* Put back lighting / smoothing settings to low-impact options */
-	glEnable(GL_LIGHTING);	
-		
-	if(self->pointSmoothing) {
-		glDisable(GL_POINT_SMOOTH);
-	    glDepthFunc(GL_LESS);
-	}
-}
-
-
-void _lucSwarmViewer_PlotParticle( void* drawingObject, void* _context, Particle_Index lParticle_I ) {
-	lucSwarmViewer*          self                = (lucSwarmViewer*)drawingObject;
-	DomainContext*   context             = (DomainContext*) _context;
-	GlobalParticle*          particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
-	double*                  coord               = particle->coord;
-	float                    offset              = 0.001; 
-
-	if (context->dim == 2)
-		glVertex3f( (float)coord[0], (float)coord[1], offset);
-	else   
-		glVertex3dv( coord );
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmViewer.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/SwarmViewer.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,245 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: SwarmViewer.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#ifdef GLUCIFER_USE_PICELLERATOR
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/PICellerator.h>
+#endif
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+
+#include "OpenGLDrawingObject.h"
+#include "SwarmViewerBase.h"
+#include "SwarmViewer.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucSwarmViewer_Type = "lucSwarmViewer";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucSwarmViewer* _lucSwarmViewer_New(  LUCSWARMVIEWER_DEFARGS  ) 
+{
+	lucSwarmViewer*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucSwarmViewer) );
+	self = (lucSwarmViewer*) _lucSwarmViewerBase_New(  LUCSWARMVIEWERBASE_PASSARGS  );
+
+	return self;
+}
+
+void _lucSwarmViewer_Init( 
+	lucSwarmViewer*                                              self,
+	float                                                        pointSize, 
+	Bool													     pointSmoothing )
+{
+	self->pointSize           = pointSize;
+	self->pointSmoothing      = pointSmoothing;
+}
+
+void _lucSwarmViewer_Delete( void* drawingObject ) {
+	lucSwarmViewer*  self = (lucSwarmViewer*)drawingObject;
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucSwarmViewer_Print( void* drawingObject, Stream* stream ) {
+	lucSwarmViewer*  self = (lucSwarmViewer*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucSwarmViewer_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucSwarmViewer*  self = (lucSwarmViewer*)drawingObject;
+	lucSwarmViewer* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucSwarmViewer_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucSwarmViewer);
+	Type                                                             type = lucSwarmViewer_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucSwarmViewer_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucSwarmViewer_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucSwarmViewer_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucSwarmViewer_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucSwarmViewer_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucSwarmViewer_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucSwarmViewer_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucSwarmViewer_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucSwarmViewer_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucSwarmViewer_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucSwarmViewer_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucSwarmViewer_BuildDisplayList;
+	lucSwarmViewerBase_PlotParticleFunction*                _plotParticle = _lucSwarmViewer_PlotParticle;
+	lucSwarmViewerBase_SetParticleColourFunction*      _setParticleColour = _lucSwarmViewerBase_SetParticleColourDefault;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucSwarmViewer_New(  LUCSWARMVIEWER_PASSARGS  );
+}
+
+void _lucSwarmViewer_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucSwarmViewer*         self = (lucSwarmViewer*)drawingObject;
+
+	/* Construct Parent */
+	_lucSwarmViewerBase_AssignFromXML( self, cf, data );
+	
+	_lucSwarmViewer_Init( 
+		self, 
+		(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"pointSize", 1.0  ),
+		(Bool ) Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"pointSmoothing", 0 )
+	   );
+}
+
+void _lucSwarmViewer_Build( void* drawingObject, void* data ) {
+	_lucSwarmViewerBase_Build( drawingObject, data );
+}
+
+void _lucSwarmViewer_Initialise( void* drawingObject, void* data ) {
+	_lucSwarmViewerBase_Initialise( drawingObject, data );
+}
+
+
+void _lucSwarmViewer_Execute( void* drawingObject, void* data ) {}
+void _lucSwarmViewer_Destroy( void* drawingObject, void* data ) {}
+
+void _lucSwarmViewer_Setup( void* drawingObject, void* _context ) {
+	lucSwarmViewer*          self                = (lucSwarmViewer*)drawingObject;
+	
+	_lucSwarmViewerBase_Setup( self, _context );
+}
+
+void _lucSwarmViewer_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucSwarmViewer*          self          = (lucSwarmViewer*)drawingObject;
+	lucCamera*               camera        = viewportInfo->viewport->camera;
+	XYZ                      normal;
+
+	/* Draw the particles with a normal facing the camera 
+	 * these lines have to be here because the camera can move after building the display list */
+	StGermain_VectorSubtraction( normal, camera->coord, camera->focalPoint, 3 );
+	glNormal3dv(normal);
+
+	_lucSwarmViewerBase_Draw( self, window, viewportInfo, _context ); 
+}
+
+
+void _lucSwarmViewer_CleanUp( void* drawingObject, void* context ) {
+	lucSwarmViewer*          self          = (lucSwarmViewer*)drawingObject;
+	
+	_lucSwarmViewerBase_CleanUp( self, context );
+}
+
+void _lucSwarmViewer_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucSwarmViewer*          self                = (lucSwarmViewer*)drawingObject;
+
+	
+	/* lighting of small particle objects like particle dots seems to do more harm than good - 
+	   the gl lighting system doesn't seem to deal with lighting such tiny objects well. Lighting
+	   of particles doesn't really help the user anyway, so I've disabled it for now.
+	   PatrickSunter - 8 Jun 2006 */
+			
+	glDisable(GL_LIGHTING);
+		
+	if(self->pointSmoothing) { 
+        /* Round, smooth points */
+		glEnable(GL_POINT_SMOOTH);
+		/* Point smoothing will not work correctly with depth testing enabled*/
+	    glDepthFunc(GL_ALWAYS);
+    }
+	else 
+		glDisable(GL_POINT_SMOOTH);
+		
+	glPointSize( self->pointSize );
+	
+	glBegin( GL_POINTS );
+	_lucSwarmViewerBase_BuildDisplayList( self, _context );
+	glEnd( );
+
+	/* Put back lighting / smoothing settings to low-impact options */
+	glEnable(GL_LIGHTING);	
+		
+	if(self->pointSmoothing) {
+		glDisable(GL_POINT_SMOOTH);
+	    glDepthFunc(GL_LESS);
+	}
+}
+
+
+void _lucSwarmViewer_PlotParticle( void* drawingObject, void* _context, Particle_Index lParticle_I ) {
+	lucSwarmViewer*          self                = (lucSwarmViewer*)drawingObject;
+	DomainContext*   context             = (DomainContext*) _context;
+	GlobalParticle*          particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
+	double*                  coord               = particle->coord;
+	float                    offset              = 0.001; 
+
+	if (context->dim == 2)
+		glVertex3f( (float)coord[0], (float)coord[1], offset);
+	else   
+		glVertex3dv( coord );
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmViewerBase.c
--- a/DrawingObjects/src/SwarmViewerBase.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,455 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: SwarmViewer.c 595 2006-07-18 06:53:06Z LukeHodkinson $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#ifdef GLUCIFER_USE_PICELLERATOR
-#include <StgFEM/StgFEM.h>
-#include <PICellerator/PICellerator.h>
-#endif
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#ifdef HAVE_GL2PS
-	#include <gl2ps.h>
-#endif
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "SwarmViewerBase.h"
-#include "SwarmViewer.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucSwarmViewerBase_Type = "lucSwarmViewerBase";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucSwarmViewerBase* _lucSwarmViewerBase_New(  LUCSWARMVIEWERBASE_DEFARGS  ) 
-{
-	
-	lucSwarmViewerBase*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucSwarmViewerBase) );
-	self = (lucSwarmViewerBase*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-
-	self->_plotParticle = _plotParticle;
-	self->_setParticleColour = _setParticleColour;
-
-	return self;
-}
-
-void _lucSwarmViewerBase_Init( 
-	lucSwarmViewerBase*                                          self,
-	Swarm*                                                       swarm,
-	Name                                                         colourName,
-	Name                                                         colourVariableName,
-	lucColourMap*                                                colourMap,
-	Name                                                         opacityVariableName,
-	Name                                                         maskVariableName,
-	lucDrawingObjectMask*                                        mask,
-	Bool                                                         drawParticleNumber,
-	Bool                                                         particleColour,
-	int                                                          subSetEvery,
-	Bool                                                         positionRange,
-	Coord                                                        minPosition,
-	Coord                                                        maxPosition
-	)
-{
-	self->swarm               = swarm;	
-	self->colourVariableName  = colourVariableName;
-	self->colourMap           = colourMap;
-	self->opacityVariableName = opacityVariableName;
-	self->maskVariableName    = maskVariableName;
-	self->drawParticleNumber  = drawParticleNumber;
-	self->sameParticleColour  = particleColour;
-	self->subSetEvery         = subSetEvery;
-	self->positionRange       = positionRange;
-
-	memcpy( &self->mask, mask, sizeof( lucDrawingObjectMask ) );
-	memcpy( &self->minPosition, minPosition , sizeof( Coord ) );
-	memcpy( &self->maxPosition, maxPosition , sizeof( Coord ) );
-	
-	lucColour_FromString( &self->colour, colourName );
-}
-
-void _lucSwarmViewerBase_Delete( void* drawingObject ) {
-	lucSwarmViewerBase*  self = (lucSwarmViewerBase*)drawingObject;
-	
-	_lucOpenGLDrawingObject_Delete( self );
-      
-}
-
-void _lucSwarmViewerBase_Print( void* drawingObject, Stream* stream ) {
-	lucSwarmViewerBase*  self = (lucSwarmViewerBase*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucSwarmViewerBase_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucSwarmViewerBase*  self = (lucSwarmViewerBase*)drawingObject;
-	lucSwarmViewerBase* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-void _lucSwarmViewerBase_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucSwarmViewerBase*     self = (lucSwarmViewerBase*)drawingObject;
-	Swarm*                  swarm;	
-	Name                    colourVariableName;
-	lucColourMap*           colourMap;
-	Name                    opacityVariableName;
-	Name                    maskVariableName;
-	Bool                    drawParticleNumber;
-	Bool                    sameParticleColour;
-	int 			subSetEvery;
-	Bool                    positionRange;
-	Coord                   minPosition;
-	Coord                   maxPosition;
-	lucDrawingObjectMask    mask;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	swarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Swarm", Swarm, True, data  ) ;
-	
-	/* This drawing object will only work for swarms with Global Particle Layouts 
-	 *  HACK - Adding in check for Gauss particle Layout here because this can be global too */
-	Journal_Firewall(
-		swarm->particleLayout->coordSystem == GlobalCoordSystem || Stg_Class_IsInstance( swarm->particleLayout, GaussParticleLayout_Type ),
-		Journal_MyStream( Error_Type, self ),
-		"In func %s, unable to visualise swarm %s because it uses a local coord system layout %s of type %s.\n",
-		__func__,
-		swarm->name,
-		swarm->particleLayout->name,
-		swarm->particleLayout->type );
-
-	colourVariableName  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourVariable", ""  );
-	colourMap           =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
-	opacityVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"OpacityVariable", ""  );
-	maskVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"MaskVariable", ""  );
-	
-	drawParticleNumber = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawParticleNumber", False  );
-	sameParticleColour = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"sameParticleColour", False  );
-
-	subSetEvery = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"subSetEvery", 1  );
-	positionRange = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"positionRange", False  );
-
-	/* Memory allocation */
-       	minPosition[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minPositionX", -100000.0  );
-	minPosition[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minPositionY", -100000.0  );
-	minPosition[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minPositionZ", -100000.0  );
-
-	maxPosition[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxPositionX", 100000.0  );
-	maxPosition[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxPositionY", 100000.0  );
-	maxPosition[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxPositionZ", 100000.0  );
-
-
-	lucDrawingObjectMask_Construct( &mask, self->name, cf, data );
-
-	_lucSwarmViewerBase_Init( 
-		self, 
-		swarm,
-		Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
-		colourVariableName,
-		colourMap,
-		opacityVariableName,
-		maskVariableName,
-		&mask,
-		drawParticleNumber,
-		sameParticleColour, 
-		subSetEvery,
-		positionRange,
-		minPosition,
-		maxPosition);
-}
-
-void _lucSwarmViewerBase_Build( void* drawingObject, void* data ) {
-	lucSwarmViewerBase*          self                   = (lucSwarmViewerBase*)drawingObject;
-
-	_lucOpenGLDrawingObject_Build( self, data );
-}
-
-void _lucSwarmViewerBase_Initialise( void* drawingObject, void* data ) {
-	lucSwarmViewerBase*          self                   = (lucSwarmViewerBase*)drawingObject;
-	SwarmVariable_Register*  swarmVariable_Register = self->swarm->swarmVariable_Register;
-	Stream*                  errorStream               = Journal_Register( Error_Type, (Name)self->type  );
-	
-	/* Initialise Parent */
-	_lucOpenGLDrawingObject_Initialise( self, data );
-
-	if ( 0 != strcmp( self->colourVariableName, "" ) ) {
-		self->colourVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourVariableName );
-		Journal_Firewall( self->colourVariable != NULL, errorStream,
-					"Error - for gLucifer drawing object \"%s\" - in %s(): colour Variable name given was \"%s\", "
-					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-					self->name, __func__, self->colourVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->colourVariable, data, False );
-		Stg_Component_Initialise( self->colourVariable, data, False );
-	}
-	if ( 0 != strcmp( self->opacityVariableName, "" ) ) {
-		self->opacityVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->opacityVariableName );
-		Journal_Firewall( self->opacityVariable != NULL, errorStream,
-					"Error - for gLucifer drawing object \"%s\" - in %s(): opacity Variable name given was \"%s\", "
-					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-					self->name, __func__, self->opacityVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->opacityVariable, data, False );
-		Stg_Component_Initialise( self->opacityVariable, data, False );
-	}
-	if ( 0 != strcmp( self->maskVariableName, "" ) ) {
-		self->maskVariable    = SwarmVariable_Register_GetByName( swarmVariable_Register, self->maskVariableName );
-		Journal_Firewall( self->maskVariable != NULL, errorStream,
-				"Error - for gLucifer drawing object \"%s\" - in %s(): mask Variable name given was \"%s\", "
-					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
-					self->name, __func__, self->maskVariableName, self->swarm->name );
-		
-		Stg_Component_Build( self->maskVariable, data, False );
-		Stg_Component_Initialise( self->maskVariable, data, False );
-	}	
-}
-
-
-void _lucSwarmViewerBase_Execute( void* drawingObject, void* data ) {}
-void _lucSwarmViewerBase_Destroy( void* drawingObject, void* data ) {}
-
-void _lucSwarmViewerBase_Setup( void* drawingObject, void* _context ) {
-	lucSwarmViewerBase*          self                = (lucSwarmViewerBase*)drawingObject;
-	lucColourMap*                colourMap           = self->colourMap;
-	SwarmVariable*               colourVariable      = self->colourVariable;
-
-	lucSwarmViewerBase_UpdateVariables( self );
-	
-	/* Scale Colour Map */
-	if ( colourVariable && colourMap ) {
-		lucColourMap_CalibrateFromSwarmVariable( colourMap, colourVariable );
-	}
-	
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-
-void _lucSwarmViewerBase_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucSwarmViewerBase*          self          = (lucSwarmViewerBase*)drawingObject;
-
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucSwarmViewerBase_CleanUp( void* drawingObject, void* context ) {
-	lucSwarmViewerBase*          self          = (lucSwarmViewerBase*)drawingObject;
-	
-	_lucOpenGLDrawingObject_CleanUp( self, context );
-}
-
-void _lucSwarmViewerBase_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucSwarmViewerBase*      self                = (lucSwarmViewerBase*)drawingObject;
-	Swarm*                   swarm               = self->swarm;
-	SwarmVariable*           maskVariable        = self->maskVariable;
-	Particle_Index           particleLocalCount  = swarm->particleLocalCount;
-	Particle_Index           lParticle_I;
-	double                   maskResult;
-	int                      subSetEvery         = self->subSetEvery;
-	Bool                     positionRange       = self->positionRange;
-	GlobalParticle*          particle;
-	double*                  coord;
-	double*                  minPosition;
-	double*                  maxPosition;
-
-	minPosition = self->minPosition;
-	maxPosition = self->maxPosition;
-
-	/* Take one of subSetEvery particle */
-      	for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I+=subSetEvery ){
-
-		/* Test to see if this particle should be drawn */
-		if ( maskVariable ) {
-			SwarmVariable_ValueAt( maskVariable, lParticle_I, &maskResult );
-			if ( lucDrawingObjectMask_Test( &self->mask, maskResult ) == False )
-				continue;
-		}
-
-		/* Sets the colour for the particle */
-		self->_setParticleColour( self, _context, lParticle_I );
-		
-	        /* Check if needed that the particle falls into the right position range */
-		if(positionRange){
-			particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
-			coord               = particle->coord;
-
-			if( coord[0] <= minPosition[I_AXIS] || coord[1] <= minPosition[J_AXIS] || 
-			    coord[0] >= maxPosition[I_AXIS] || coord[1] >= maxPosition[J_AXIS] )
-			{
-				continue;
-			}
-
-			if( ((DomainContext*)_context)->dim == 3 ) {
-				if( coord[2] <= minPosition[K_AXIS] || coord[2] >= maxPosition[K_AXIS] )
-					continue;
-			}
-		}
-
-		/* Plot the particle using the function given by the concrete class */
-		self->_plotParticle( self, _context, lParticle_I );
-	}	
-
-	/* Go through the list of the particles again and write the text of the numbers next to each other */
-	if ( self->drawParticleNumber ) {
-		lucSwarmViewBase_DrawParticleNumbers( self, _context );
-	}
-}
-void lucSwarmViewBase_DrawParticleNumbers( void* drawingObject, void* _context ) {
-	abort();
-}
-
-void _lucSwarmViewerBase_PlotParticleNumber( void* drawingObject, void* _context, Particle_Index lParticle_I, lucColour colour ) {
-	lucSwarmViewerBase*      self                = (lucSwarmViewerBase*)drawingObject;
-	DomainContext*   context             = (DomainContext*) _context;
-	GlobalParticle*          particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
-	double*                  coord               = particle->coord;
-        Name particle_number;
-	Stg_asprintf(&particle_number, "%d", lParticle_I );
-	
-	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
-
-	if (context->dim == 2)
-		glRasterPos2f( (float)coord[0] + 0.025, (float)coord[1] );		
-	else   
-		glRasterPos3f( (float)coord[0] + 0.025, (float)coord[1], (float)coord[2] );
-
-	lucPrintString( particle_number );
-
-	Memory_Free(particle_number);
-           
-	/* Put back settings */
-	glEnable(GL_LIGHTING);
-
-}
-
-void lucSwarmViewerBase_FindParticleLocalIndex(void *drawingObject, Coord coord, Particle_Index *lParticle_I){
-	lucSwarmViewerBase*      self  = (lucSwarmViewerBase*) drawingObject;
-	Swarm*               swarm = self->swarm;
-	Dimension_Index      dim = self->swarm->dim;
-	Particle_InCellIndex cParticle_I;
-	Cell_LocalIndex      lCell_I;
-	GlobalParticle       testParticle;
-	double               minDistance;
-	
-	/* Find cell this coordinate is in */
-	memcpy( testParticle.coord, coord, sizeof(Coord) );
-	/* First specify the particle doesn't have an owning cell yet, so as
-	   not to confuse the search algorithm */
-	testParticle.owningCell = swarm->cellDomainCount;
-	lCell_I = CellLayout_CellOf( swarm->cellLayout, &testParticle );
-
-	/* Test if this cell is on this processor - if not then bail */
-	if (lCell_I >= swarm->cellLocalCount){
-		*lParticle_I = (Particle_Index) -1;
-		return;
-	}
-
-	/* Find Closest Particle in this Cell */
-	cParticle_I = Swarm_FindClosestParticleInCell( swarm, lCell_I, dim, coord, &minDistance );
-
-	/* Convert to Local Particle Index */
-	*lParticle_I = swarm->cellParticleTbl[ lCell_I ][ cParticle_I ];
-}
-
-
-
-void lucSwarmViewerBase_UpdateVariables( void* drawingObject ) {
-	lucSwarmViewerBase*          self                = (lucSwarmViewerBase*)drawingObject;
-
-	if ( self->opacityVariable && self->opacityVariable->variable ) {
-		Variable_Update( self->opacityVariable->variable );
-	}
-	if ( self->maskVariable && self->maskVariable->variable ) {
-		Variable_Update( self->maskVariable->variable );
-	}
-}
-
-/* Default Swarm Viewer Implementation */
-void _lucSwarmViewerBase_SetParticleColourDefault( void* drawingObject, void* context, Particle_Index lParticle_I ) {
-	lucSwarmViewer*          self                = (lucSwarmViewer*) drawingObject;
-	SwarmVariable*           colourVariable      = self->colourVariable;
-	SwarmVariable*           opacityVariable     = self->opacityVariable;
-	lucColourMap*            colourMap           = self->colourMap;
-	double                   colourValue;
-	double                   opacity;
-	lucColour                colour;
-
- 	/* Get colour value if there is a colourVariable and a colourMap */
-	if ( colourVariable && colourMap ) {
-		SwarmVariable_ValueAt( colourVariable, lParticle_I, &colourValue );
-		lucColourMap_GetColourFromValue( colourMap, colourValue, &colour );
-	}
-	else {
-		/* Set the default Colour */
-		memcpy( &colour, &self->colour, sizeof(lucColour) );
-	}
-	
-	/* Get Opacity Value */
-	if ( opacityVariable ){   /* This should have a greymap - similar to the colourmap but only one channel */
-		SwarmVariable_ValueAt( opacityVariable, lParticle_I, &opacity );
-		colour.opacity = (float)opacity;	
-	}
-
-	lucColour_SetOpenGLColour( &colour );
-}
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/SwarmViewerBase.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/SwarmViewerBase.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,455 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: SwarmViewer.c 595 2006-07-18 06:53:06Z LukeHodkinson $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#ifdef GLUCIFER_USE_PICELLERATOR
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/PICellerator.h>
+#endif
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#ifdef HAVE_GL2PS
+	#include <gl2ps.h>
+#endif
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "SwarmViewerBase.h"
+#include "SwarmViewer.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucSwarmViewerBase_Type = "lucSwarmViewerBase";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucSwarmViewerBase* _lucSwarmViewerBase_New(  LUCSWARMVIEWERBASE_DEFARGS  ) 
+{
+	
+	lucSwarmViewerBase*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucSwarmViewerBase) );
+	self = (lucSwarmViewerBase*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+
+	self->_plotParticle = _plotParticle;
+	self->_setParticleColour = _setParticleColour;
+
+	return self;
+}
+
+void _lucSwarmViewerBase_Init( 
+	lucSwarmViewerBase*                                          self,
+	Swarm*                                                       swarm,
+	Name                                                         colourName,
+	Name                                                         colourVariableName,
+	lucColourMap*                                                colourMap,
+	Name                                                         opacityVariableName,
+	Name                                                         maskVariableName,
+	lucDrawingObjectMask*                                        mask,
+	Bool                                                         drawParticleNumber,
+	Bool                                                         particleColour,
+	int                                                          subSetEvery,
+	Bool                                                         positionRange,
+	Coord                                                        minPosition,
+	Coord                                                        maxPosition
+	)
+{
+	self->swarm               = swarm;	
+	self->colourVariableName  = colourVariableName;
+	self->colourMap           = colourMap;
+	self->opacityVariableName = opacityVariableName;
+	self->maskVariableName    = maskVariableName;
+	self->drawParticleNumber  = drawParticleNumber;
+	self->sameParticleColour  = particleColour;
+	self->subSetEvery         = subSetEvery;
+	self->positionRange       = positionRange;
+
+	memcpy( &self->mask, mask, sizeof( lucDrawingObjectMask ) );
+	memcpy( &self->minPosition, minPosition , sizeof( Coord ) );
+	memcpy( &self->maxPosition, maxPosition , sizeof( Coord ) );
+	
+	lucColour_FromString( &self->colour, colourName );
+}
+
+void _lucSwarmViewerBase_Delete( void* drawingObject ) {
+	lucSwarmViewerBase*  self = (lucSwarmViewerBase*)drawingObject;
+	
+	_lucOpenGLDrawingObject_Delete( self );
+      
+}
+
+void _lucSwarmViewerBase_Print( void* drawingObject, Stream* stream ) {
+	lucSwarmViewerBase*  self = (lucSwarmViewerBase*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucSwarmViewerBase_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucSwarmViewerBase*  self = (lucSwarmViewerBase*)drawingObject;
+	lucSwarmViewerBase* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+void _lucSwarmViewerBase_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucSwarmViewerBase*     self = (lucSwarmViewerBase*)drawingObject;
+	Swarm*                  swarm;	
+	Name                    colourVariableName;
+	lucColourMap*           colourMap;
+	Name                    opacityVariableName;
+	Name                    maskVariableName;
+	Bool                    drawParticleNumber;
+	Bool                    sameParticleColour;
+	int 			subSetEvery;
+	Bool                    positionRange;
+	Coord                   minPosition;
+	Coord                   maxPosition;
+	lucDrawingObjectMask    mask;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	swarm = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Swarm", Swarm, True, data  ) ;
+	
+	/* This drawing object will only work for swarms with Global Particle Layouts 
+	 *  HACK - Adding in check for Gauss particle Layout here because this can be global too */
+	Journal_Firewall(
+		swarm->particleLayout->coordSystem == GlobalCoordSystem || Stg_Class_IsInstance( swarm->particleLayout, GaussParticleLayout_Type ),
+		Journal_MyStream( Error_Type, self ),
+		"In func %s, unable to visualise swarm %s because it uses a local coord system layout %s of type %s.\n",
+		__func__,
+		swarm->name,
+		swarm->particleLayout->name,
+		swarm->particleLayout->type );
+
+	colourVariableName  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"ColourVariable", ""  );
+	colourMap           =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourMap", lucColourMap, False, data  );
+	opacityVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"OpacityVariable", ""  );
+	maskVariableName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"MaskVariable", ""  );
+	
+	drawParticleNumber = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawParticleNumber", False  );
+	sameParticleColour = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"sameParticleColour", False  );
+
+	subSetEvery = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"subSetEvery", 1  );
+	positionRange = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"positionRange", False  );
+
+	/* Memory allocation */
+       	minPosition[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minPositionX", -100000.0  );
+	minPosition[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minPositionY", -100000.0  );
+	minPosition[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"minPositionZ", -100000.0  );
+
+	maxPosition[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxPositionX", 100000.0  );
+	maxPosition[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxPositionY", 100000.0  );
+	maxPosition[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxPositionZ", 100000.0  );
+
+
+	lucDrawingObjectMask_Construct( &mask, self->name, cf, data );
+
+	_lucSwarmViewerBase_Init( 
+		self, 
+		swarm,
+		Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
+		colourVariableName,
+		colourMap,
+		opacityVariableName,
+		maskVariableName,
+		&mask,
+		drawParticleNumber,
+		sameParticleColour, 
+		subSetEvery,
+		positionRange,
+		minPosition,
+		maxPosition);
+}
+
+void _lucSwarmViewerBase_Build( void* drawingObject, void* data ) {
+	lucSwarmViewerBase*          self                   = (lucSwarmViewerBase*)drawingObject;
+
+	_lucOpenGLDrawingObject_Build( self, data );
+}
+
+void _lucSwarmViewerBase_Initialise( void* drawingObject, void* data ) {
+	lucSwarmViewerBase*          self                   = (lucSwarmViewerBase*)drawingObject;
+	SwarmVariable_Register*  swarmVariable_Register = self->swarm->swarmVariable_Register;
+	Stream*                  errorStream               = Journal_Register( Error_Type, (Name)self->type  );
+	
+	/* Initialise Parent */
+	_lucOpenGLDrawingObject_Initialise( self, data );
+
+	if ( 0 != strcmp( self->colourVariableName, "" ) ) {
+		self->colourVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->colourVariableName );
+		Journal_Firewall( self->colourVariable != NULL, errorStream,
+					"Error - for gLucifer drawing object \"%s\" - in %s(): colour Variable name given was \"%s\", "
+					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+					self->name, __func__, self->colourVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->colourVariable, data, False );
+		Stg_Component_Initialise( self->colourVariable, data, False );
+	}
+	if ( 0 != strcmp( self->opacityVariableName, "" ) ) {
+		self->opacityVariable = SwarmVariable_Register_GetByName( swarmVariable_Register, self->opacityVariableName );
+		Journal_Firewall( self->opacityVariable != NULL, errorStream,
+					"Error - for gLucifer drawing object \"%s\" - in %s(): opacity Variable name given was \"%s\", "
+					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+					self->name, __func__, self->opacityVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->opacityVariable, data, False );
+		Stg_Component_Initialise( self->opacityVariable, data, False );
+	}
+	if ( 0 != strcmp( self->maskVariableName, "" ) ) {
+		self->maskVariable    = SwarmVariable_Register_GetByName( swarmVariable_Register, self->maskVariableName );
+		Journal_Firewall( self->maskVariable != NULL, errorStream,
+				"Error - for gLucifer drawing object \"%s\" - in %s(): mask Variable name given was \"%s\", "
+					"but no corresponding SwarmVariable found in the register for swarm \"%s\".\n",
+					self->name, __func__, self->maskVariableName, self->swarm->name );
+		
+		Stg_Component_Build( self->maskVariable, data, False );
+		Stg_Component_Initialise( self->maskVariable, data, False );
+	}	
+}
+
+
+void _lucSwarmViewerBase_Execute( void* drawingObject, void* data ) {}
+void _lucSwarmViewerBase_Destroy( void* drawingObject, void* data ) {}
+
+void _lucSwarmViewerBase_Setup( void* drawingObject, void* _context ) {
+	lucSwarmViewerBase*          self                = (lucSwarmViewerBase*)drawingObject;
+	lucColourMap*                colourMap           = self->colourMap;
+	SwarmVariable*               colourVariable      = self->colourVariable;
+
+	lucSwarmViewerBase_UpdateVariables( self );
+	
+	/* Scale Colour Map */
+	if ( colourVariable && colourMap ) {
+		lucColourMap_CalibrateFromSwarmVariable( colourMap, colourVariable );
+	}
+	
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+
+void _lucSwarmViewerBase_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucSwarmViewerBase*          self          = (lucSwarmViewerBase*)drawingObject;
+
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucSwarmViewerBase_CleanUp( void* drawingObject, void* context ) {
+	lucSwarmViewerBase*          self          = (lucSwarmViewerBase*)drawingObject;
+	
+	_lucOpenGLDrawingObject_CleanUp( self, context );
+}
+
+void _lucSwarmViewerBase_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucSwarmViewerBase*      self                = (lucSwarmViewerBase*)drawingObject;
+	Swarm*                   swarm               = self->swarm;
+	SwarmVariable*           maskVariable        = self->maskVariable;
+	Particle_Index           particleLocalCount  = swarm->particleLocalCount;
+	Particle_Index           lParticle_I;
+	double                   maskResult;
+	int                      subSetEvery         = self->subSetEvery;
+	Bool                     positionRange       = self->positionRange;
+	GlobalParticle*          particle;
+	double*                  coord;
+	double*                  minPosition;
+	double*                  maxPosition;
+
+	minPosition = self->minPosition;
+	maxPosition = self->maxPosition;
+
+	/* Take one of subSetEvery particle */
+      	for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ; lParticle_I+=subSetEvery ){
+
+		/* Test to see if this particle should be drawn */
+		if ( maskVariable ) {
+			SwarmVariable_ValueAt( maskVariable, lParticle_I, &maskResult );
+			if ( lucDrawingObjectMask_Test( &self->mask, maskResult ) == False )
+				continue;
+		}
+
+		/* Sets the colour for the particle */
+		self->_setParticleColour( self, _context, lParticle_I );
+		
+	        /* Check if needed that the particle falls into the right position range */
+		if(positionRange){
+			particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
+			coord               = particle->coord;
+
+			if( coord[0] <= minPosition[I_AXIS] || coord[1] <= minPosition[J_AXIS] || 
+			    coord[0] >= maxPosition[I_AXIS] || coord[1] >= maxPosition[J_AXIS] )
+			{
+				continue;
+			}
+
+			if( ((DomainContext*)_context)->dim == 3 ) {
+				if( coord[2] <= minPosition[K_AXIS] || coord[2] >= maxPosition[K_AXIS] )
+					continue;
+			}
+		}
+
+		/* Plot the particle using the function given by the concrete class */
+		self->_plotParticle( self, _context, lParticle_I );
+	}	
+
+	/* Go through the list of the particles again and write the text of the numbers next to each other */
+	if ( self->drawParticleNumber ) {
+		lucSwarmViewBase_DrawParticleNumbers( self, _context );
+	}
+}
+void lucSwarmViewBase_DrawParticleNumbers( void* drawingObject, void* _context ) {
+	abort();
+}
+
+void _lucSwarmViewerBase_PlotParticleNumber( void* drawingObject, void* _context, Particle_Index lParticle_I, lucColour colour ) {
+	lucSwarmViewerBase*      self                = (lucSwarmViewerBase*)drawingObject;
+	DomainContext*   context             = (DomainContext*) _context;
+	GlobalParticle*          particle            = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
+	double*                  coord               = particle->coord;
+        Name particle_number;
+	Stg_asprintf(&particle_number, "%d", lParticle_I );
+	
+	glDisable(GL_LIGHTING); /*if the lighting is not disabled, the colour won't appear for the numbers*/
+
+	if (context->dim == 2)
+		glRasterPos2f( (float)coord[0] + 0.025, (float)coord[1] );		
+	else   
+		glRasterPos3f( (float)coord[0] + 0.025, (float)coord[1], (float)coord[2] );
+
+	lucPrintString( particle_number );
+
+	Memory_Free(particle_number);
+           
+	/* Put back settings */
+	glEnable(GL_LIGHTING);
+
+}
+
+void lucSwarmViewerBase_FindParticleLocalIndex(void *drawingObject, Coord coord, Particle_Index *lParticle_I){
+	lucSwarmViewerBase*      self  = (lucSwarmViewerBase*) drawingObject;
+	Swarm*               swarm = self->swarm;
+	Dimension_Index      dim = self->swarm->dim;
+	Particle_InCellIndex cParticle_I;
+	Cell_LocalIndex      lCell_I;
+	GlobalParticle       testParticle;
+	double               minDistance;
+	
+	/* Find cell this coordinate is in */
+	memcpy( testParticle.coord, coord, sizeof(Coord) );
+	/* First specify the particle doesn't have an owning cell yet, so as
+	   not to confuse the search algorithm */
+	testParticle.owningCell = swarm->cellDomainCount;
+	lCell_I = CellLayout_CellOf( swarm->cellLayout, &testParticle );
+
+	/* Test if this cell is on this processor - if not then bail */
+	if (lCell_I >= swarm->cellLocalCount){
+		*lParticle_I = (Particle_Index) -1;
+		return;
+	}
+
+	/* Find Closest Particle in this Cell */
+	cParticle_I = Swarm_FindClosestParticleInCell( swarm, lCell_I, dim, coord, &minDistance );
+
+	/* Convert to Local Particle Index */
+	*lParticle_I = swarm->cellParticleTbl[ lCell_I ][ cParticle_I ];
+}
+
+
+
+void lucSwarmViewerBase_UpdateVariables( void* drawingObject ) {
+	lucSwarmViewerBase*          self                = (lucSwarmViewerBase*)drawingObject;
+
+	if ( self->opacityVariable && self->opacityVariable->variable ) {
+		Variable_Update( self->opacityVariable->variable );
+	}
+	if ( self->maskVariable && self->maskVariable->variable ) {
+		Variable_Update( self->maskVariable->variable );
+	}
+}
+
+/* Default Swarm Viewer Implementation */
+void _lucSwarmViewerBase_SetParticleColourDefault( void* drawingObject, void* context, Particle_Index lParticle_I ) {
+	lucSwarmViewer*          self                = (lucSwarmViewer*) drawingObject;
+	SwarmVariable*           colourVariable      = self->colourVariable;
+	SwarmVariable*           opacityVariable     = self->opacityVariable;
+	lucColourMap*            colourMap           = self->colourMap;
+	double                   colourValue;
+	double                   opacity;
+	lucColour                colour;
+
+ 	/* Get colour value if there is a colourVariable and a colourMap */
+	if ( colourVariable && colourMap ) {
+		SwarmVariable_ValueAt( colourVariable, lParticle_I, &colourValue );
+		lucColourMap_GetColourFromValue( colourMap, colourValue, &colour );
+	}
+	else {
+		/* Set the default Colour */
+		memcpy( &colour, &self->colour, sizeof(lucColour) );
+	}
+	
+	/* Get Opacity Value */
+	if ( opacityVariable ){   /* This should have a greymap - similar to the colourmap but only one channel */
+		SwarmVariable_ValueAt( opacityVariable, lParticle_I, &opacity );
+		colour.opacity = (float)opacity;	
+	}
+
+	lucColour_SetOpenGLColour( &colour );
+}
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/TextureMap.c
--- a/DrawingObjects/src/TextureMap.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,300 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: TextureMap.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "TextureMap.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifdef HAVE_TIFF
-#include <tiffio.h>
-#endif
-
-#ifdef HAVE_LIBJPEG
-#include <jpeglib.h>
-#endif
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucTextureMap_Type = "lucTextureMap";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucTextureMap* _lucTextureMap_New(  LUCTEXTUREMAP_DEFARGS  ) 
-{
-	lucTextureMap*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucTextureMap) );
-	self = (lucTextureMap*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-				
-	return self;
-}
-
-Bool IsPowerOfTwo (int value)
-{
-  return (value & -value) == value;
-}
-
-
-void _lucTextureMap_Init( 
-	lucTextureMap*                                               self,
-	Bool                                                         iAmMaster,
-	Name                                                         imageName,
-	double                                                       bottomLeftX,
-	double                                                       bottomLeftY,
-	double                                                       bottomLeftZ,
-	double                                                       bottomRightX,
-	double                                                       bottomRightY,
-	double                                                       bottomRightZ,
-	double                                                       topRightX,
-	double                                                       topRightY,
-	double                                                       topRightZ,
-	double                                                       topLeftX,
-	double                                                       topLeftY,
-	double                                                       topLeftZ )
-{
-
- 	self->iAmMaster = iAmMaster;
-
-//	if ( ! iAmMaster )
-//		return;
-	self->bottomLeftCoord[ I_AXIS ] = bottomLeftX;
-	self->bottomLeftCoord[ J_AXIS ] = bottomLeftY;
-	self->bottomLeftCoord[ K_AXIS ] = bottomLeftZ;
-	
-	self->bottomRightCoord[ I_AXIS ] = bottomRightX;
-	self->bottomRightCoord[ J_AXIS ] = bottomRightY;
-	self->bottomRightCoord[ K_AXIS ] = bottomRightZ;
-	
-	self->topRightCoord[ I_AXIS ] = topRightX;
-	self->topRightCoord[ J_AXIS ] = topRightY;
-	self->topRightCoord[ K_AXIS ] = topRightZ;
-	
-	self->topLeftCoord[ I_AXIS ] = topLeftX;
-	self->topLeftCoord[ J_AXIS ] = topLeftY;
-	self->topLeftCoord[ K_AXIS ] = topLeftZ;
-
-	/* Open and read Image */	
-	self->inputFormat = lucInputFormat_Register_CreateFromFileName( lucInputFormat_Register_Singleton, imageName );		
-	self->pixelData = lucInputFormat_Input( self->inputFormat, imageName, &self->imageWidth, &self->imageHeight );
-	
-	Journal_Firewall( IsPowerOfTwo (self->imageWidth) && IsPowerOfTwo (self->imageHeight),
-			Journal_MyStream( Error_Type, self ), 
-			"In func '%s for %s '%s'\n"
-			"Image dimensions (%u x %u) are not in powers of 2 - Cannot create OpenGL texture map.\n", 
-			__func__, self->type, self->name, self->imageWidth, self->imageHeight );
-}
-
-void _lucTextureMap_Delete( void* drawingObject ) {
-	lucTextureMap*  self = (lucTextureMap*)drawingObject;
-
-	if ( self->iAmMaster ) 
-		Memory_Free( self->pixelData );
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucTextureMap_Print( void* drawingObject, Stream* stream ) {
-	lucTextureMap*  self = (lucTextureMap*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-	
-	Journal_PrintValue( stream, self->iAmMaster );
-
-	Journal_PrintPointer( stream, self->pixelData );
-
-	Journal_PrintValue( stream, self->imageWidth );
-	Journal_PrintValue( stream, self->imageHeight );
-	
-	Journal_PrintArray( stream, self->bottomLeftCoord,  3 );
-	Journal_PrintArray( stream, self->bottomRightCoord, 3 );
-	Journal_PrintArray( stream, self->topRightCoord,    3 );
-	Journal_PrintArray( stream, self->topLeftCoord,     3 );
-}
-
-void* _lucTextureMap_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucTextureMap*  self = (lucTextureMap*)drawingObject;
-	lucTextureMap* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	//self->pixelData = _lucInputFormat_Copy(self, ...);
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucTextureMap_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucTextureMap);
-	Type                                                             type = lucTextureMap_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucTextureMap_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucTextureMap_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucTextureMap_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucTextureMap_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucTextureMap_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucTextureMap_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucTextureMap_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucTextureMap_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucTextureMap_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucTextureMap_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucTextureMap_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucTextureMap_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucTextureMap_New(  LUCTEXTUREMAP_PASSARGS  );
-		
-		
-}
-
-void _lucTextureMap_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucTextureMap*  self = (lucTextureMap*)drawingObject;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	_lucTextureMap_Init( 
-			self, 
-			Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"rank", (unsigned)-1  ) == MASTER,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"image", ""  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomLeftX", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomLeftY", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomLeftZ", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomRightX", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomRightY", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomRightZ", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topRightX", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topRightY", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topRightZ", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topLeftX", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topLeftY", 0.0  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topLeftZ", 0.0 )  );
-}
-
-void _lucTextureMap_Build( void* drawingObject, void* data ) {}
-void _lucTextureMap_Initialise( void* drawingObject, void* data ) {}
-void _lucTextureMap_Execute( void* drawingObject, void* data ) {}
-void _lucTextureMap_Destroy( void* drawingObject, void* data ) {}
-
-
-void _lucTextureMap_Setup( void* drawingObject, void* _context ) {
-	lucTextureMap*       self            = (lucTextureMap*)drawingObject;
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-	
-void _lucTextureMap_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucTextureMap*       self            = (lucTextureMap*)drawingObject;
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucTextureMap_CleanUp( void* drawingObject, void* _context ) {
-	lucTextureMap*       self            = (lucTextureMap*)drawingObject;
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}
-	
-void _lucTextureMap_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucTextureMap*          self          = (lucTextureMap*)   drawingObject;
-
-	//if ( !self->iAmMaster )
-		//return;
-			
-	/* Setup stuff to draw */
-	
-	/* VERY Important, otherwise blending happens between pixels already stored in buffer and the texture Map does not appear !! */
-	glDisable(GL_BLEND);
-		
-	glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
-	
-	glTexImage2D( GL_TEXTURE_2D, 0, 3, self->imageWidth, self->imageHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, self->pixelData );
-	
-	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
-	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
-	
-	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
-	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
-	
-	glEnable( GL_TEXTURE_2D );
-	glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
-
-	glShadeModel( GL_FLAT );
-
-	/* Draw Texture Map */
-	glBegin( GL_QUADS );
-		glTexCoord2f( 0.0, 0.0 ); glVertex3dv( self->bottomLeftCoord );
-		glTexCoord2f( 0.0, 1.0 ); glVertex3dv( self->topLeftCoord );
-		glTexCoord2f( 1.0, 1.0 ); glVertex3dv( self->topRightCoord );
-		glTexCoord2f( 1.0, 0.0 ); glVertex3dv( self->bottomRightCoord );
-	glEnd();
-	glFlush();
-
-	glDisable(GL_TEXTURE_2D);
-}
-
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/TextureMap.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/TextureMap.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,300 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: TextureMap.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "TextureMap.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifdef HAVE_TIFF
+#include <tiffio.h>
+#endif
+
+#ifdef HAVE_LIBJPEG
+#include <jpeglib.h>
+#endif
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucTextureMap_Type = "lucTextureMap";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucTextureMap* _lucTextureMap_New(  LUCTEXTUREMAP_DEFARGS  ) 
+{
+	lucTextureMap*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucTextureMap) );
+	self = (lucTextureMap*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+				
+	return self;
+}
+
+Bool IsPowerOfTwo (int value)
+{
+  return (value & -value) == value;
+}
+
+
+void _lucTextureMap_Init( 
+	lucTextureMap*                                               self,
+	Bool                                                         iAmMaster,
+	Name                                                         imageName,
+	double                                                       bottomLeftX,
+	double                                                       bottomLeftY,
+	double                                                       bottomLeftZ,
+	double                                                       bottomRightX,
+	double                                                       bottomRightY,
+	double                                                       bottomRightZ,
+	double                                                       topRightX,
+	double                                                       topRightY,
+	double                                                       topRightZ,
+	double                                                       topLeftX,
+	double                                                       topLeftY,
+	double                                                       topLeftZ )
+{
+
+ 	self->iAmMaster = iAmMaster;
+
+//	if ( ! iAmMaster )
+//		return;
+	self->bottomLeftCoord[ I_AXIS ] = bottomLeftX;
+	self->bottomLeftCoord[ J_AXIS ] = bottomLeftY;
+	self->bottomLeftCoord[ K_AXIS ] = bottomLeftZ;
+	
+	self->bottomRightCoord[ I_AXIS ] = bottomRightX;
+	self->bottomRightCoord[ J_AXIS ] = bottomRightY;
+	self->bottomRightCoord[ K_AXIS ] = bottomRightZ;
+	
+	self->topRightCoord[ I_AXIS ] = topRightX;
+	self->topRightCoord[ J_AXIS ] = topRightY;
+	self->topRightCoord[ K_AXIS ] = topRightZ;
+	
+	self->topLeftCoord[ I_AXIS ] = topLeftX;
+	self->topLeftCoord[ J_AXIS ] = topLeftY;
+	self->topLeftCoord[ K_AXIS ] = topLeftZ;
+
+	/* Open and read Image */	
+	self->inputFormat = lucInputFormat_Register_CreateFromFileName( lucInputFormat_Register_Singleton, imageName );		
+	self->pixelData = lucInputFormat_Input( self->inputFormat, imageName, &self->imageWidth, &self->imageHeight );
+	
+	Journal_Firewall( IsPowerOfTwo (self->imageWidth) && IsPowerOfTwo (self->imageHeight),
+			Journal_MyStream( Error_Type, self ), 
+			"In func '%s for %s '%s'\n"
+			"Image dimensions (%u x %u) are not in powers of 2 - Cannot create OpenGL texture map.\n", 
+			__func__, self->type, self->name, self->imageWidth, self->imageHeight );
+}
+
+void _lucTextureMap_Delete( void* drawingObject ) {
+	lucTextureMap*  self = (lucTextureMap*)drawingObject;
+
+	if ( self->iAmMaster ) 
+		Memory_Free( self->pixelData );
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucTextureMap_Print( void* drawingObject, Stream* stream ) {
+	lucTextureMap*  self = (lucTextureMap*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+	
+	Journal_PrintValue( stream, self->iAmMaster );
+
+	Journal_PrintPointer( stream, self->pixelData );
+
+	Journal_PrintValue( stream, self->imageWidth );
+	Journal_PrintValue( stream, self->imageHeight );
+	
+	Journal_PrintArray( stream, self->bottomLeftCoord,  3 );
+	Journal_PrintArray( stream, self->bottomRightCoord, 3 );
+	Journal_PrintArray( stream, self->topRightCoord,    3 );
+	Journal_PrintArray( stream, self->topLeftCoord,     3 );
+}
+
+void* _lucTextureMap_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucTextureMap*  self = (lucTextureMap*)drawingObject;
+	lucTextureMap* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+	
+	//self->pixelData = _lucInputFormat_Copy(self, ...);
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucTextureMap_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucTextureMap);
+	Type                                                             type = lucTextureMap_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucTextureMap_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucTextureMap_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucTextureMap_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucTextureMap_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucTextureMap_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucTextureMap_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucTextureMap_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucTextureMap_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucTextureMap_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucTextureMap_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucTextureMap_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucTextureMap_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucTextureMap_New(  LUCTEXTUREMAP_PASSARGS  );
+		
+		
+}
+
+void _lucTextureMap_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucTextureMap*  self = (lucTextureMap*)drawingObject;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	_lucTextureMap_Init( 
+			self, 
+			Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"rank", (unsigned)-1  ) == MASTER,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"image", ""  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomLeftX", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomLeftY", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomLeftZ", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomRightX", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomRightY", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"bottomRightZ", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topRightX", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topRightY", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topRightZ", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topLeftX", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topLeftY", 0.0  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"topLeftZ", 0.0 )  );
+}
+
+void _lucTextureMap_Build( void* drawingObject, void* data ) {}
+void _lucTextureMap_Initialise( void* drawingObject, void* data ) {}
+void _lucTextureMap_Execute( void* drawingObject, void* data ) {}
+void _lucTextureMap_Destroy( void* drawingObject, void* data ) {}
+
+
+void _lucTextureMap_Setup( void* drawingObject, void* _context ) {
+	lucTextureMap*       self            = (lucTextureMap*)drawingObject;
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+	
+void _lucTextureMap_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucTextureMap*       self            = (lucTextureMap*)drawingObject;
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucTextureMap_CleanUp( void* drawingObject, void* _context ) {
+	lucTextureMap*       self            = (lucTextureMap*)drawingObject;
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+	
+void _lucTextureMap_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucTextureMap*          self          = (lucTextureMap*)   drawingObject;
+
+	//if ( !self->iAmMaster )
+		//return;
+			
+	/* Setup stuff to draw */
+	
+	/* VERY Important, otherwise blending happens between pixels already stored in buffer and the texture Map does not appear !! */
+	glDisable(GL_BLEND);
+		
+	glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
+	
+	glTexImage2D( GL_TEXTURE_2D, 0, 3, self->imageWidth, self->imageHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, self->pixelData );
+	
+	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
+	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
+	
+	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
+	glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
+	
+	glEnable( GL_TEXTURE_2D );
+	glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL );
+
+	glShadeModel( GL_FLAT );
+
+	/* Draw Texture Map */
+	glBegin( GL_QUADS );
+		glTexCoord2f( 0.0, 0.0 ); glVertex3dv( self->bottomLeftCoord );
+		glTexCoord2f( 0.0, 1.0 ); glVertex3dv( self->topLeftCoord );
+		glTexCoord2f( 1.0, 1.0 ); glVertex3dv( self->topRightCoord );
+		glTexCoord2f( 1.0, 0.0 ); glVertex3dv( self->bottomRightCoord );
+	glEnd();
+	glFlush();
+
+	glDisable(GL_TEXTURE_2D);
+}
+
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/TimeStep.c
--- a/DrawingObjects/src/TimeStep.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,280 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: TimeStep.c 510 2006-02-17 04:33:32Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#ifdef HAVE_GL2PS
-	#include <gl2ps.h>
-#endif
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "TimeStep.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-
-
-const Type lucTimeStep_Type = "lucTimeStep";
-
-lucTimeStep* lucTimeStep_New( 
-		Name                                               name,
-		lucColour                                          colour,
-		Bool                                               frame,
-		Bool                                               time)
-{
-	lucTimeStep* self = (lucTimeStep*) _lucTimeStep_DefaultNew( name );
-
-	lucTimeStep_InitAll( self, colour, frame, time);
-
-	return self;
-}
-
-lucTimeStep* _lucTimeStep_New(  LUCTIMESTEP_DEFARGS  )
-{
-	lucTimeStep*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucTimeStep) );
-	self = (lucTimeStep*)  _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	
-	return self;
-}
-
-void lucTimeStep_Init(		
-		lucTimeStep*                                         self,
-		lucColour                                         colour,
-		Bool                                              frame,
-		Bool                                              time)
-{
-	memcpy( &(self->colour), &colour, sizeof(lucColour) );	
-	self->frame = frame;
-	self->time = time;
-}
-
-void lucTimeStep_InitAll( 
-		void*                                              timeStep,
-		lucColour                                          colour,
-		Bool                                               frame,
-		Bool                                               time )
-{
-	lucTimeStep* self        = timeStep;
-
-	/* TODO Init parent */
-	lucTimeStep_Init( self, colour, frame, time );
-}
-
-void _lucTimeStep_Delete( void* drawingObject ) {
-	lucTimeStep*  self = (lucTimeStep*)drawingObject;
-
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucTimeStep_Print( void* drawingObject, Stream* stream ) {
-	lucTimeStep*  self = (lucTimeStep*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucTimeStep_Copy( void* timeStep, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucTimeStep* self        = timeStep;
-	lucTimeStep* newTimeStep;
-
-	newTimeStep = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	memcpy( &(newTimeStep->colour),       &(self->colour),       sizeof(lucColour) );
-	newTimeStep->frame = self->frame;
-	newTimeStep->time = self->time;
-	
-	return (void*) newTimeStep;
-}
-
-void* _lucTimeStep_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof( lucTimeStep );
-	Type                                                             type = lucTimeStep_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucTimeStep_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucTimeStep_Print;
-	Stg_Class_CopyFunction*                                         _copy = _lucTimeStep_Copy;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucTimeStep_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucTimeStep_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucTimeStep_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucTimeStep_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucTimeStep_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucTimeStep_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucTimeStep_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucTimeStep_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucTimeStep_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucTimeStep_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucTimeStep_New(  LUCTIMESTEP_PASSARGS  );
-}
-
-void _lucTimeStep_AssignFromXML( void* timeStep, Stg_ComponentFactory* cf, void* data ) {
-	lucTimeStep*             self               = (lucTimeStep*) timeStep;
-        Name colourName;
-	Bool frame;
-	Bool currentTime;
-	
-	colourName  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "Black" ) ;
-	frame  = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"frame", True ) ;
-	currentTime = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"time", False ) ;
-
-	lucColour_FromString( &self->colour, colourName );
-	
-	lucTimeStep_InitAll( self,
-		        self->colour, frame, currentTime);
-			
-}
-
-void _lucTimeStep_Build( void* TimeStep, void* data ) { }
-void _lucTimeStep_Initialise( void* TimeStep, void* data ) { }
-void _lucTimeStep_Execute( void* TimeStep, void* data ) { }
-void _lucTimeStep_Destroy( void* TimeStep, void* data ) { }
-
-void _lucTimeStep_Setup( void* drawingObject, void* _context ) {
-	lucTimeStep*       self            = (lucTimeStep*)drawingObject;
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-void _lucTimeStep_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucTimeStep*      self            = (lucTimeStep*)drawingObject;
-       	AbstractContext*    context = (AbstractContext*)_context;
-	
-	int stringWidth = 0;
-	int time = context->timeStep;
-	double currentTime = context->currentTime;
-	/* Allocating Memory */
-
-
-  /* Luke's weird stuff - as per revision 74
-	char* displayString = Memory_Alloc_Array( char, 100, "displayString");
-	char* timeStepString = Memory_Alloc_Array( char, 10, "timeStepString");
- 	char* currentTimeString = Memory_Alloc_Array( char, 20, "currentTimeString");
-  sprintf( displayString, "Shortened distance (cm): %e", currentTime * 6.9444444444444e-4 );
-  */
-	
-  char* displayString = Memory_Alloc_Array( char, 40, "displayString");
-	char* timeStepString = Memory_Alloc_Array( char, 10, "timeStepString");
- 	char* currentTimeString = Memory_Alloc_Array( char, 20, "currentTimeString");
-
-	sprintf(timeStepString, "%d", time );	
-	sprintf(currentTimeString, "%e", currentTime );
-	
-	if(self->frame){
-		sprintf(displayString, "%s", "Frame ");
-		strcat(displayString, timeStepString);
-	    	if(self->time){
-			strcat(displayString, "   Time ");
-			strcat(displayString, currentTimeString);
-		}
-		strcat(displayString, "\0");
-	}
-	else{	
-		sprintf(displayString, "%s", "Time ");
-		strcat(displayString, currentTimeString);
-		strcat(displayString, "\0");
-	}
-
-	
-	/* Set up 2D Viewer the size of the viewport */
-	lucViewport2d(True, viewportInfo);
-
-	/* Set the colour so that it'll show up against the background */
-	lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
-
-	/* Print TimeStep */	       
-        glColor4f(
-		self->colour.red,
-		self->colour.green,
-		self->colour.blue,
-		self->colour.opacity );
-
-	stringWidth = lucStringWidth(displayString );
-	lucMoveRaster( - stringWidth/2, -20 );
-	lucPrintString(displayString);
-
-	/* Free the memory */
-	Memory_Free(timeStepString) ;
-	Memory_Free(currentTimeString);
-	Memory_Free(displayString);
-
-	/* Restore the viewport */
-	lucViewport2d(False, viewportInfo);
-
-}
-
-void _lucTimeStep_CleanUp( void* drawingObject, void* _context ) {
-	lucTimeStep*      self            = (lucTimeStep*)drawingObject;
-	
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-
-}
-
-void _lucTimeStep_BuildDisplayList( void* drawingObject, void* _context ) {
-	}
-
-
-
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/TimeStep.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/TimeStep.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,280 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: TimeStep.c 510 2006-02-17 04:33:32Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#ifdef HAVE_GL2PS
+	#include <gl2ps.h>
+#endif
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "TimeStep.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+
+
+const Type lucTimeStep_Type = "lucTimeStep";
+
+lucTimeStep* lucTimeStep_New( 
+		Name                                               name,
+		lucColour                                          colour,
+		Bool                                               frame,
+		Bool                                               time)
+{
+	lucTimeStep* self = (lucTimeStep*) _lucTimeStep_DefaultNew( name );
+
+	lucTimeStep_InitAll( self, colour, frame, time);
+
+	return self;
+}
+
+lucTimeStep* _lucTimeStep_New(  LUCTIMESTEP_DEFARGS  )
+{
+	lucTimeStep*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucTimeStep) );
+	self = (lucTimeStep*)  _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	
+	return self;
+}
+
+void lucTimeStep_Init(		
+		lucTimeStep*                                         self,
+		lucColour                                         colour,
+		Bool                                              frame,
+		Bool                                              time)
+{
+	memcpy( &(self->colour), &colour, sizeof(lucColour) );	
+	self->frame = frame;
+	self->time = time;
+}
+
+void lucTimeStep_InitAll( 
+		void*                                              timeStep,
+		lucColour                                          colour,
+		Bool                                               frame,
+		Bool                                               time )
+{
+	lucTimeStep* self        = timeStep;
+
+	/* TODO Init parent */
+	lucTimeStep_Init( self, colour, frame, time );
+}
+
+void _lucTimeStep_Delete( void* drawingObject ) {
+	lucTimeStep*  self = (lucTimeStep*)drawingObject;
+
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucTimeStep_Print( void* drawingObject, Stream* stream ) {
+	lucTimeStep*  self = (lucTimeStep*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucTimeStep_Copy( void* timeStep, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucTimeStep* self        = timeStep;
+	lucTimeStep* newTimeStep;
+
+	newTimeStep = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	memcpy( &(newTimeStep->colour),       &(self->colour),       sizeof(lucColour) );
+	newTimeStep->frame = self->frame;
+	newTimeStep->time = self->time;
+	
+	return (void*) newTimeStep;
+}
+
+void* _lucTimeStep_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof( lucTimeStep );
+	Type                                                             type = lucTimeStep_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucTimeStep_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucTimeStep_Print;
+	Stg_Class_CopyFunction*                                         _copy = _lucTimeStep_Copy;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucTimeStep_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucTimeStep_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucTimeStep_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucTimeStep_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucTimeStep_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucTimeStep_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucTimeStep_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucTimeStep_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucTimeStep_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucTimeStep_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucTimeStep_New(  LUCTIMESTEP_PASSARGS  );
+}
+
+void _lucTimeStep_AssignFromXML( void* timeStep, Stg_ComponentFactory* cf, void* data ) {
+	lucTimeStep*             self               = (lucTimeStep*) timeStep;
+        Name colourName;
+	Bool frame;
+	Bool currentTime;
+	
+	colourName  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "Black" ) ;
+	frame  = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"frame", True ) ;
+	currentTime = Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"time", False ) ;
+
+	lucColour_FromString( &self->colour, colourName );
+	
+	lucTimeStep_InitAll( self,
+		        self->colour, frame, currentTime);
+			
+}
+
+void _lucTimeStep_Build( void* TimeStep, void* data ) { }
+void _lucTimeStep_Initialise( void* TimeStep, void* data ) { }
+void _lucTimeStep_Execute( void* TimeStep, void* data ) { }
+void _lucTimeStep_Destroy( void* TimeStep, void* data ) { }
+
+void _lucTimeStep_Setup( void* drawingObject, void* _context ) {
+	lucTimeStep*       self            = (lucTimeStep*)drawingObject;
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+void _lucTimeStep_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucTimeStep*      self            = (lucTimeStep*)drawingObject;
+       	AbstractContext*    context = (AbstractContext*)_context;
+	
+	int stringWidth = 0;
+	int time = context->timeStep;
+	double currentTime = context->currentTime;
+	/* Allocating Memory */
+
+
+  /* Luke's weird stuff - as per revision 74
+	char* displayString = Memory_Alloc_Array( char, 100, "displayString");
+	char* timeStepString = Memory_Alloc_Array( char, 10, "timeStepString");
+ 	char* currentTimeString = Memory_Alloc_Array( char, 20, "currentTimeString");
+  sprintf( displayString, "Shortened distance (cm): %e", currentTime * 6.9444444444444e-4 );
+  */
+	
+  char* displayString = Memory_Alloc_Array( char, 40, "displayString");
+	char* timeStepString = Memory_Alloc_Array( char, 10, "timeStepString");
+ 	char* currentTimeString = Memory_Alloc_Array( char, 20, "currentTimeString");
+
+	sprintf(timeStepString, "%d", time );	
+	sprintf(currentTimeString, "%e", currentTime );
+	
+	if(self->frame){
+		sprintf(displayString, "%s", "Frame ");
+		strcat(displayString, timeStepString);
+	    	if(self->time){
+			strcat(displayString, "   Time ");
+			strcat(displayString, currentTimeString);
+		}
+		strcat(displayString, "\0");
+	}
+	else{	
+		sprintf(displayString, "%s", "Time ");
+		strcat(displayString, currentTimeString);
+		strcat(displayString, "\0");
+	}
+
+	
+	/* Set up 2D Viewer the size of the viewport */
+	lucViewport2d(True, viewportInfo);
+
+	/* Set the colour so that it'll show up against the background */
+	lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
+
+	/* Print TimeStep */	       
+        glColor4f(
+		self->colour.red,
+		self->colour.green,
+		self->colour.blue,
+		self->colour.opacity );
+
+	stringWidth = lucStringWidth(displayString );
+	lucMoveRaster( - stringWidth/2, -20 );
+	lucPrintString(displayString);
+
+	/* Free the memory */
+	Memory_Free(timeStepString) ;
+	Memory_Free(currentTimeString);
+	Memory_Free(displayString);
+
+	/* Restore the viewport */
+	lucViewport2d(False, viewportInfo);
+
+}
+
+void _lucTimeStep_CleanUp( void* drawingObject, void* _context ) {
+	lucTimeStep*      self            = (lucTimeStep*)drawingObject;
+	
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+
+}
+
+void _lucTimeStep_BuildDisplayList( void* drawingObject, void* _context ) {
+	}
+
+
+
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Title.c
--- a/DrawingObjects/src/Title.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Title.c 510 2006-02-17 04:33:32Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#ifdef HAVE_GL2PS
-	#include <gl2ps.h>
-#endif
-
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "Title.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-
-
-const Type lucTitle_Type = "lucTitle";
-
-lucTitle* lucTitle_New( 
-		Name                                               name,
-    		char *                                             titleString,
-		lucColour                                          colour,
-		int                                                yPos )
-{
-	lucTitle* self = (lucTitle*) _lucTitle_DefaultNew( name );
-
-	lucTitle_InitAll( self, titleString, colour, yPos );
-
-	return self;
-}
-
-lucTitle* _lucTitle_New(  LUCTITLE_DEFARGS  )
-{
-	lucTitle*    self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucTitle) );
-	self = (lucTitle*)  _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	
-	return self;
-}
-
-void lucTitle_Init(		
-		lucTitle*                                          self,
-		char*                                              titleString,
-		lucColour                                          colour,
-		int                                                yPos )
-{
-	
-	self->titleString = Memory_Alloc_Array( char, (strlen(titleString) + 1), "self->titleString" );
-	strcpy( self->titleString, titleString );
-	memcpy( &(self->colour), &colour, sizeof(lucColour) );
-	self->yPos = yPos;
-}
-
-void lucTitle_InitAll( 
-		void*                                              title,
-		char*                                              titleString,
-		lucColour                                          colour,
-		int                                                yPos )
-{
-	lucTitle* self        = title;
-
-	/* TODO Init parent */
-	lucTitle_Init( self, titleString, colour, yPos );
-}
-
-void _lucTitle_Delete( void* drawingObject ) {
-	lucTitle*  self = (lucTitle*)drawingObject;
-
-	Memory_Free( self->titleString );
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucTitle_Print( void* drawingObject, Stream* stream ) {
-	lucTitle*  self = (lucTitle*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucTitle_Copy( void* title, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	lucTitle* self        = title;
-	lucTitle* newTitle;
-
-	newTitle = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
-
-	newTitle->titleString = StG_Strdup( self->titleString );
-	memcpy( &(newTitle->colour),       &(self->colour),       sizeof(lucColour) );
-
-	
-	return (void*) newTitle;
-}
-
-void* _lucTitle_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof( lucTitle );
-	Type                                                             type = lucTitle_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucTitle_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucTitle_Print;
-	Stg_Class_CopyFunction*                                         _copy = _lucTitle_Copy;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucTitle_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucTitle_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucTitle_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucTitle_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucTitle_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucTitle_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucTitle_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucTitle_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucTitle_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucTitle_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _lucTitle_New(  LUCTITLE_PASSARGS  );
-}
-
-void _lucTitle_AssignFromXML( void* title, Stg_ComponentFactory* cf, void* data ) {
-	lucTitle*             self               = (lucTitle*) title;
-        Name colourName;
-	
-	/* Get Stereo Type */
-         /* Construct Parent */
-	_lucDrawingObject_AssignFromXML( self, cf, data );
-
-	colourName  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "Black" ) ;
-	
-	lucColour_FromString( &self->colour, colourName );
-
-	lucTitle_InitAll( self, 
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"string", ""  ),
-		        self->colour,
-			Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"yPos", 20 )  );
-			
-}
-
-void _lucTitle_Build( void* Title, void* data ) { }
-void _lucTitle_Initialise( void* Title, void* data ) { }
-void _lucTitle_Execute( void* Title, void* data ) { }
-void _lucTitle_Destroy( void* Title, void* data ) { }
-
-void _lucTitle_Setup( void* drawingObject, void* _context ) {
-	lucTitle*       self            = (lucTitle*)drawingObject;
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-
-void _lucTitle_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucTitle*    self            = (lucTitle*)drawingObject;
-    lucViewport* viewport        = viewportInfo->viewport;
-	char*        title;
-	
-	/* Set up 2D Viewer the size of the viewport */
-	lucViewport2d(True, viewportInfo);
-
-	/* Set title */
-	title = strlen( self->titleString ) ? self->titleString : viewport->name;
-
-	/* Print white first for contrast */
-	lucColour white = {1.0f, 1.0f, 1.0f, 1.0f};
-	lucColour_SetOpenGLColour( &white );
-	lucPrint(viewportInfo->width/2 - lucStringWidth(title)/2 - 1, self->yPos - 1, title );
-
-	/* Set the colour */
-	lucColour_SetOpenGLColour( &self->colour );
-
-	/* Print Title */
-	lucPrint(viewportInfo->width/2 - lucStringWidth(title)/2, self->yPos, title );
-
-	/* Restore the viewport */
-	lucViewport2d(False, viewportInfo);
-}
-
-void _lucTitle_CleanUp( void* drawingObject, void* _context ) {
-	lucTitle*      self            = (lucTitle*)drawingObject;
-	
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-
-}
-
-void _lucTitle_BuildDisplayList( void* drawingObject, void* _context ) {
-	}
-
-
-
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/Title.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/Title.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,246 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Title.c 510 2006-02-17 04:33:32Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#ifdef HAVE_GL2PS
+	#include <gl2ps.h>
+#endif
+
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "Title.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+
+
+const Type lucTitle_Type = "lucTitle";
+
+lucTitle* lucTitle_New( 
+		Name                                               name,
+    		char *                                             titleString,
+		lucColour                                          colour,
+		int                                                yPos )
+{
+	lucTitle* self = (lucTitle*) _lucTitle_DefaultNew( name );
+
+	lucTitle_InitAll( self, titleString, colour, yPos );
+
+	return self;
+}
+
+lucTitle* _lucTitle_New(  LUCTITLE_DEFARGS  )
+{
+	lucTitle*    self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucTitle) );
+	self = (lucTitle*)  _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	
+	return self;
+}
+
+void lucTitle_Init(		
+		lucTitle*                                          self,
+		char*                                              titleString,
+		lucColour                                          colour,
+		int                                                yPos )
+{
+	
+	self->titleString = Memory_Alloc_Array( char, (strlen(titleString) + 1), "self->titleString" );
+	strcpy( self->titleString, titleString );
+	memcpy( &(self->colour), &colour, sizeof(lucColour) );
+	self->yPos = yPos;
+}
+
+void lucTitle_InitAll( 
+		void*                                              title,
+		char*                                              titleString,
+		lucColour                                          colour,
+		int                                                yPos )
+{
+	lucTitle* self        = title;
+
+	/* TODO Init parent */
+	lucTitle_Init( self, titleString, colour, yPos );
+}
+
+void _lucTitle_Delete( void* drawingObject ) {
+	lucTitle*  self = (lucTitle*)drawingObject;
+
+	Memory_Free( self->titleString );
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucTitle_Print( void* drawingObject, Stream* stream ) {
+	lucTitle*  self = (lucTitle*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucTitle_Copy( void* title, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
+	lucTitle* self        = title;
+	lucTitle* newTitle;
+
+	newTitle = _Stg_Component_Copy( self, dest, deep, nameExt, ptrMap );
+
+	newTitle->titleString = StG_Strdup( self->titleString );
+	memcpy( &(newTitle->colour),       &(self->colour),       sizeof(lucColour) );
+
+	
+	return (void*) newTitle;
+}
+
+void* _lucTitle_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof( lucTitle );
+	Type                                                             type = lucTitle_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucTitle_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucTitle_Print;
+	Stg_Class_CopyFunction*                                         _copy = _lucTitle_Copy;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucTitle_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucTitle_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucTitle_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucTitle_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucTitle_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucTitle_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucTitle_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucTitle_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucTitle_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucTitle_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _lucTitle_New(  LUCTITLE_PASSARGS  );
+}
+
+void _lucTitle_AssignFromXML( void* title, Stg_ComponentFactory* cf, void* data ) {
+	lucTitle*             self               = (lucTitle*) title;
+        Name colourName;
+	
+	/* Get Stereo Type */
+         /* Construct Parent */
+	_lucDrawingObject_AssignFromXML( self, cf, data );
+
+	colourName  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "Black" ) ;
+	
+	lucColour_FromString( &self->colour, colourName );
+
+	lucTitle_InitAll( self, 
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"string", ""  ),
+		        self->colour,
+			Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"yPos", 20 )  );
+			
+}
+
+void _lucTitle_Build( void* Title, void* data ) { }
+void _lucTitle_Initialise( void* Title, void* data ) { }
+void _lucTitle_Execute( void* Title, void* data ) { }
+void _lucTitle_Destroy( void* Title, void* data ) { }
+
+void _lucTitle_Setup( void* drawingObject, void* _context ) {
+	lucTitle*       self            = (lucTitle*)drawingObject;
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+
+void _lucTitle_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucTitle*    self            = (lucTitle*)drawingObject;
+    lucViewport* viewport        = viewportInfo->viewport;
+	char*        title;
+	
+	/* Set up 2D Viewer the size of the viewport */
+	lucViewport2d(True, viewportInfo);
+
+	/* Set title */
+	title = strlen( self->titleString ) ? self->titleString : viewport->name;
+
+	/* Print white first for contrast */
+	lucColour white = {1.0f, 1.0f, 1.0f, 1.0f};
+	lucColour_SetOpenGLColour( &white );
+	lucPrint(viewportInfo->width/2 - lucStringWidth(title)/2 - 1, self->yPos - 1, title );
+
+	/* Set the colour */
+	lucColour_SetOpenGLColour( &self->colour );
+
+	/* Print Title */
+	lucPrint(viewportInfo->width/2 - lucStringWidth(title)/2, self->yPos, title );
+
+	/* Restore the viewport */
+	lucViewport2d(False, viewportInfo);
+}
+
+void _lucTitle_CleanUp( void* drawingObject, void* _context ) {
+	lucTitle*      self            = (lucTitle*)drawingObject;
+	
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+
+}
+
+void _lucTitle_BuildDisplayList( void* drawingObject, void* _context ) {
+	}
+
+
+
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/VectorArrowCrossSection.c
--- a/DrawingObjects/src/VectorArrowCrossSection.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: VectorArrowCrossSection.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include <glucifer/Base/CrossSection.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "VectorArrowCrossSection.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucVectorArrowCrossSection_Type = "lucVectorArrowCrossSection";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucVectorArrowCrossSection* _lucVectorArrowCrossSection_New(  LUCVECTORARROWCROSSSECTION_DEFARGS  ) 
-{
-	lucVectorArrowCrossSection*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucVectorArrowCrossSection) );
-	self = (lucVectorArrowCrossSection*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucVectorArrowCrossSection_Init( 
-		lucVectorArrowCrossSection*                                  self,
-		FieldVariable*                                               vectorVariable,
-		Name                                                         colourName,
-		IJK                                                          resolution,
-		double                                                       arrowHeadSize,
-		double                                                       maximum,
-		Bool                                                         dynamicRange,
-		double                                                       lengthScale,
-		float                                                        lineWidth,
-		lucCrossSection*                                             crossSection)
-{
-	Stream* errorStream   = Journal_MyStream( Error_Type, self );
-
-	self->vectorVariable = vectorVariable;
-	lucColour_FromString( &self->colour, colourName );
-	memcpy( self->resolution, resolution, sizeof(IJK) );
-	self->arrowHeadSize = arrowHeadSize;
-	Journal_Firewall( ( arrowHeadSize <= 1 && arrowHeadSize >= 0 ), errorStream,
-			"Error in %s:\narrowHeadSize given for %s was not in the range [0, 1]. " 
-			"Please use an arrowHeadSize within this range\n", __func__, self->name );
-	self->maximum = maximum;
-	self->dynamicRange = dynamicRange;
-	self->lengthScale = lengthScale;
-	self->lineWidth = lineWidth;
-	self->crossSection = crossSection;
-}
-
-void _lucVectorArrowCrossSection_Delete( void* drawingObject ) {
-	lucVectorArrowCrossSection*  self = (lucVectorArrowCrossSection*)drawingObject;
-   lucCrossSection_Delete(self->crossSection);
-	_lucOpenGLDrawingObject_Delete( self );
-}
-
-void _lucVectorArrowCrossSection_Print( void* drawingObject, Stream* stream ) {
-	lucVectorArrowCrossSection*  self = (lucVectorArrowCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Print( self, stream );
-}
-
-void* _lucVectorArrowCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucVectorArrowCrossSection*  self = (lucVectorArrowCrossSection*)drawingObject;
-	lucVectorArrowCrossSection* newDrawingObject;
-
-	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucVectorArrowCrossSection_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucVectorArrowCrossSection);
-	Type                                                             type = lucVectorArrowCrossSection_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucVectorArrowCrossSection_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucVectorArrowCrossSection_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucVectorArrowCrossSection_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucVectorArrowCrossSection_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucVectorArrowCrossSection_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucVectorArrowCrossSection_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucVectorArrowCrossSection_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucVectorArrowCrossSection_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucVectorArrowCrossSection_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucVectorArrowCrossSection_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucVectorArrowCrossSection_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucVectorArrowCrossSection_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucVectorArrowCrossSection_New(  LUCVECTORARROWCROSSSECTION_PASSARGS  );
-}
-
-void _lucVectorArrowCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
-	FieldVariable*   vectorVariable;
-	Index            defaultResolution;
-	IJK              resolution;
-
-	/* Construct Parent */
-	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
-
-	vectorVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"VectorVariable", FieldVariable, True, data  );
-	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 8  );
-	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
-	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
-	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
-			
-	_lucVectorArrowCrossSection_Init( 
-			self, 
-			vectorVariable,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
-			resolution,
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.3  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maximum", 1.0  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"dynamicRange", True  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthScale", 0.3  ),
-			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
-			lucCrossSection_Read(cf, self->name));
-
-
-}
-
-void _lucVectorArrowCrossSection_Build( void* drawingObject, void* data ) {}
-void _lucVectorArrowCrossSection_Initialise( void* drawingObject, void* data ) {}
-void _lucVectorArrowCrossSection_Execute( void* drawingObject, void* data ) {}
-void _lucVectorArrowCrossSection_Destroy( void* drawingObject, void* data ) {}
-
-void _lucVectorArrowCrossSection_Setup( void* drawingObject, void* _context ) {
-	lucVectorArrowCrossSection*       self            = (lucVectorArrowCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Setup( self, _context );
-}
-	
-void _lucVectorArrowCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucVectorArrowCrossSection*       self            = (lucVectorArrowCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
-}
-
-
-void _lucVectorArrowCrossSection_CleanUp( void* drawingObject, void* _context ) {
-	lucVectorArrowCrossSection*       self            = (lucVectorArrowCrossSection*)drawingObject;
-
-	_lucOpenGLDrawingObject_CleanUp( self, _context );
-}
-
-void _lucVectorArrowCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucVectorArrowCrossSection*       self            = (lucVectorArrowCrossSection*)drawingObject;
-	DomainContext*            context         = (DomainContext*) _context;
-
-	_lucVectorArrowCrossSection_DrawCrossSection( self, context->dim, self->crossSection );
-}
-
-void _lucVectorArrowCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim, lucCrossSection* crossSection ) {
-	lucVectorArrowCrossSection*  self           = (lucVectorArrowCrossSection*)drawingObject;
-	FieldVariable*    vectorVariable = self->vectorVariable;
-   Axis              axis = crossSection->axis;
-	Axis              aAxis          = (axis == I_AXIS ? J_AXIS : I_AXIS);
-	Axis              bAxis          = (axis == K_AXIS ? J_AXIS : K_AXIS);
-	Coord             pos;
-	XYZ               vector;
-	Coord             globalMin;
-	Coord             globalMax;
-	Coord             localMin;
-	Coord             localMax;
-	double            dA, dB;
-	double            scaleValue;
-	Stream*           errorStream = Journal_Register( Error_Type, (Name)self->type  );
-	
-	Journal_DPrintf( self->debugStream, "In %s():\n", __func__ );
-	Stream_Indent( self->debugStream );
-
-	Journal_Firewall( vectorVariable->fieldComponentCount == vectorVariable->dim, errorStream,
-		"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
-		"can only visualse FieldVariables with %d components.\n", __func__, vectorVariable->name,
-		vectorVariable->fieldComponentCount, self->type, vectorVariable->dim );
-
-	lucOpenGLDrawingObject_SyncShadowValues( self, vectorVariable );
-
-	if ( True == self->dynamicRange ) {
-		scaleValue = 1 / FieldVariable_GetMaxGlobalFieldMagnitude( vectorVariable );
-		Journal_DPrintf( self->debugStream, "Dynamic range enabled -> scale value set to "
-			"1 / field maximum %g\n", scaleValue );
-	}
-	else {
-		scaleValue = 1 / self->maximum; 
-		Journal_DPrintf( self->debugStream, "Dynamic range disabled -> scale value set to "
-			"1 / maximum from XML of %g\n", scaleValue );
-	}
-
-	scaleValue = scaleValue * self->lengthScale;
-
-	Journal_DPrintf( self->debugStream, "Specified lengthScale for arrows is %.2f -> "
-		"final scale value is %g\n", self->lengthScale, scaleValue );
-	
-	lucColour_SetOpenGLColour( &self->colour );
-
-	FieldVariable_GetMinAndMaxGlobalCoords( vectorVariable, globalMin, globalMax );
-	FieldVariable_GetMinAndMaxLocalCoords( vectorVariable, localMin, localMax );
-
-	glLineWidth(self->lineWidth);
-	
-	dA = (globalMax[ aAxis ] - globalMin[ aAxis ])/(double)self->resolution[ aAxis ];
-	dB = (globalMax[ bAxis ] - globalMin[ bAxis ])/(double)self->resolution[ bAxis ];
-	
-	pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
-	Journal_DPrintf( self->debugStream, "-- Drawing cross section on axis %d at value %lf\n", axis, pos[axis]);
-
-	for ( pos[ aAxis ] = globalMin[ aAxis ] + dA * 0.5 ; pos[ aAxis ] < globalMax[ aAxis ] ; pos[ aAxis ] += dA ) {
-		for ( pos[ bAxis ] = globalMin[ bAxis ] + dB * 0.5 ; pos[ bAxis ] < globalMax[ bAxis ] ; pos[ bAxis ] += dB ) {
-
-			if ( pos[ aAxis ] < localMin[ aAxis ] || pos[ aAxis ] >= localMax[ aAxis ] )
-				continue;
-			if ( pos[ bAxis ] < localMin[ bAxis ] || pos[ bAxis ] >= localMax[ bAxis ] )
-				continue;
-
-			/* Get Value of Vector */
-			if ( FieldVariable_InterpolateValueAt( vectorVariable, pos, vector ) == LOCAL ) {
-				/* Draw vector */
-				luc_DrawVector( dim, pos, vector, scaleValue, self->arrowHeadSize );
-			}
-		}
-	}
-	Stream_UnIndent( self->debugStream );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/VectorArrowCrossSection.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/VectorArrowCrossSection.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,297 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: VectorArrowCrossSection.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include <glucifer/Base/CrossSection.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "VectorArrowCrossSection.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+#include <ctype.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucVectorArrowCrossSection_Type = "lucVectorArrowCrossSection";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucVectorArrowCrossSection* _lucVectorArrowCrossSection_New(  LUCVECTORARROWCROSSSECTION_DEFARGS  ) 
+{
+	lucVectorArrowCrossSection*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucVectorArrowCrossSection) );
+	self = (lucVectorArrowCrossSection*) _lucOpenGLDrawingObject_New(  LUCOPENGLDRAWINGOBJECT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucVectorArrowCrossSection_Init( 
+		lucVectorArrowCrossSection*                                  self,
+		FieldVariable*                                               vectorVariable,
+		Name                                                         colourName,
+		IJK                                                          resolution,
+		double                                                       arrowHeadSize,
+		double                                                       maximum,
+		Bool                                                         dynamicRange,
+		double                                                       lengthScale,
+		float                                                        lineWidth,
+		lucCrossSection*                                             crossSection)
+{
+	Stream* errorStream   = Journal_MyStream( Error_Type, self );
+
+	self->vectorVariable = vectorVariable;
+	lucColour_FromString( &self->colour, colourName );
+	memcpy( self->resolution, resolution, sizeof(IJK) );
+	self->arrowHeadSize = arrowHeadSize;
+	Journal_Firewall( ( arrowHeadSize <= 1 && arrowHeadSize >= 0 ), errorStream,
+			"Error in %s:\narrowHeadSize given for %s was not in the range [0, 1]. " 
+			"Please use an arrowHeadSize within this range\n", __func__, self->name );
+	self->maximum = maximum;
+	self->dynamicRange = dynamicRange;
+	self->lengthScale = lengthScale;
+	self->lineWidth = lineWidth;
+	self->crossSection = crossSection;
+}
+
+void _lucVectorArrowCrossSection_Delete( void* drawingObject ) {
+	lucVectorArrowCrossSection*  self = (lucVectorArrowCrossSection*)drawingObject;
+   lucCrossSection_Delete(self->crossSection);
+	_lucOpenGLDrawingObject_Delete( self );
+}
+
+void _lucVectorArrowCrossSection_Print( void* drawingObject, Stream* stream ) {
+	lucVectorArrowCrossSection*  self = (lucVectorArrowCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Print( self, stream );
+}
+
+void* _lucVectorArrowCrossSection_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucVectorArrowCrossSection*  self = (lucVectorArrowCrossSection*)drawingObject;
+	lucVectorArrowCrossSection* newDrawingObject;
+
+	newDrawingObject = _lucOpenGLDrawingObject_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucVectorArrowCrossSection_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucVectorArrowCrossSection);
+	Type                                                             type = lucVectorArrowCrossSection_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucVectorArrowCrossSection_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucVectorArrowCrossSection_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucVectorArrowCrossSection_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucVectorArrowCrossSection_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucVectorArrowCrossSection_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucVectorArrowCrossSection_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucVectorArrowCrossSection_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucVectorArrowCrossSection_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucVectorArrowCrossSection_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucVectorArrowCrossSection_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucVectorArrowCrossSection_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucVectorArrowCrossSection_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucVectorArrowCrossSection_New(  LUCVECTORARROWCROSSSECTION_PASSARGS  );
+}
+
+void _lucVectorArrowCrossSection_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucVectorArrowCrossSection* self = (lucVectorArrowCrossSection*)drawingObject;
+	FieldVariable*   vectorVariable;
+	Index            defaultResolution;
+	IJK              resolution;
+
+	/* Construct Parent */
+	_lucOpenGLDrawingObject_AssignFromXML( self, cf, data );
+
+	vectorVariable =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"VectorVariable", FieldVariable, True, data  );
+	defaultResolution = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 8  );
+	resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultResolution  );
+	resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultResolution  );
+	resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultResolution  );
+			
+	_lucVectorArrowCrossSection_Init( 
+			self, 
+			vectorVariable,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colour", "black"  ),
+			resolution,
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"arrowHeadSize", 0.3  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maximum", 1.0  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"dynamicRange", True  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lengthScale", 0.3  ),
+			(float) Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"lineWidth", 1.0  ),
+			lucCrossSection_Read(cf, self->name));
+
+
+}
+
+void _lucVectorArrowCrossSection_Build( void* drawingObject, void* data ) {}
+void _lucVectorArrowCrossSection_Initialise( void* drawingObject, void* data ) {}
+void _lucVectorArrowCrossSection_Execute( void* drawingObject, void* data ) {}
+void _lucVectorArrowCrossSection_Destroy( void* drawingObject, void* data ) {}
+
+void _lucVectorArrowCrossSection_Setup( void* drawingObject, void* _context ) {
+	lucVectorArrowCrossSection*       self            = (lucVectorArrowCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Setup( self, _context );
+}
+	
+void _lucVectorArrowCrossSection_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucVectorArrowCrossSection*       self            = (lucVectorArrowCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_Draw( self, window, viewportInfo, _context );
+}
+
+
+void _lucVectorArrowCrossSection_CleanUp( void* drawingObject, void* _context ) {
+	lucVectorArrowCrossSection*       self            = (lucVectorArrowCrossSection*)drawingObject;
+
+	_lucOpenGLDrawingObject_CleanUp( self, _context );
+}
+
+void _lucVectorArrowCrossSection_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucVectorArrowCrossSection*       self            = (lucVectorArrowCrossSection*)drawingObject;
+	DomainContext*            context         = (DomainContext*) _context;
+
+	_lucVectorArrowCrossSection_DrawCrossSection( self, context->dim, self->crossSection );
+}
+
+void _lucVectorArrowCrossSection_DrawCrossSection( void* drawingObject, Dimension_Index dim, lucCrossSection* crossSection ) {
+	lucVectorArrowCrossSection*  self           = (lucVectorArrowCrossSection*)drawingObject;
+	FieldVariable*    vectorVariable = self->vectorVariable;
+   Axis              axis = crossSection->axis;
+	Axis              aAxis          = (axis == I_AXIS ? J_AXIS : I_AXIS);
+	Axis              bAxis          = (axis == K_AXIS ? J_AXIS : K_AXIS);
+	Coord             pos;
+	XYZ               vector;
+	Coord             globalMin;
+	Coord             globalMax;
+	Coord             localMin;
+	Coord             localMax;
+	double            dA, dB;
+	double            scaleValue;
+	Stream*           errorStream = Journal_Register( Error_Type, (Name)self->type  );
+	
+	Journal_DPrintf( self->debugStream, "In %s():\n", __func__ );
+	Stream_Indent( self->debugStream );
+
+	Journal_Firewall( vectorVariable->fieldComponentCount == vectorVariable->dim, errorStream,
+		"Error - in %s(): provided FieldVariable \"%s\" has %u components - but %s Component "
+		"can only visualse FieldVariables with %d components.\n", __func__, vectorVariable->name,
+		vectorVariable->fieldComponentCount, self->type, vectorVariable->dim );
+
+	lucOpenGLDrawingObject_SyncShadowValues( self, vectorVariable );
+
+	if ( True == self->dynamicRange ) {
+		scaleValue = 1 / FieldVariable_GetMaxGlobalFieldMagnitude( vectorVariable );
+		Journal_DPrintf( self->debugStream, "Dynamic range enabled -> scale value set to "
+			"1 / field maximum %g\n", scaleValue );
+	}
+	else {
+		scaleValue = 1 / self->maximum; 
+		Journal_DPrintf( self->debugStream, "Dynamic range disabled -> scale value set to "
+			"1 / maximum from XML of %g\n", scaleValue );
+	}
+
+	scaleValue = scaleValue * self->lengthScale;
+
+	Journal_DPrintf( self->debugStream, "Specified lengthScale for arrows is %.2f -> "
+		"final scale value is %g\n", self->lengthScale, scaleValue );
+	
+	lucColour_SetOpenGLColour( &self->colour );
+
+	FieldVariable_GetMinAndMaxGlobalCoords( vectorVariable, globalMin, globalMax );
+	FieldVariable_GetMinAndMaxLocalCoords( vectorVariable, localMin, localMax );
+
+	glLineWidth(self->lineWidth);
+	
+	dA = (globalMax[ aAxis ] - globalMin[ aAxis ])/(double)self->resolution[ aAxis ];
+	dB = (globalMax[ bAxis ] - globalMin[ bAxis ])/(double)self->resolution[ bAxis ];
+	
+	pos[axis] = lucCrossSection_GetValue(crossSection, globalMin[axis], globalMax[axis]);
+	Journal_DPrintf( self->debugStream, "-- Drawing cross section on axis %d at value %lf\n", axis, pos[axis]);
+
+	for ( pos[ aAxis ] = globalMin[ aAxis ] + dA * 0.5 ; pos[ aAxis ] < globalMax[ aAxis ] ; pos[ aAxis ] += dA ) {
+		for ( pos[ bAxis ] = globalMin[ bAxis ] + dB * 0.5 ; pos[ bAxis ] < globalMax[ bAxis ] ; pos[ bAxis ] += dB ) {
+
+			if ( pos[ aAxis ] < localMin[ aAxis ] || pos[ aAxis ] >= localMax[ aAxis ] )
+				continue;
+			if ( pos[ bAxis ] < localMin[ bAxis ] || pos[ bAxis ] >= localMax[ bAxis ] )
+				continue;
+
+			/* Get Value of Vector */
+			if ( FieldVariable_InterpolateValueAt( vectorVariable, pos, vector ) == LOCAL ) {
+				/* Draw vector */
+				luc_DrawVector( dim, pos, vector, scaleValue, self->arrowHeadSize );
+			}
+		}
+	}
+	Stream_UnIndent( self->debugStream );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/VectorArrows.c
--- a/DrawingObjects/src/VectorArrows.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: VectorArrows.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/Base/CrossSection.h>
-
-#include "types.h"
-#include "OpenGLDrawingObject.h"
-#include "VectorArrowCrossSection.h"
-#include "VectorArrows.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucVectorArrows_Type = "lucVectorArrows";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucVectorArrows* _lucVectorArrows_New(  LUCVECTORARROWS_DEFARGS  ) 
-{
-	lucVectorArrows*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucVectorArrows) );
-	self = (lucVectorArrows*) _lucVectorArrowCrossSection_New(  LUCVECTORARROWCROSSSECTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucVectorArrows_Init( lucVectorArrows*                                             self ) {
-}
-
-void _lucVectorArrows_Delete( void* drawingObject ) {
-	lucVectorArrows*  self = (lucVectorArrows*)drawingObject;
-
-	_lucVectorArrowCrossSection_Delete( self );
-}
-
-void _lucVectorArrows_Print( void* drawingObject, Stream* stream ) {
-	lucVectorArrows*  self = (lucVectorArrows*)drawingObject;
-
-	_lucVectorArrowCrossSection_Print( self, stream );
-}
-
-void* _lucVectorArrows_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucVectorArrows*  self = (lucVectorArrows*)drawingObject;
-	lucVectorArrows* newDrawingObject;
-
-	newDrawingObject = _lucVectorArrowCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newDrawingObject;
-}
-
-
-void* _lucVectorArrows_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                     _sizeOfSelf = sizeof(lucVectorArrows);
-	Type                                                             type = lucVectorArrows_Type;
-	Stg_Class_DeleteFunction*                                     _delete = _lucVectorArrows_Delete;
-	Stg_Class_PrintFunction*                                       _print = _lucVectorArrows_Print;
-	Stg_Class_CopyFunction*                                         _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucVectorArrows_DefaultNew;
-	Stg_Component_ConstructFunction*                           _construct = _lucVectorArrows_AssignFromXML;
-	Stg_Component_BuildFunction*                                   _build = _lucVectorArrows_Build;
-	Stg_Component_InitialiseFunction*                         _initialise = _lucVectorArrows_Initialise;
-	Stg_Component_ExecuteFunction*                               _execute = _lucVectorArrows_Execute;
-	Stg_Component_DestroyFunction*                               _destroy = _lucVectorArrows_Destroy;
-	lucDrawingObject_SetupFunction*                                _setup = _lucVectorArrows_Setup;
-	lucDrawingObject_DrawFunction*                                  _draw = _lucVectorArrows_Draw;
-	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucVectorArrows_CleanUp;
-	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucVectorArrows_BuildDisplayList;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucVectorArrows_New(  LUCVECTORARROWS_PASSARGS  );
-}
-
-void _lucVectorArrows_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
-	lucVectorArrows* self = (lucVectorArrows*)drawingObject;
-
-	/* Construct Parent */
-	_lucVectorArrowCrossSection_AssignFromXML( self, cf, data );
-	
-	_lucVectorArrows_Init( self );
-}
-
-void _lucVectorArrows_Build( void* drawingObject, void* data ) {}
-void _lucVectorArrows_Initialise( void* drawingObject, void* data ) {}
-void _lucVectorArrows_Execute( void* drawingObject, void* data ) {}
-void _lucVectorArrows_Destroy( void* drawingObject, void* data ) {}
-
-void _lucVectorArrows_Setup( void* drawingObject, void* _context ) {
-	lucVectorArrows*       self            = (lucVectorArrows*)drawingObject;
-	
-	_lucVectorArrowCrossSection_Setup( self, _context );
-}
-
-void _lucVectorArrows_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
-	lucVectorArrows*       self            = (lucVectorArrows*)drawingObject;
-
-	_lucVectorArrowCrossSection_Draw( self, window, viewportInfo, _context );
-}
-
-void _lucVectorArrows_CleanUp( void* drawingObject, void* _context ) {
-	lucVectorArrows*       self            = (lucVectorArrows*)drawingObject;
-	
-	_lucVectorArrowCrossSection_CleanUp( self, _context );
-}
-	
-void _lucVectorArrows_BuildDisplayList( void* drawingObject, void* _context ) {
-	lucVectorArrows*       self            = (lucVectorArrows*)drawingObject;
-	DomainContext* context         = (DomainContext*) _context;
-	Dimension_Index        dim             = context->dim;
-   lucCrossSection crossSection;
-
-	if ( dim == 2 ) 
-   {
-		_lucVectorArrowCrossSection_DrawCrossSection(self, dim, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
-	}
-	else 
-   {
-		double dz = 1/(double)self->resolution[ K_AXIS ];
-      crossSection.axis = K_AXIS;
-      crossSection.interpolate = True;
-		for ( crossSection.value = 0.0 ; crossSection.value < 1.0+dz ; crossSection.value += dz) {
-		   _lucVectorArrowCrossSection_DrawCrossSection( self, dim, &crossSection);
-		}
-	}
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/src/VectorArrows.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/src/VectorArrows.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,185 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: VectorArrows.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/Base/CrossSection.h>
+
+#include "types.h"
+#include "OpenGLDrawingObject.h"
+#include "VectorArrowCrossSection.h"
+#include "VectorArrows.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucVectorArrows_Type = "lucVectorArrows";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucVectorArrows* _lucVectorArrows_New(  LUCVECTORARROWS_DEFARGS  ) 
+{
+	lucVectorArrows*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucVectorArrows) );
+	self = (lucVectorArrows*) _lucVectorArrowCrossSection_New(  LUCVECTORARROWCROSSSECTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucVectorArrows_Init( lucVectorArrows*                                             self ) {
+}
+
+void _lucVectorArrows_Delete( void* drawingObject ) {
+	lucVectorArrows*  self = (lucVectorArrows*)drawingObject;
+
+	_lucVectorArrowCrossSection_Delete( self );
+}
+
+void _lucVectorArrows_Print( void* drawingObject, Stream* stream ) {
+	lucVectorArrows*  self = (lucVectorArrows*)drawingObject;
+
+	_lucVectorArrowCrossSection_Print( self, stream );
+}
+
+void* _lucVectorArrows_Copy( void* drawingObject, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucVectorArrows*  self = (lucVectorArrows*)drawingObject;
+	lucVectorArrows* newDrawingObject;
+
+	newDrawingObject = _lucVectorArrowCrossSection_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newDrawingObject;
+}
+
+
+void* _lucVectorArrows_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                     _sizeOfSelf = sizeof(lucVectorArrows);
+	Type                                                             type = lucVectorArrows_Type;
+	Stg_Class_DeleteFunction*                                     _delete = _lucVectorArrows_Delete;
+	Stg_Class_PrintFunction*                                       _print = _lucVectorArrows_Print;
+	Stg_Class_CopyFunction*                                         _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*         _defaultConstructor = _lucVectorArrows_DefaultNew;
+	Stg_Component_ConstructFunction*                           _construct = _lucVectorArrows_AssignFromXML;
+	Stg_Component_BuildFunction*                                   _build = _lucVectorArrows_Build;
+	Stg_Component_InitialiseFunction*                         _initialise = _lucVectorArrows_Initialise;
+	Stg_Component_ExecuteFunction*                               _execute = _lucVectorArrows_Execute;
+	Stg_Component_DestroyFunction*                               _destroy = _lucVectorArrows_Destroy;
+	lucDrawingObject_SetupFunction*                                _setup = _lucVectorArrows_Setup;
+	lucDrawingObject_DrawFunction*                                  _draw = _lucVectorArrows_Draw;
+	lucDrawingObject_CleanUpFunction*                            _cleanUp = _lucVectorArrows_CleanUp;
+	lucOpenGLDrawingObject_BuildDisplayListFunction*    _buildDisplayList = _lucVectorArrows_BuildDisplayList;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucVectorArrows_New(  LUCVECTORARROWS_PASSARGS  );
+}
+
+void _lucVectorArrows_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data ){
+	lucVectorArrows* self = (lucVectorArrows*)drawingObject;
+
+	/* Construct Parent */
+	_lucVectorArrowCrossSection_AssignFromXML( self, cf, data );
+	
+	_lucVectorArrows_Init( self );
+}
+
+void _lucVectorArrows_Build( void* drawingObject, void* data ) {}
+void _lucVectorArrows_Initialise( void* drawingObject, void* data ) {}
+void _lucVectorArrows_Execute( void* drawingObject, void* data ) {}
+void _lucVectorArrows_Destroy( void* drawingObject, void* data ) {}
+
+void _lucVectorArrows_Setup( void* drawingObject, void* _context ) {
+	lucVectorArrows*       self            = (lucVectorArrows*)drawingObject;
+	
+	_lucVectorArrowCrossSection_Setup( self, _context );
+}
+
+void _lucVectorArrows_Draw( void* drawingObject, lucWindow* window, lucViewportInfo* viewportInfo, void* _context ) {
+	lucVectorArrows*       self            = (lucVectorArrows*)drawingObject;
+
+	_lucVectorArrowCrossSection_Draw( self, window, viewportInfo, _context );
+}
+
+void _lucVectorArrows_CleanUp( void* drawingObject, void* _context ) {
+	lucVectorArrows*       self            = (lucVectorArrows*)drawingObject;
+	
+	_lucVectorArrowCrossSection_CleanUp( self, _context );
+}
+	
+void _lucVectorArrows_BuildDisplayList( void* drawingObject, void* _context ) {
+	lucVectorArrows*       self            = (lucVectorArrows*)drawingObject;
+	DomainContext* context         = (DomainContext*) _context;
+	Dimension_Index        dim             = context->dim;
+   lucCrossSection crossSection;
+
+	if ( dim == 2 ) 
+   {
+		_lucVectorArrowCrossSection_DrawCrossSection(self, dim, lucCrossSection_Set(&crossSection, 0.0, K_AXIS, False));
+	}
+	else 
+   {
+		double dz = 1/(double)self->resolution[ K_AXIS ];
+      crossSection.axis = K_AXIS;
+      crossSection.interpolate = True;
+		for ( crossSection.value = 0.0 ; crossSection.value < 1.0+dz ; crossSection.value += dz) {
+		   _lucVectorArrowCrossSection_DrawCrossSection( self, dim, &crossSection);
+		}
+	}
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/tests/DummyFieldVariable/DummyFieldVariable.c
--- a/DrawingObjects/tests/DummyFieldVariable/DummyFieldVariable.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#ifdef HAVE_PYTHON
-#include <Python.h>
-#endif
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-#include <glucifer/Windowing/Windowing.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/DrawingObjects/DrawingObjects.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-const Type DummyFieldVariable_Type = "DummyFieldVariable";
-			
-InterpolationResult DummyFieldVariable_InterpolateValueAt( void* fieldVariable, Coord coord, double* value ) {
-	FieldVariable* self = (FieldVariable*) fieldVariable;
-	Dof_Index      component_I;
-	
-	for ( component_I =0; component_I  < self->fieldComponentCount ; component_I++ ){
-		value[ component_I ] = coord[0] * coord[0] + coord[1] *coord[1];
-		if ( self->dim == 3 )
-			value[ component_I ] += coord[2] *coord[2];
-	}
-
-	return 1;
-}
-
-double DummyFieldVariable_GetMinGlobalFieldMagnitude( void* fieldVariable ) {
-	return  0.0;
-}
-double DummyFieldVariable_GetMaxGlobalFieldMagnitude( void* fieldVariable ) {
-	FieldVariable* self = (FieldVariable*) fieldVariable;
-	return  12.0 * sqrt( self->fieldComponentCount );
-}
-void DummyFieldVariable_GetMinAndMaxLocalCoords( void* fieldVariable, Coord min, Coord max ) {
-	FieldVariable* self = (FieldVariable*) fieldVariable; 
-	int            rank; 
-	int            numProcessors;
-	double         dx;
-
-	MPI_Comm_size( self->communicator, &numProcessors );
-	MPI_Comm_rank( self->communicator, &rank );
-
-	dx = 2.0/(double)numProcessors;
-
-	min[0] = dx * (double) rank;
-	min[1] = 0.0;
-	min[2] = 0.0;
-	
-	max[0] = dx * (double) (rank + 1);
-	max[1] = 2.0;
-	max[2] = 2.0;
-}
-void DummyFieldVariable_GetMinAndMaxGlobalCoords( void* fieldVariable, Coord min, Coord max ) {
-	min[0] = 0.0;
-	min[1] = 0.0;
-	min[2] = 0.0;
-	
-	max[0] = 2.0;
-	max[1] = 2.0;
-	max[2] = 2.0;
-}
-
-void _DummyFieldVariable_AssignFromXML( void* fieldVariable, Stg_ComponentFactory* cf, void* data ) {
-	FieldVariable* self = (FieldVariable*) fieldVariable;
-
-	self->fieldComponentCount = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"fieldComponentCount", 1  );
-	self->dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 0 );
-	self->communicator = MPI_COMM_WORLD;
-}
-
-void* _DummyFieldVariable_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                      _sizeOfSelf = sizeof(FieldVariable);
-	Type                                                              type = DummyFieldVariable_Type;
-	Stg_Class_DeleteFunction*                                      _delete = _FieldVariable_Delete;
-	Stg_Class_PrintFunction*                                        _print = _FieldVariable_Print;
-	Stg_Class_CopyFunction*                                          _copy = _FieldVariable_Copy;
-	Stg_Component_DefaultConstructorFunction*          _defaultConstructor = _DummyFieldVariable_DefaultNew;
-	Stg_Component_ConstructFunction*                            _construct = _DummyFieldVariable_AssignFromXML;
-	Stg_Component_BuildFunction*                                    _build = _FieldVariable_Build;
-	Stg_Component_InitialiseFunction*                          _initialise = _FieldVariable_Initialise;
-	Stg_Component_ExecuteFunction*                                _execute = _FieldVariable_Execute;
-	Stg_Component_DestroyFunction*                                _destroy = _FieldVariable_Destroy;
-	AllocationType                                      nameAllocationType = False;
-	FieldVariable_InterpolateValueAtFunction*          _interpolateValueAt = DummyFieldVariable_InterpolateValueAt;
-	FieldVariable_GetValueFunction*            _getMinGlobalFieldMagnitude = DummyFieldVariable_GetMinGlobalFieldMagnitude;
-	FieldVariable_GetValueFunction*            _getMaxGlobalFieldMagnitude = DummyFieldVariable_GetMaxGlobalFieldMagnitude;
-	FieldVariable_GetCoordFunction*               _getMinAndMaxLocalCoords = DummyFieldVariable_GetMinAndMaxLocalCoords;
-	FieldVariable_GetCoordFunction*              _getMinAndMaxGlobalCoords = DummyFieldVariable_GetMinAndMaxGlobalCoords;
-
-	return _FieldVariable_New(  FIELDVARIABLE_PASSARGS  );
-}
-
-Index DummyFieldVariable_Register( PluginsManager* pluginsManager  ) {
-	RegisterParent( DummyFieldVariable_Type, FieldVariable_Type );
-	return PluginsManager_Submit( pluginsManager, DummyFieldVariable_Type, (Name)"0", _DummyFieldVariable_DefaultNew  );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/tests/DummyFieldVariable/DummyFieldVariable.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/tests/DummyFieldVariable/DummyFieldVariable.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,151 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#ifdef HAVE_PYTHON
+#include <Python.h>
+#endif
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+#include <glucifer/Windowing/Windowing.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/DrawingObjects/DrawingObjects.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+const Type DummyFieldVariable_Type = "DummyFieldVariable";
+			
+InterpolationResult DummyFieldVariable_InterpolateValueAt( void* fieldVariable, Coord coord, double* value ) {
+	FieldVariable* self = (FieldVariable*) fieldVariable;
+	Dof_Index      component_I;
+	
+	for ( component_I =0; component_I  < self->fieldComponentCount ; component_I++ ){
+		value[ component_I ] = coord[0] * coord[0] + coord[1] *coord[1];
+		if ( self->dim == 3 )
+			value[ component_I ] += coord[2] *coord[2];
+	}
+
+	return 1;
+}
+
+double DummyFieldVariable_GetMinGlobalFieldMagnitude( void* fieldVariable ) {
+	return  0.0;
+}
+double DummyFieldVariable_GetMaxGlobalFieldMagnitude( void* fieldVariable ) {
+	FieldVariable* self = (FieldVariable*) fieldVariable;
+	return  12.0 * sqrt( self->fieldComponentCount );
+}
+void DummyFieldVariable_GetMinAndMaxLocalCoords( void* fieldVariable, Coord min, Coord max ) {
+	FieldVariable* self = (FieldVariable*) fieldVariable; 
+	int            rank; 
+	int            numProcessors;
+	double         dx;
+
+	MPI_Comm_size( self->communicator, &numProcessors );
+	MPI_Comm_rank( self->communicator, &rank );
+
+	dx = 2.0/(double)numProcessors;
+
+	min[0] = dx * (double) rank;
+	min[1] = 0.0;
+	min[2] = 0.0;
+	
+	max[0] = dx * (double) (rank + 1);
+	max[1] = 2.0;
+	max[2] = 2.0;
+}
+void DummyFieldVariable_GetMinAndMaxGlobalCoords( void* fieldVariable, Coord min, Coord max ) {
+	min[0] = 0.0;
+	min[1] = 0.0;
+	min[2] = 0.0;
+	
+	max[0] = 2.0;
+	max[1] = 2.0;
+	max[2] = 2.0;
+}
+
+void _DummyFieldVariable_AssignFromXML( void* fieldVariable, Stg_ComponentFactory* cf, void* data ) {
+	FieldVariable* self = (FieldVariable*) fieldVariable;
+
+	self->fieldComponentCount = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"fieldComponentCount", 1  );
+	self->dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dim", 0 );
+	self->communicator = MPI_COMM_WORLD;
+}
+
+void* _DummyFieldVariable_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                      _sizeOfSelf = sizeof(FieldVariable);
+	Type                                                              type = DummyFieldVariable_Type;
+	Stg_Class_DeleteFunction*                                      _delete = _FieldVariable_Delete;
+	Stg_Class_PrintFunction*                                        _print = _FieldVariable_Print;
+	Stg_Class_CopyFunction*                                          _copy = _FieldVariable_Copy;
+	Stg_Component_DefaultConstructorFunction*          _defaultConstructor = _DummyFieldVariable_DefaultNew;
+	Stg_Component_ConstructFunction*                            _construct = _DummyFieldVariable_AssignFromXML;
+	Stg_Component_BuildFunction*                                    _build = _FieldVariable_Build;
+	Stg_Component_InitialiseFunction*                          _initialise = _FieldVariable_Initialise;
+	Stg_Component_ExecuteFunction*                                _execute = _FieldVariable_Execute;
+	Stg_Component_DestroyFunction*                                _destroy = _FieldVariable_Destroy;
+	AllocationType                                      nameAllocationType = False;
+	FieldVariable_InterpolateValueAtFunction*          _interpolateValueAt = DummyFieldVariable_InterpolateValueAt;
+	FieldVariable_GetValueFunction*            _getMinGlobalFieldMagnitude = DummyFieldVariable_GetMinGlobalFieldMagnitude;
+	FieldVariable_GetValueFunction*            _getMaxGlobalFieldMagnitude = DummyFieldVariable_GetMaxGlobalFieldMagnitude;
+	FieldVariable_GetCoordFunction*               _getMinAndMaxLocalCoords = DummyFieldVariable_GetMinAndMaxLocalCoords;
+	FieldVariable_GetCoordFunction*              _getMinAndMaxGlobalCoords = DummyFieldVariable_GetMinAndMaxGlobalCoords;
+
+	return _FieldVariable_New(  FIELDVARIABLE_PASSARGS  );
+}
+
+Index DummyFieldVariable_Register( PluginsManager* pluginsManager  ) {
+	RegisterParent( DummyFieldVariable_Type, FieldVariable_Type );
+	return PluginsManager_Submit( pluginsManager, DummyFieldVariable_Type, (Name)"0", _DummyFieldVariable_DefaultNew  );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/tests/DummySwarmVariable/DummySwarmVariable.c
--- a/DrawingObjects/tests/DummySwarmVariable/DummySwarmVariable.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,160 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_PYTHON
-#include <Python.h>
-#endif
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-#include <glucifer/Windowing/Windowing.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/DrawingObjects/DrawingObjects.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-const Type DummySwarmVariable_Type = "DummySwarmVariable";
-			
-void DummySwarmVariable_ValueAt( void* swarmVariable, Particle_Index lParticle_I, double* value ) {
-	SwarmVariable*    self = (SwarmVariable*) swarmVariable;
-	GlobalParticle* particle = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
-	Dof_Index dof_I =0;
-
-        /*	if the dof count is not greater than the number of dimensions, we can just use the coordinate of the particle */				
-        for ( dof_I = 0 ; dof_I < self->dofCount ; dof_I++ ){
-	    if ( self->dofCount <= self->dim ){
-                if( strcmp(self->name, "normalVariable") == 0 ){
-			value[ dof_I ] = particle->coord[ dof_I ];
-	        }
-	        else if( strcmp(self->name, "vectorVariable") == 0 ){
-	            value[ dof_I ] = 0 ;
-                    if(dof_I == 0) 
-			value[ dof_I ] = particle->coord[ dof_I ];
-                }
-	        else if( strcmp(self->name, "lengthVariable") == 0 )
-	            *value = 0.2;
-                else 
-	            value[ dof_I ] = particle->coord[ dof_I ];
-	    }    
-            else
-                    abort();  /*worry about this later */
-        }
-}
-
-double DummySwarmVariable_GetMinGlobalSwarmMagnitude( void* SwarmVariable ) {
-	return  -1.0;
-}
-double DummySwarmVariable_GetMaxGlobalSwarmMagnitude( void* SwarmVariable ) {
-	return  1.0;
-}
-
-void DummySwarmVariable_Init( SwarmVariable* self, Swarm* swarm, Variable* variable, Index dofCount ) {
-	/* Add ourselves to the register for later retrieval by clients */
-	self->isConstructed = True;
-
-	self->swarm                  = swarm;
-	self->variable               = variable;
-	self->dofCount               = dofCount;
-	self->swarmVariable_Register = swarm->swarmVariable_Register;
-	self->dim                    = swarm->dim;
-	
-	if ( swarm->swarmVariable_Register != NULL )	
-		SwarmVariable_Register_Add( swarm->swarmVariable_Register, self );
-}
-
-
-void _DummySwarmVariable_AssignFromXML( void* swarmVariable, Stg_ComponentFactory* cf, void* data ) {
-	SwarmVariable*	        self         = (SwarmVariable*)swarmVariable;
-	Swarm*                  swarm;
-	Variable*               variable;
-	Index                   dofCount;
-
-	swarm = Stg_ComponentFactory_ConstructByName( cf, (Name)"swarm", Swarm, True, data  ) ;
-	variable = Stg_ComponentFactory_ConstructByName( cf, (Name)"variable", Variable, False, data  ) ;
-
-	/* Check if this component has it's own component dictionary */
-	if ( Dictionary_GetDictionary( cf->componentDict, self->name ) ) {
-		dofCount = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"dofCount", 0  );
-	}
-	/* if it doesn't, then just get the value from the root dictionary */
-	else {
-		dofCount = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dofCount", 0  );
-	}
-
- 	DummySwarmVariable_Init( self, swarm, variable, dofCount );
-}
-
-void* _DummySwarmVariable_DefaultNew( Name name_renamed ) {
-	/* Variables set in this function */
-	SizeT                                                 _sizeOfSelf = sizeof(SwarmVariable);
-	Type                                                         type = DummySwarmVariable_Type;
-	Stg_Class_DeleteFunction*                                 _delete = _SwarmVariable_Delete;
-	Stg_Class_PrintFunction*                                   _print = _SwarmVariable_Print;
-	Stg_Class_CopyFunction*                                     _copy = _SwarmVariable_Copy;
-	Stg_Component_DefaultConstructorFunction*     _defaultConstructor = _DummySwarmVariable_DefaultNew;
-	Stg_Component_ConstructFunction*                       _construct = _DummySwarmVariable_AssignFromXML;
-	Stg_Component_BuildFunction*                               _build = _SwarmVariable_Build;
-	Stg_Component_InitialiseFunction*                     _initialise = _SwarmVariable_Initialise;
-	Stg_Component_ExecuteFunction*                           _execute = _SwarmVariable_Execute;
-	Stg_Component_DestroyFunction*                           _destroy = _SwarmVariable_Destroy;
-	Name                                                         name = DummySwarmVariable_ValueAt;
-	AllocationType                                 nameAllocationType = DummySwarmVariable_GetMinGlobalSwarmMagnitude;
-	SwarmVariable_ValueAtFunction*                           _valueAt = DummySwarmVariable_GetMaxGlobalSwarmMagnitude;
-	SwarmVariable_GetGlobalValueFunction*      _getMinGlobalMagnitude = name;
-
-	return _SwarmVariable_New(  SWARMVARIABLE_PASSARGS  );
-}
-
-Index DummySwarmVariable_Register( PluginsManager* pluginsManager ) {
-	RegisterParent( DummySwarmVariable_Type, SwarmVariable_Type );
-	return PluginsManager_Submit( pluginsManager, DummySwarmVariable_Type, (Name)"0", _DummySwarmVariable_DefaultNew  );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/tests/DummySwarmVariable/DummySwarmVariable.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/tests/DummySwarmVariable/DummySwarmVariable.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,160 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_PYTHON
+#include <Python.h>
+#endif
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+#include <glucifer/Windowing/Windowing.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/DrawingObjects/DrawingObjects.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+const Type DummySwarmVariable_Type = "DummySwarmVariable";
+			
+void DummySwarmVariable_ValueAt( void* swarmVariable, Particle_Index lParticle_I, double* value ) {
+	SwarmVariable*    self = (SwarmVariable*) swarmVariable;
+	GlobalParticle* particle = (GlobalParticle*)Swarm_ParticleAt( self->swarm, lParticle_I );
+	Dof_Index dof_I =0;
+
+        /*	if the dof count is not greater than the number of dimensions, we can just use the coordinate of the particle */				
+        for ( dof_I = 0 ; dof_I < self->dofCount ; dof_I++ ){
+	    if ( self->dofCount <= self->dim ){
+                if( strcmp(self->name, "normalVariable") == 0 ){
+			value[ dof_I ] = particle->coord[ dof_I ];
+	        }
+	        else if( strcmp(self->name, "vectorVariable") == 0 ){
+	            value[ dof_I ] = 0 ;
+                    if(dof_I == 0) 
+			value[ dof_I ] = particle->coord[ dof_I ];
+                }
+	        else if( strcmp(self->name, "lengthVariable") == 0 )
+	            *value = 0.2;
+                else 
+	            value[ dof_I ] = particle->coord[ dof_I ];
+	    }    
+            else
+                    abort();  /*worry about this later */
+        }
+}
+
+double DummySwarmVariable_GetMinGlobalSwarmMagnitude( void* SwarmVariable ) {
+	return  -1.0;
+}
+double DummySwarmVariable_GetMaxGlobalSwarmMagnitude( void* SwarmVariable ) {
+	return  1.0;
+}
+
+void DummySwarmVariable_Init( SwarmVariable* self, Swarm* swarm, Variable* variable, Index dofCount ) {
+	/* Add ourselves to the register for later retrieval by clients */
+	self->isConstructed = True;
+
+	self->swarm                  = swarm;
+	self->variable               = variable;
+	self->dofCount               = dofCount;
+	self->swarmVariable_Register = swarm->swarmVariable_Register;
+	self->dim                    = swarm->dim;
+	
+	if ( swarm->swarmVariable_Register != NULL )	
+		SwarmVariable_Register_Add( swarm->swarmVariable_Register, self );
+}
+
+
+void _DummySwarmVariable_AssignFromXML( void* swarmVariable, Stg_ComponentFactory* cf, void* data ) {
+	SwarmVariable*	        self         = (SwarmVariable*)swarmVariable;
+	Swarm*                  swarm;
+	Variable*               variable;
+	Index                   dofCount;
+
+	swarm = Stg_ComponentFactory_ConstructByName( cf, (Name)"swarm", Swarm, True, data  ) ;
+	variable = Stg_ComponentFactory_ConstructByName( cf, (Name)"variable", Variable, False, data  ) ;
+
+	/* Check if this component has it's own component dictionary */
+	if ( Dictionary_GetDictionary( cf->componentDict, self->name ) ) {
+		dofCount = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"dofCount", 0  );
+	}
+	/* if it doesn't, then just get the value from the root dictionary */
+	else {
+		dofCount = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, (Dictionary_Entry_Key)"dofCount", 0  );
+	}
+
+ 	DummySwarmVariable_Init( self, swarm, variable, dofCount );
+}
+
+void* _DummySwarmVariable_DefaultNew( Name name_renamed ) {
+	/* Variables set in this function */
+	SizeT                                                 _sizeOfSelf = sizeof(SwarmVariable);
+	Type                                                         type = DummySwarmVariable_Type;
+	Stg_Class_DeleteFunction*                                 _delete = _SwarmVariable_Delete;
+	Stg_Class_PrintFunction*                                   _print = _SwarmVariable_Print;
+	Stg_Class_CopyFunction*                                     _copy = _SwarmVariable_Copy;
+	Stg_Component_DefaultConstructorFunction*     _defaultConstructor = _DummySwarmVariable_DefaultNew;
+	Stg_Component_ConstructFunction*                       _construct = _DummySwarmVariable_AssignFromXML;
+	Stg_Component_BuildFunction*                               _build = _SwarmVariable_Build;
+	Stg_Component_InitialiseFunction*                     _initialise = _SwarmVariable_Initialise;
+	Stg_Component_ExecuteFunction*                           _execute = _SwarmVariable_Execute;
+	Stg_Component_DestroyFunction*                           _destroy = _SwarmVariable_Destroy;
+	Name                                                         name = DummySwarmVariable_ValueAt;
+	AllocationType                                 nameAllocationType = DummySwarmVariable_GetMinGlobalSwarmMagnitude;
+	SwarmVariable_ValueAtFunction*                           _valueAt = DummySwarmVariable_GetMaxGlobalSwarmMagnitude;
+	SwarmVariable_GetGlobalValueFunction*      _getMinGlobalMagnitude = name;
+
+	return _SwarmVariable_New(  SWARMVARIABLE_PASSARGS  );
+}
+
+Index DummySwarmVariable_Register( PluginsManager* pluginsManager ) {
+	RegisterParent( DummySwarmVariable_Type, SwarmVariable_Type );
+	return PluginsManager_Submit( pluginsManager, DummySwarmVariable_Type, (Name)"0", _DummySwarmVariable_DefaultNew  );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/tests/testDrawingObject.c
--- a/DrawingObjects/tests/testDrawingObject.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: testDrawingObject.c 746 2007-10-29 04:26:41Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-
-#ifdef HAVE_PYTHON
-#include <Python.h>
-#endif
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-#include <glucifer/Windowing/Windowing.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/InputFormats/InputFormats.h>
-#include <glucifer/OutputFormats/OutputFormats.h>
-#include <glucifer/DrawingObjects/DrawingObjects.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-			
-int main( int argc, char* argv[] ) {
-	MPI_Comm               CommWorld;
-	int                    rank;
-	int                    numProcessors;
-	Dictionary*            dictionary;
-	XML_IO_Handler*        ioHandler;
-	DomainContext* context         = NULL;
-	Stream*                dummyOpenGLStream;
-	char                   filename[20];
-	
-	/* Initialise PETSc, get world info */
-	MPI_Init( &argc, &argv );
-	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-	MPI_Comm_size( CommWorld, &numProcessors );
-	MPI_Comm_rank( CommWorld, &rank );
-	
-	StGermain_Init( &argc, &argv );
-	lucBase_Init();
-	/* Add lucWindow as default window for this test */
-	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), lucDefaultWindow_Type, (Name)"0", _lucWindow_DefaultNew );
-	lucWindowing_Init();
-	lucRenderingEngines_Init();
-	lucOutputFormats_Init();
-	lucInputFormats_Init();
-	lucDrawingObjects_Init();
-	#ifdef HAVE_PYTHON
-	Py_Initialize();
-	#endif
-
-	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
-	
-	/* Create the application's dictionary */
-	dictionary = Dictionary_New();
-
-	/* Read input */
-	ioHandler = XML_IO_Handler_New( );
-	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
-	Journal_ReadFromDictionary( dictionary );
-
-
-	/* Construction phase -----------------------------------------------------------------------------------------------*/
-	context = DomainContext_New( "context", 0, 0, CommWorld, dictionary );
-	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, True );
-	if( rank == 0 ) 
-		Context_PrintConcise( context, context->verbose );
-
-	/* Redirect OpenGL stream */
-	sprintf( filename, "OpenGL.%d.txt", rank );
-	dummyOpenGLStream = Journal_Register( Info_Type, (Name)"DummyOpenGL"  );
-	Stream_RedirectFile_WithPrependedPath( dummyOpenGLStream, context->outputPath, filename );
-
-	/* Building phase ---------------------------------------------------------------------------------------------------*/
-	Stg_Component_Build( context, 0 /* dummy */, False );
-	
-	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
-	Stg_Component_Initialise( context, 0 /* dummy */, False );
-	
-	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
-	AbstractContext_Dump( context );
-	
-	/* Destruct phase ---------------------------------------------------------------------------------------------------*/
-	Stg_Component_Destroy( context, 0 /* dummy */, False );
-	Stg_Class_Delete( context );
-	Stg_Class_Delete( dictionary );
-
-	#ifdef HAVE_PYTHON
-	Py_Finalize();
-	#endif
-
-	lucDrawingObjects_Finalise();
-	lucInputFormats_Finalise();
-	lucOutputFormats_Finalise();
-	lucRenderingEngines_Finalise();
-	lucWindowing_Finalise();
-	lucBase_Finalise();
-	StGermain_Finalise();
-		
-	/* Close off MPI */
-	MPI_Finalize();
-	
-	return 0; /* success */
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef DrawingObjects/tests/testDrawingObject.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DrawingObjects/tests/testDrawingObject.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,150 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: testDrawingObject.c 746 2007-10-29 04:26:41Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+
+#ifdef HAVE_PYTHON
+#include <Python.h>
+#endif
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+#include <glucifer/Windowing/Windowing.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/InputFormats/InputFormats.h>
+#include <glucifer/OutputFormats/OutputFormats.h>
+#include <glucifer/DrawingObjects/DrawingObjects.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+			
+int main( int argc, char* argv[] ) {
+	MPI_Comm               CommWorld;
+	int                    rank;
+	int                    numProcessors;
+	Dictionary*            dictionary;
+	XML_IO_Handler*        ioHandler;
+	DomainContext* context         = NULL;
+	Stream*                dummyOpenGLStream;
+	char                   filename[20];
+	
+	/* Initialise PETSc, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+	
+	StGermain_Init( &argc, &argv );
+	lucBase_Init();
+	/* Add lucWindow as default window for this test */
+	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), lucDefaultWindow_Type, (Name)"0", _lucWindow_DefaultNew );
+	lucWindowing_Init();
+	lucRenderingEngines_Init();
+	lucOutputFormats_Init();
+	lucInputFormats_Init();
+	lucDrawingObjects_Init();
+	#ifdef HAVE_PYTHON
+	Py_Initialize();
+	#endif
+
+	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+	
+	/* Create the application's dictionary */
+	dictionary = Dictionary_New();
+
+	/* Read input */
+	ioHandler = XML_IO_Handler_New( );
+	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
+	Journal_ReadFromDictionary( dictionary );
+
+
+	/* Construction phase -----------------------------------------------------------------------------------------------*/
+	context = DomainContext_New( "context", 0, 0, CommWorld, dictionary );
+	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, True );
+	if( rank == 0 ) 
+		Context_PrintConcise( context, context->verbose );
+
+	/* Redirect OpenGL stream */
+	sprintf( filename, "OpenGL.%d.txt", rank );
+	dummyOpenGLStream = Journal_Register( Info_Type, (Name)"DummyOpenGL"  );
+	Stream_RedirectFile_WithPrependedPath( dummyOpenGLStream, context->outputPath, filename );
+
+	/* Building phase ---------------------------------------------------------------------------------------------------*/
+	Stg_Component_Build( context, 0 /* dummy */, False );
+	
+	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
+	Stg_Component_Initialise( context, 0 /* dummy */, False );
+	
+	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
+	AbstractContext_Dump( context );
+	
+	/* Destruct phase ---------------------------------------------------------------------------------------------------*/
+	Stg_Component_Destroy( context, 0 /* dummy */, False );
+	Stg_Class_Delete( context );
+	Stg_Class_Delete( dictionary );
+
+	#ifdef HAVE_PYTHON
+	Py_Finalize();
+	#endif
+
+	lucDrawingObjects_Finalise();
+	lucInputFormats_Finalise();
+	lucOutputFormats_Finalise();
+	lucRenderingEngines_Finalise();
+	lucWindowing_Finalise();
+	lucBase_Finalise();
+	StGermain_Finalise();
+		
+	/* Close off MPI */
+	MPI_Finalize();
+	
+	return 0; /* success */
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/src/Finalise.c
--- a/InputFormats/src/Finalise.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool lucInputFormats_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/InputFormats/src/Finalise.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,60 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool lucInputFormats_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/src/Init.c
--- a/InputFormats/src/Init.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-
-#include "InputFormats.h"
-
-Bool lucInputFormats_Init() {
-	/*Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();*/
-
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	lucInputFormat_Register_Add( lucInputFormat_Register_Singleton, ".ppm", lucInputPPM_Type, "0", _lucInputPPM_DefaultNew );
-	RegisterParent( lucInputPPM_Type,         lucInputFormat_Type );
-		
-	#ifdef HAVE_TIFF
-    	lucInputFormat_Register_Add( lucInputFormat_Register_Singleton, ".tiff", lucInputTIFF_Type, "0", _lucInputTIFF_DefaultNew );
-    	RegisterParent( lucInputTIFF_Type,        lucInputFormat_Type );
-	#endif
-			
-/*	#ifdef HAVE_LIBPNG
-	   lucInputFormat_Register_Add( lucInputFormat_Register_Singleton, ".png",      "0", _lucInputPNG_DefaultNew );
-	   RegisterParent( lucInputPNG_Type,         lucInputFormat_Type );
-	#endif	
-	
-	#ifdef HAVE_LIBJPEG
-    	lucInputFormat_Register_Add( lucInputFormat_Register_Singleton, ".jpeg",      "0", _lucInputJPEG_DefaultNew );
-    	RegisterParent( lucInputJPEG_Type,        lucInputFormat_Type );
-    #endif
-*/    
-    
-    
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/InputFormats/src/Init.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,81 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+
+#include "InputFormats.h"
+
+Bool lucInputFormats_Init() {
+	/*Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();*/
+
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	lucInputFormat_Register_Add( lucInputFormat_Register_Singleton, ".ppm", lucInputPPM_Type, "0", _lucInputPPM_DefaultNew );
+	RegisterParent( lucInputPPM_Type,         lucInputFormat_Type );
+		
+	#ifdef HAVE_TIFF
+    	lucInputFormat_Register_Add( lucInputFormat_Register_Singleton, ".tiff", lucInputTIFF_Type, "0", _lucInputTIFF_DefaultNew );
+    	RegisterParent( lucInputTIFF_Type,        lucInputFormat_Type );
+	#endif
+			
+/*	#ifdef HAVE_LIBPNG
+	   lucInputFormat_Register_Add( lucInputFormat_Register_Singleton, ".png",      "0", _lucInputPNG_DefaultNew );
+	   RegisterParent( lucInputPNG_Type,         lucInputFormat_Type );
+	#endif	
+	
+	#ifdef HAVE_LIBJPEG
+    	lucInputFormat_Register_Add( lucInputFormat_Register_Singleton, ".jpeg",      "0", _lucInputJPEG_DefaultNew );
+    	RegisterParent( lucInputJPEG_Type,        lucInputFormat_Type );
+    #endif
+*/    
+    
+    
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/src/InputPPM.c
--- a/InputFormats/src/InputPPM.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "InputPPM.h"
-
-#include <assert.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucInputPPM_Type = "lucInputPPM";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucInputPPM* _lucInputPPM_New(  LUCINPUTPPM_DEFARGS  ) 
-{
-	lucInputPPM*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucInputPPM) );
-	self = (lucInputPPM*) _lucInputFormat_New(  LUCINPUTFORMAT_PASSARGS  );	
-	
-	return self;
-}
-
-void _lucInputPPM_Init( 
-		lucInputPPM*                                                self )
-{
-}
-
-void _lucInputPPM_Delete( void* InputFormat ) {
-	lucInputPPM*  self = (lucInputPPM*)InputFormat;
-
-	_lucInputFormat_Delete( self );
-}
-
-void _lucInputPPM_Print( void* InputFormat, Stream* stream ) {
-	lucInputPPM*  self = (lucInputPPM*)InputFormat;
-
-	_lucInputFormat_Print( self, stream );
-}
-
-void* _lucInputPPM_Copy( void* InputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucInputPPM*  self = (lucInputPPM*)InputFormat;
-	lucInputPPM* newInputFormat;
-
-	newInputFormat = _lucInputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newInputFormat;
-}
-
-
-void* _lucInputPPM_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucInputPPM);
-	Type                                                      type = lucInputPPM_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucInputPPM_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucInputPPM_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucInputPPM_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucInputPPM_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucInputPPM_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucInputPPM_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucInputPPM_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucInputPPM_Destroy;
-	lucInputFormat_InputFunction*                           _input = _lucInputPPM_Input;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucInputPPM_New(  LUCINPUTPPM_PASSARGS  );
-}
-
-void _lucInputPPM_AssignFromXML( void* InputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucInputPPM*  self = (lucInputPPM*)InputFormat;
-
-	/* Construct Parent */
-	lucInputFormat_InitAll( self, "ppm" );
-
-	_lucInputPPM_Init( self );
-}
-
-void _lucInputPPM_Build( void* InputFormat, void* data ) {}
-void _lucInputPPM_Initialise( void* InputFormat, void* data ) {}
-void _lucInputPPM_Execute( void* InputFormat, void* data ) {}
-void _lucInputPPM_Destroy( void* InputFormat, void* data ) {}
-
-lucPixel* _lucInputPPM_Input( void* inputFormat, Name imageName, Pixel_Index *width, Pixel_Index* height ) {
-	lucInputPPM*  self         = (lucInputPPM*)inputFormat;
-	FILE*         imageFile;
-	int           i,j;
-	lucPixel*     pixelData;
-	Bool          readTag = False;
-	Bool          readWidth = False;
-	Bool          readHeight = False;
-	Bool          readColourCount = False;
-	char*         charPtr;
-	char          stringBuffer[241];
-	int           ppmType;
-	int           colourCount;
-	
-	imageFile = fopen( imageName, "r" );
-	Journal_Firewall( imageFile != NULL, Journal_MyStream( Error_Type, self ),
-			"Error in func '%s' for %s '%s' - Cannot open '%s'\n", __func__, self->type, self->name, imageName );
-
-	while ( !readTag || ! readWidth || ! readHeight || !readColourCount ) {
-		/* Read in a new line from file */
-		charPtr = fgets( stringBuffer, 240, imageFile );
-		assert ( charPtr );
-
-		for ( charPtr = stringBuffer ; charPtr < stringBuffer + 240 ; charPtr++ ) {
-			/* Check if we should go to a new line - this will happen for comments, line breaks and terminator characters */
-			if ( *charPtr == '#' || *charPtr == '\n' || *charPtr == '\0' )
-				break;
-
-			/* Check if this is a space - if this is the case, then go to next line */
-			if ( *charPtr == ' ' || *charPtr == '\t' )
-				continue;
-
-			if ( !readTag ) {
-				sscanf( charPtr, "P%d", &ppmType );
-				readTag = True;
-			}
-			else if ( !readWidth ) {
-				sscanf( charPtr, "%u", width );
-				readWidth = True;
-			}
-			else if ( !readHeight ) {
-				sscanf( charPtr, "%u", height );
-				readHeight = True;
-			}
-			else if ( !readColourCount ) {
-				sscanf( charPtr, "%d", &colourCount );
-				readColourCount = True;
-			}
-
-			/* Go to next white space */
-			charPtr = strpbrk( charPtr, " \t" );
-
-			/* If there are no more characters in line then go to next line */
-			if ( charPtr == NULL )
-				break;
-		}
-	}
-
-	/* Only allow PPM images of type P6 and with 256 colours */
-	assert( ppmType == 6 );
-	assert( colourCount == 255 );
-
-	/* Set width and height on object - TODO - Fix this hack, this shouldn't need to happen */
-	self->imageWidth  = *width;
-	self->imageHeight = *height;
-	
-	pixelData = Memory_Alloc_Array( lucPixel, self->imageWidth * self->imageHeight, "pixel data" );
-
-	for ( j = self->imageHeight - 1 ; j >= 0 ; j--) {
-	    for ( i = 0 ; i < self->imageWidth ; i++) {
-		     fread( &pixelData[ self->imageWidth * j + i ], sizeof(lucPixel), 1, imageFile );
-		}
-	}				
-	fclose( imageFile );
-		
-	return pixelData;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/src/InputPPM.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/InputFormats/src/InputPPM.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,217 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "InputPPM.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucInputPPM_Type = "lucInputPPM";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucInputPPM* _lucInputPPM_New(  LUCINPUTPPM_DEFARGS  ) 
+{
+	lucInputPPM*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucInputPPM) );
+	self = (lucInputPPM*) _lucInputFormat_New(  LUCINPUTFORMAT_PASSARGS  );	
+	
+	return self;
+}
+
+void _lucInputPPM_Init( 
+		lucInputPPM*                                                self )
+{
+}
+
+void _lucInputPPM_Delete( void* InputFormat ) {
+	lucInputPPM*  self = (lucInputPPM*)InputFormat;
+
+	_lucInputFormat_Delete( self );
+}
+
+void _lucInputPPM_Print( void* InputFormat, Stream* stream ) {
+	lucInputPPM*  self = (lucInputPPM*)InputFormat;
+
+	_lucInputFormat_Print( self, stream );
+}
+
+void* _lucInputPPM_Copy( void* InputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucInputPPM*  self = (lucInputPPM*)InputFormat;
+	lucInputPPM* newInputFormat;
+
+	newInputFormat = _lucInputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newInputFormat;
+}
+
+
+void* _lucInputPPM_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucInputPPM);
+	Type                                                      type = lucInputPPM_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucInputPPM_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucInputPPM_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucInputPPM_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucInputPPM_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucInputPPM_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucInputPPM_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucInputPPM_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucInputPPM_Destroy;
+	lucInputFormat_InputFunction*                           _input = _lucInputPPM_Input;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucInputPPM_New(  LUCINPUTPPM_PASSARGS  );
+}
+
+void _lucInputPPM_AssignFromXML( void* InputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucInputPPM*  self = (lucInputPPM*)InputFormat;
+
+	/* Construct Parent */
+	lucInputFormat_InitAll( self, "ppm" );
+
+	_lucInputPPM_Init( self );
+}
+
+void _lucInputPPM_Build( void* InputFormat, void* data ) {}
+void _lucInputPPM_Initialise( void* InputFormat, void* data ) {}
+void _lucInputPPM_Execute( void* InputFormat, void* data ) {}
+void _lucInputPPM_Destroy( void* InputFormat, void* data ) {}
+
+lucPixel* _lucInputPPM_Input( void* inputFormat, Name imageName, Pixel_Index *width, Pixel_Index* height ) {
+	lucInputPPM*  self         = (lucInputPPM*)inputFormat;
+	FILE*         imageFile;
+	int           i,j;
+	lucPixel*     pixelData;
+	Bool          readTag = False;
+	Bool          readWidth = False;
+	Bool          readHeight = False;
+	Bool          readColourCount = False;
+	char*         charPtr;
+	char          stringBuffer[241];
+	int           ppmType;
+	int           colourCount;
+	
+	imageFile = fopen( imageName, "r" );
+	Journal_Firewall( imageFile != NULL, Journal_MyStream( Error_Type, self ),
+			"Error in func '%s' for %s '%s' - Cannot open '%s'\n", __func__, self->type, self->name, imageName );
+
+	while ( !readTag || ! readWidth || ! readHeight || !readColourCount ) {
+		/* Read in a new line from file */
+		charPtr = fgets( stringBuffer, 240, imageFile );
+		assert ( charPtr );
+
+		for ( charPtr = stringBuffer ; charPtr < stringBuffer + 240 ; charPtr++ ) {
+			/* Check if we should go to a new line - this will happen for comments, line breaks and terminator characters */
+			if ( *charPtr == '#' || *charPtr == '\n' || *charPtr == '\0' )
+				break;
+
+			/* Check if this is a space - if this is the case, then go to next line */
+			if ( *charPtr == ' ' || *charPtr == '\t' )
+				continue;
+
+			if ( !readTag ) {
+				sscanf( charPtr, "P%d", &ppmType );
+				readTag = True;
+			}
+			else if ( !readWidth ) {
+				sscanf( charPtr, "%u", width );
+				readWidth = True;
+			}
+			else if ( !readHeight ) {
+				sscanf( charPtr, "%u", height );
+				readHeight = True;
+			}
+			else if ( !readColourCount ) {
+				sscanf( charPtr, "%d", &colourCount );
+				readColourCount = True;
+			}
+
+			/* Go to next white space */
+			charPtr = strpbrk( charPtr, " \t" );
+
+			/* If there are no more characters in line then go to next line */
+			if ( charPtr == NULL )
+				break;
+		}
+	}
+
+	/* Only allow PPM images of type P6 and with 256 colours */
+	assert( ppmType == 6 );
+	assert( colourCount == 255 );
+
+	/* Set width and height on object - TODO - Fix this hack, this shouldn't need to happen */
+	self->imageWidth  = *width;
+	self->imageHeight = *height;
+	
+	pixelData = Memory_Alloc_Array( lucPixel, self->imageWidth * self->imageHeight, "pixel data" );
+
+	for ( j = self->imageHeight - 1 ; j >= 0 ; j--) {
+	    for ( i = 0 ; i < self->imageWidth ; i++) {
+		     fread( &pixelData[ self->imageWidth * j + i ], sizeof(lucPixel), 1, imageFile );
+		}
+	}				
+	fclose( imageFile );
+		
+	return pixelData;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/src/InputTIFF.c
--- a/InputFormats/src/InputTIFF.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_TIFF
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "InputTIFF.h"
-
-#include <assert.h>
-#include <string.h>
-
-#ifdef HAVE_TIFF
-	#include <tiffio.h>
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucInputTIFF_Type = "lucInputTIFF";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucInputTIFF* _lucInputTIFF_New(  LUCINPUTTIFF_DEFARGS  ) 
-{
-	lucInputTIFF*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucInputTIFF) );
-	self = (lucInputTIFF*) _lucInputFormat_New(  LUCINPUTFORMAT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucInputTIFF_Init( 
-		lucInputTIFF*                                                self )
-{
-}
-
-void _lucInputTIFF_Delete( void* InputFormat ) {
-	lucInputTIFF*  self = (lucInputTIFF*)InputFormat;
-
-	_lucInputFormat_Delete( self );
-}
-
-void _lucInputTIFF_Print( void* InputFormat, Stream* stream ) {
-	lucInputTIFF*  self = (lucInputTIFF*)InputFormat;
-
-	_lucInputFormat_Print( self, stream );
-}
-
-void* _lucInputTIFF_Copy( void* InputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucInputTIFF*  self = (lucInputTIFF*)InputFormat;
-	lucInputTIFF* newInputFormat;
-
-	newInputFormat = _lucInputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newInputFormat;
-}
-
-
-void* _lucInputTIFF_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucInputTIFF);
-	Type                                                      type = lucInputTIFF_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucInputTIFF_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucInputTIFF_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucInputTIFF_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucInputTIFF_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucInputTIFF_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucInputTIFF_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucInputTIFF_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucInputTIFF_Destroy;
-	lucInputFormat_InputFunction*                           _input = _lucInputTIFF_Input;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucInputTIFF_New(  LUCINPUTTIFF_PASSARGS  );
-}
-
-void _lucInputTIFF_AssignFromXML( void* InputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucInputTIFF*  self = (lucInputTIFF*)InputFormat;
-
-	/* Construct Parent */
-	lucInputFormat_InitAll( self, "tiff" );
-
-	_lucInputTIFF_Init( self );
-}
-
-void _lucInputTIFF_Build( void* InputFormat, void* data ) {}
-void _lucInputTIFF_Initialise( void* InputFormat, void* data ) {}
-void _lucInputTIFF_Execute( void* InputFormat, void* data ) {}
-void _lucInputTIFF_Destroy( void* InputFormat, void* data ) {}
-
-lucPixel* _lucInputTIFF_Input( void* inputFormat, Name imageName, Pixel_Index *width, Pixel_Index* height ){
-
-	/* Using Sam Leffler's libtiff library 
-	 * http://www.remotesensing.org/libtiff/ */
-	TIFFRGBAImage  img;
-	uint32*        raster;
-	size_t         npixels;
-	int            hasABGR = 0;
- 	TIFF*          tif;
-	char           emsg[1024];
-	int            i;
-	unsigned char* cp;
-	lucPixel*      pixelData;
-	
-	lucInputTIFF*   self         = (lucInputTIFF*)inputFormat;
-	
-	tif = TIFFOpen(imageName, "r");
-	Journal_Firewall( tif != NULL, Journal_MyStream( Error_Type, self ),
-			"Error in func '%s' for %s '%s' - Cannot open '%s'\n", __func__, self->type, self->name, imageName );
-  	
-	if (TIFFRGBAImageBegin(&img, tif, 0,emsg)){
-		npixels = img.width*img.height; 
-		raster = (uint32 *)_TIFFmalloc(npixels*sizeof(uint32)); 
-		if (raster != NULL){ 
-			if (TIFFRGBAImageGet(&img, raster, img.width, img.height) == 0){ 
-				TIFFError(imageName, emsg); 
-				abort(); 
-			} 
-		} 
-		TIFFRGBAImageEnd(&img); 
-	} 
-	else { 
-		TIFFError(imageName, emsg); 
-		abort();
-	}
-    
-	self->imageWidth = img.width; 
-	self->imageHeight = img.height; 
-	*width = img.width;
-	*height = img.height;
-	pixelData = Memory_Alloc_Array( lucPixel, self->imageWidth * self->imageHeight, "pixel data" );
-	
-	/* code based upon http://www.opengl.org/developers/code/mjktips/libtiff/showtiff.c */
-	/* If cannot directly display ABGR format, we need to reverse the component ordering in each pixel. :-( */
-	if (!hasABGR) { 
-		for (i = 0; i < npixels; i++) { 
-			register unsigned char *cp = (unsigned char *) &raster[i]; 
-			int t; 
-			
-			t = cp[3]; 
-			cp[3] = cp[0]; 
-			cp[0] = t; 
-			t = cp[2]; 
-			cp[2] = cp[1]; 
-			cp[1] = t; 
-		} 
-	}
-  
-	for (i = 0; i < npixels; i++) {	  
-		cp = (unsigned char *) &raster[i]; 
-		pixelData[i][0] = cp[3] ;		
-		pixelData[i][1]=  cp[2]; 
-		pixelData[i][2] = cp[1];
-	}
-	
-	return pixelData;
-}
-
-#endif
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/src/InputTIFF.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/InputFormats/src/InputTIFF.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,215 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_TIFF
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "InputTIFF.h"
+
+#include <assert.h>
+#include <string.h>
+
+#ifdef HAVE_TIFF
+	#include <tiffio.h>
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucInputTIFF_Type = "lucInputTIFF";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucInputTIFF* _lucInputTIFF_New(  LUCINPUTTIFF_DEFARGS  ) 
+{
+	lucInputTIFF*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucInputTIFF) );
+	self = (lucInputTIFF*) _lucInputFormat_New(  LUCINPUTFORMAT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucInputTIFF_Init( 
+		lucInputTIFF*                                                self )
+{
+}
+
+void _lucInputTIFF_Delete( void* InputFormat ) {
+	lucInputTIFF*  self = (lucInputTIFF*)InputFormat;
+
+	_lucInputFormat_Delete( self );
+}
+
+void _lucInputTIFF_Print( void* InputFormat, Stream* stream ) {
+	lucInputTIFF*  self = (lucInputTIFF*)InputFormat;
+
+	_lucInputFormat_Print( self, stream );
+}
+
+void* _lucInputTIFF_Copy( void* InputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucInputTIFF*  self = (lucInputTIFF*)InputFormat;
+	lucInputTIFF* newInputFormat;
+
+	newInputFormat = _lucInputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newInputFormat;
+}
+
+
+void* _lucInputTIFF_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucInputTIFF);
+	Type                                                      type = lucInputTIFF_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucInputTIFF_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucInputTIFF_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucInputTIFF_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucInputTIFF_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucInputTIFF_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucInputTIFF_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucInputTIFF_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucInputTIFF_Destroy;
+	lucInputFormat_InputFunction*                           _input = _lucInputTIFF_Input;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucInputTIFF_New(  LUCINPUTTIFF_PASSARGS  );
+}
+
+void _lucInputTIFF_AssignFromXML( void* InputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucInputTIFF*  self = (lucInputTIFF*)InputFormat;
+
+	/* Construct Parent */
+	lucInputFormat_InitAll( self, "tiff" );
+
+	_lucInputTIFF_Init( self );
+}
+
+void _lucInputTIFF_Build( void* InputFormat, void* data ) {}
+void _lucInputTIFF_Initialise( void* InputFormat, void* data ) {}
+void _lucInputTIFF_Execute( void* InputFormat, void* data ) {}
+void _lucInputTIFF_Destroy( void* InputFormat, void* data ) {}
+
+lucPixel* _lucInputTIFF_Input( void* inputFormat, Name imageName, Pixel_Index *width, Pixel_Index* height ){
+
+	/* Using Sam Leffler's libtiff library 
+	 * http://www.remotesensing.org/libtiff/ */
+	TIFFRGBAImage  img;
+	uint32*        raster;
+	size_t         npixels;
+	int            hasABGR = 0;
+ 	TIFF*          tif;
+	char           emsg[1024];
+	int            i;
+	unsigned char* cp;
+	lucPixel*      pixelData;
+	
+	lucInputTIFF*   self         = (lucInputTIFF*)inputFormat;
+	
+	tif = TIFFOpen(imageName, "r");
+	Journal_Firewall( tif != NULL, Journal_MyStream( Error_Type, self ),
+			"Error in func '%s' for %s '%s' - Cannot open '%s'\n", __func__, self->type, self->name, imageName );
+  	
+	if (TIFFRGBAImageBegin(&img, tif, 0,emsg)){
+		npixels = img.width*img.height; 
+		raster = (uint32 *)_TIFFmalloc(npixels*sizeof(uint32)); 
+		if (raster != NULL){ 
+			if (TIFFRGBAImageGet(&img, raster, img.width, img.height) == 0){ 
+				TIFFError(imageName, emsg); 
+				abort(); 
+			} 
+		} 
+		TIFFRGBAImageEnd(&img); 
+	} 
+	else { 
+		TIFFError(imageName, emsg); 
+		abort();
+	}
+    
+	self->imageWidth = img.width; 
+	self->imageHeight = img.height; 
+	*width = img.width;
+	*height = img.height;
+	pixelData = Memory_Alloc_Array( lucPixel, self->imageWidth * self->imageHeight, "pixel data" );
+	
+	/* code based upon http://www.opengl.org/developers/code/mjktips/libtiff/showtiff.c */
+	/* If cannot directly display ABGR format, we need to reverse the component ordering in each pixel. :-( */
+	if (!hasABGR) { 
+		for (i = 0; i < npixels; i++) { 
+			register unsigned char *cp = (unsigned char *) &raster[i]; 
+			int t; 
+			
+			t = cp[3]; 
+			cp[3] = cp[0]; 
+			cp[0] = t; 
+			t = cp[2]; 
+			cp[2] = cp[1]; 
+			cp[1] = t; 
+		} 
+	}
+  
+	for (i = 0; i < npixels; i++) {	  
+		cp = (unsigned char *) &raster[i]; 
+		pixelData[i][0] = cp[3] ;		
+		pixelData[i][1]=  cp[2]; 
+		pixelData[i][2] = cp[1];
+	}
+	
+	return pixelData;
+}
+
+#endif
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/tests/plugins/lucTestInputFormat.c
--- a/InputFormats/tests/plugins/lucTestInputFormat.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: lucTestInputFormat.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-
-#include <math.h>
-#include <string.h>
-#include <assert.h>
-
-const Type TestInputFormat_Type = "TestInputFormat";
-
-void glucifer_lucTestInputFormat( DomainContext* context ) {
-	Pixel_Index     width;
-	Pixel_Index     height;
-	char*           imageName;   
-	lucPixel*       pixelData;
-	lucInputFormat* inputFormat;
-	FILE*           file;
-	int             i, j;
-
-	imageName = Dictionary_GetString( context->dictionary, (Dictionary_Entry_Key)"imageName"  );
-
-	inputFormat = lucInputFormat_Register_CreateFromFileName( lucInputFormat_Register_Singleton, imageName );
-	pixelData = lucInputFormat_Input( inputFormat, imageName, &width, &height );
-	
-	/* Dump output to file */
-	file = fopen( "output/output.ppm", "w" );
-	fprintf( file, "P6\n#Image originally derived from %s\n%d %d\n255\n", imageName, width, height );
-	for ( j = height - 1 ; j >= 0 ; j--) 
-		for ( i = 0 ; i < width ; i++) 
-			fwrite( &pixelData[ width * j + i ], sizeof(lucPixel), 1, file );
-	fclose( file );
-
-	Memory_Free( pixelData );
-}
-
-void _lucTestInputFormat_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-	DomainContext* context;
-	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", DomainContext, True, data  ); 
-	ContextEP_ReplaceAll( context, AbstractContext_EP_Initialise, glucifer_lucTestInputFormat );
-}
-
-
-void* _lucTestInputFormat_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof( Codelet );
-	Type                                                      type = TestInputFormat_Type;
-	Stg_Class_DeleteFunction*                              _delete = _Codelet_Delete;
-	Stg_Class_PrintFunction*                                _print = _Codelet_Print;
-	Stg_Class_CopyFunction*                                  _copy = _Codelet_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucTestInputFormat_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucTestInputFormat_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _Codelet_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _Codelet_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _Codelet_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _Codelet_Destroy;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _Codelet_New(  CODELET_PASSARGS  );
-}
-
-
-Index lucTestInputFormat_Register( PluginsManager* pluginsManager ) {
-	Index result;
-
-	result = PluginsManager_Submit( pluginsManager, TestInputFormat_Type, (Name)"0", _lucTestInputFormat_DefaultNew  );
-
-	return result;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef InputFormats/tests/plugins/lucTestInputFormat.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/InputFormats/tests/plugins/lucTestInputFormat.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,118 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: lucTestInputFormat.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+
+#include <math.h>
+#include <string.h>
+#include <assert.h>
+
+const Type TestInputFormat_Type = "TestInputFormat";
+
+void glucifer_lucTestInputFormat( DomainContext* context ) {
+	Pixel_Index     width;
+	Pixel_Index     height;
+	char*           imageName;   
+	lucPixel*       pixelData;
+	lucInputFormat* inputFormat;
+	FILE*           file;
+	int             i, j;
+
+	imageName = Dictionary_GetString( context->dictionary, (Dictionary_Entry_Key)"imageName"  );
+
+	inputFormat = lucInputFormat_Register_CreateFromFileName( lucInputFormat_Register_Singleton, imageName );
+	pixelData = lucInputFormat_Input( inputFormat, imageName, &width, &height );
+	
+	/* Dump output to file */
+	file = fopen( "output/output.ppm", "w" );
+	fprintf( file, "P6\n#Image originally derived from %s\n%d %d\n255\n", imageName, width, height );
+	for ( j = height - 1 ; j >= 0 ; j--) 
+		for ( i = 0 ; i < width ; i++) 
+			fwrite( &pixelData[ width * j + i ], sizeof(lucPixel), 1, file );
+	fclose( file );
+
+	Memory_Free( pixelData );
+}
+
+void _lucTestInputFormat_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+	DomainContext* context;
+	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", DomainContext, True, data  ); 
+	ContextEP_ReplaceAll( context, AbstractContext_EP_Initialise, glucifer_lucTestInputFormat );
+}
+
+
+void* _lucTestInputFormat_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof( Codelet );
+	Type                                                      type = TestInputFormat_Type;
+	Stg_Class_DeleteFunction*                              _delete = _Codelet_Delete;
+	Stg_Class_PrintFunction*                                _print = _Codelet_Print;
+	Stg_Class_CopyFunction*                                  _copy = _Codelet_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucTestInputFormat_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucTestInputFormat_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _Codelet_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _Codelet_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _Codelet_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _Codelet_Destroy;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _Codelet_New(  CODELET_PASSARGS  );
+}
+
+
+Index lucTestInputFormat_Register( PluginsManager* pluginsManager ) {
+	Index result;
+
+	result = PluginsManager_Submit( pluginsManager, TestInputFormat_Type, (Name)"0", _lucTestInputFormat_DefaultNew  );
+
+	return result;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/EncoderLibavcodec.c
--- a/OutputFormats/src/EncoderLibavcodec.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: EncoderLibavcodec.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_LIBAVCODEC
-
-#include <ffmpeg/avcodec.h>
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "EncoderLibavcodec.h"
-
-#include <assert.h>
-#include <string.h>
-
-#define MAX_BUFFER_SIZE 100000
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucEncoderLibavcodec_Type = "lucEncoderLibavcodec";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucEncoderLibavcodec* _lucEncoderLibavcodec_New(  LUCENCODERLIBAVCODEC_DEFARGS  ) 
-{
-	lucEncoderLibavcodec*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucEncoderLibavcodec) );
-	self = (lucEncoderLibavcodec*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucEncoderLibavcodec_Init( 
-		lucEncoderLibavcodec*                                             self,
-		lucWindow*                                                        window,
-		char*                                                             outputPath,
-		Bool                                                              loadFromCheckPoint,
-		Name                                                              codecName,
-		unsigned int                                                      framesPerSecond,
-		unsigned int                                                      bitRate,
-		Bool                                                              includeFrame0)
-{
-	Pixel_Index              width      = window->width;
-	Pixel_Index              height     = window->height;
-	Pixel_Index              pixelCount = width * height;
-	Name                     filename;
-	AVCodecContext*          codecContext;
-	AVCodec*                 codec;
-	AVFrame*                 frame;
-	Stream*                  errorStream = Journal_MyStream( Error_Type, self );
-
-	/*set the bool to display the Frame 0 or not */
-	self->includeFrame0 = includeFrame0;
-
-	/* Check to make sure width and height of window are multiples of 16 */
-	Journal_Firewall( width % 2 == 0, lucError, "In func %s: Width %u is not multiple of 2.", __func__, width );
-	Journal_Firewall( height % 2 == 0, lucError, "In func %s: Height %u is not multiple of 2.", __func__, height );
-
-	lucOutputFormat_Register_Add( window->outputFormat_Register, self );
-
-	/* Create codec context */
-	codecContext = self->codecContext = avcodec_alloc_context();
-
-	/* Setup paramaters on context */
-	codecContext->bit_rate        = bitRate;
-	codecContext->width           = width;
-	codecContext->height          = height;
-	
-	/* Set the frame rate of the movie
-	 * NB: libavcodec changed the way to define the frame rate in April, 2005 */
-#if LIBAVCODEC_BUILD > 4753
-	codecContext->time_base.num   = 1;
-	codecContext->time_base.den   = (int) framesPerSecond;
-#else
-	codecContext->frame_rate      = (int) framesPerSecond;
-	codecContext->frame_rate_base = 1;
-#endif
-	codecContext->gop_size        = 10;
-
-	/* Get Codec from name */
-	codec = avcodec_find_encoder_by_name( codecName );
-	if ( codec == NULL ) {
-		Journal_Printf( errorStream, "Error in func %s for %s '%s' - Couldn't find codec '%s'. Available codecs are:\n",
-				__func__, self->type, self->name, codecName );
-
-		/* Go through linked list of all the codecs avaiable and print them out. */
-		Stream_Indent( errorStream );
-		for ( codec = first_avcodec ; codec != NULL ; codec = codec->next ) {
-			if ( codec->encode != NULL ) 
-				Journal_Printf( errorStream, "%s (id = %d)\n", codec->name, codec->id );
-		}
-		abort();
-	}
-
-	/* Open it */
-	if (avcodec_open(codecContext, codec) < 0) {
-		Journal_Printf( errorStream, "Error in func %s for %s '%s' - Cannot open codec '%s'.\n", 
-				__func__, self->type, self->name, codecName );
-		abort();
-	}
-
-	/* Open Output File */
-	Stg_asprintf( &filename, "%s/%s.mpeg", outputPath, window->name );
-	self->stream = Journal_MyStream( Dump_Type, self );
-	
-	if(!loadFromCheckPoint)
-		Stream_RedirectFile( self->stream, filename );
-	else
-		Stream_AppendFile( self->stream, filename );
-
-	Memory_Free( filename );
-
-	/* Create 'frame' data structure */
-	frame = self->frame = avcodec_alloc_frame();
-	frame->data[0] = Memory_Alloc_Array( unsigned char, pixelCount, "Y" );
-	frame->data[1] = Memory_Alloc_Array( unsigned char, pixelCount/4, "Cr" );
-	frame->data[2] = Memory_Alloc_Array( unsigned char, pixelCount/4, "Cb" );
-
-	frame->linesize[0] = width;
-	frame->linesize[1] = width / 2; 
-	frame->linesize[2] = width / 2;
-
-	/* Create output buffer which is what we write to the file for each frame */
-	self->outputBuffer = Memory_Alloc_Bytes(MAX_BUFFER_SIZE,char, "outputBufferForFrame");
-}
-
-void _lucEncoderLibavcodec_Delete( void* outputFormat ) {
-	lucEncoderLibavcodec*  self              = (lucEncoderLibavcodec*) outputFormat;
-	AVFrame*               frame             = (AVFrame*) self->frame;
-	uint8_t                endCodeSequence[] = { 0x00, 0x00, 0x01, 0xb7 };
-	int                    sizeToWrite;
-
-
-	/* Write the delayed frames to the file */
-	do {
-		sizeToWrite = avcodec_encode_video(self->codecContext, self->outputBuffer, MAX_BUFFER_SIZE, NULL);
-		Journal_Write( self->stream, self->outputBuffer, sizeToWrite, 1 );
-	} while ( sizeToWrite != 0 );
-	
-	/* Write the end code sequence to get a real mpeg file */
-	Journal_Write( self->stream, endCodeSequence, 4, 1 );
-
-	/* Free Memory */
-	Memory_Free( frame->data[0] );
-	Memory_Free( frame->data[1] );
-	Memory_Free( frame->data[2] );
-	Memory_Free( frame );
-	Memory_Free( self->codecContext );
-	Memory_Free( self->outputBuffer );
-
-	_lucOutputFormat_Delete( self );
-}
-
-void _lucEncoderLibavcodec_Print( void* outputFormat, Stream* stream ) {
-	lucEncoderLibavcodec*  self = (lucEncoderLibavcodec*) outputFormat;
-
-	_lucOutputFormat_Print( self, stream );
-}
-
-void* _lucEncoderLibavcodec_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucEncoderLibavcodec*  self = (lucEncoderLibavcodec*)outputFormat;
-	lucEncoderLibavcodec* newOutputFormat;
-
-	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newOutputFormat;
-}
-
-
-void* _lucEncoderLibavcodec_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucEncoderLibavcodec);
-	Type                                                      type = lucEncoderLibavcodec_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucEncoderLibavcodec_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucEncoderLibavcodec_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucEncoderLibavcodec_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucEncoderLibavcodec_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucEncoderLibavcodec_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucEncoderLibavcodec_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucEncoderLibavcodec_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucEncoderLibavcodec_Destroy;
-	lucOutputFormat_OutputFunction*                        _output = _lucEncoderLibavcodec_Output;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucEncoderLibavcodec_New(  LUCENCODERLIBAVCODEC_PASSARGS  );
-}
-
-void _lucEncoderLibavcodec_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucEncoderLibavcodec*  self = (lucEncoderLibavcodec*)outputFormat;
-	lucWindow*          window;
-	AbstractContext*    context;
-
-	/* Construct Parent */
-	lucOutputFormat_InitAll( self, "mpeg" );
-
-	window =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Window", lucWindow, True, data   ) ;
-	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ) ;
-        
-	_lucEncoderLibavcodec_Init( 
-			self,
-			window,
-			context->outputPath,
-			context->loadFromCheckPoint,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"codec", "mpeg1video"  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"frameRate", 25  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"bitRate", 400000 ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"includeFrame0", False)
-			 );
-}
-
-void _lucEncoderLibavcodec_Build( void* outputFormat, void* data ) {}
-void _lucEncoderLibavcodec_Initialise( void* outputFormat, void* data ) {}
-void _lucEncoderLibavcodec_Execute( void* outputFormat, void* data ) {}
-void _lucEncoderLibavcodec_Destroy( void* outputFormat, void* data ) {}
-
-void _lucEncoderLibavcodec_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucEncoderLibavcodec*         self            = (lucEncoderLibavcodec*) outputFormat;
-	AVFrame*                      frame           = (AVFrame*) self->frame;
-	Pixel_Index                   width           = window->width;
-	Pixel_Index                   height          = window->height;
-	Pixel_Index                   pixel_I;
-	Pixel_Index                   xPixel_I;
-	Pixel_Index                   yPixel_I;
-	unsigned char*                macroPixel0;
-	unsigned char*                macroPixel1;
-	unsigned char*                macroPixel2;
-	unsigned char*                macroPixel3;
-	float                         red, green, blue;
-	int                           sizeToWrite;
-
-	/* Setup the 'Y' part of the frame */
-	for ( yPixel_I = 0 ; yPixel_I < height ; yPixel_I++ ) {
-		for ( xPixel_I = 0 ; xPixel_I < width ; xPixel_I++ ) {
-			pixel_I = (height - yPixel_I - 1) * width + xPixel_I;
-			
-			red   = (float) pixelData[pixel_I][0];
-			green = (float) pixelData[pixel_I][1];
-			blue  = (float) pixelData[pixel_I][2];
-
-			frame->data[0][yPixel_I * frame->linesize[0] + xPixel_I] = 
-				(unsigned char)((0.257 * red) + (0.504 * green) + (0.098 * blue) + 16);
-		}
-	}
-
-	/* Setup the 'Cb (U)' and 'Cr (V)' part of the frame 
-	 * loop over macro pixels - pixels twice the size as the normal ones */
-	for ( yPixel_I = 0 ; yPixel_I < height/2 ; yPixel_I++ ) {
-		for ( xPixel_I = 0 ; xPixel_I < width/2 ; xPixel_I++ ) {
-			/* Find Four pixels in this macro pixel */
-			macroPixel0 = pixelData[ (height - yPixel_I*2 - 1) * width + xPixel_I * 2 ];
-			macroPixel1 = pixelData[ (height - yPixel_I*2 - 1) * width + xPixel_I * 2 + 1 ];
-			macroPixel2 = pixelData[ (height - yPixel_I*2 - 2) * width + xPixel_I * 2 ];
-			macroPixel3 = pixelData[ (height - yPixel_I*2 - 2) * width + xPixel_I * 2 + 1 ];
-
-			/* Average red, green and blue for four pixels around point */
-			red   = 0.25 * ((float) (macroPixel0[0] + macroPixel1[0] + macroPixel2[0] + macroPixel3[0] ));
-			green = 0.25 * ((float) (macroPixel0[1] + macroPixel1[1] + macroPixel2[1] + macroPixel3[1] ));
-			blue  = 0.25 * ((float) (macroPixel0[2] + macroPixel1[2] + macroPixel2[2] + macroPixel3[2] ));
-
-			/* 'Cb (U)' Component */
-			frame->data[1][yPixel_I * frame->linesize[1] + xPixel_I] = 
-				(unsigned char) (-(0.148 * red) - (0.291 * green) + (0.439 * blue) + 128);
-
-			/* 'Cr (V)' Component */
-			frame->data[2][yPixel_I * frame->linesize[2] + xPixel_I] = 
-				(unsigned char) ((0.439 * red) - (0.368 * green) - (0.071 * blue) + 128);
-		}
-	}
-	
-	/* Write data to file */
-	/* Never write frame 0  if it's a restart. If it's a normal run, write it only if specified. */
-	if( context->timeStep == 0 ){
-		if( self->includeFrame0 && (!context->loadFromCheckPoint) ) {
-			sizeToWrite = avcodec_encode_video(self->codecContext, self->outputBuffer, MAX_BUFFER_SIZE, frame);
-			Journal_Write( self->stream, self->outputBuffer, sizeToWrite, 1 );
-		}
-	}
-
-	else{
-		sizeToWrite = avcodec_encode_video(self->codecContext, self->outputBuffer, MAX_BUFFER_SIZE, frame);
-		Journal_Write( self->stream, self->outputBuffer, sizeToWrite, 1 );
-	}
-}
-
-#endif /* HAVE_LIBAVCODEC */
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/EncoderLibavcodec.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/EncoderLibavcodec.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,339 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: EncoderLibavcodec.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_LIBAVCODEC
+
+#include <ffmpeg/avcodec.h>
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "EncoderLibavcodec.h"
+
+#include <assert.h>
+#include <string.h>
+
+#define MAX_BUFFER_SIZE 100000
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucEncoderLibavcodec_Type = "lucEncoderLibavcodec";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucEncoderLibavcodec* _lucEncoderLibavcodec_New(  LUCENCODERLIBAVCODEC_DEFARGS  ) 
+{
+	lucEncoderLibavcodec*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucEncoderLibavcodec) );
+	self = (lucEncoderLibavcodec*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucEncoderLibavcodec_Init( 
+		lucEncoderLibavcodec*                                             self,
+		lucWindow*                                                        window,
+		char*                                                             outputPath,
+		Bool                                                              loadFromCheckPoint,
+		Name                                                              codecName,
+		unsigned int                                                      framesPerSecond,
+		unsigned int                                                      bitRate,
+		Bool                                                              includeFrame0)
+{
+	Pixel_Index              width      = window->width;
+	Pixel_Index              height     = window->height;
+	Pixel_Index              pixelCount = width * height;
+	Name                     filename;
+	AVCodecContext*          codecContext;
+	AVCodec*                 codec;
+	AVFrame*                 frame;
+	Stream*                  errorStream = Journal_MyStream( Error_Type, self );
+
+	/*set the bool to display the Frame 0 or not */
+	self->includeFrame0 = includeFrame0;
+
+	/* Check to make sure width and height of window are multiples of 16 */
+	Journal_Firewall( width % 2 == 0, lucError, "In func %s: Width %u is not multiple of 2.", __func__, width );
+	Journal_Firewall( height % 2 == 0, lucError, "In func %s: Height %u is not multiple of 2.", __func__, height );
+
+	lucOutputFormat_Register_Add( window->outputFormat_Register, self );
+
+	/* Create codec context */
+	codecContext = self->codecContext = avcodec_alloc_context();
+
+	/* Setup paramaters on context */
+	codecContext->bit_rate        = bitRate;
+	codecContext->width           = width;
+	codecContext->height          = height;
+	
+	/* Set the frame rate of the movie
+	 * NB: libavcodec changed the way to define the frame rate in April, 2005 */
+#if LIBAVCODEC_BUILD > 4753
+	codecContext->time_base.num   = 1;
+	codecContext->time_base.den   = (int) framesPerSecond;
+#else
+	codecContext->frame_rate      = (int) framesPerSecond;
+	codecContext->frame_rate_base = 1;
+#endif
+	codecContext->gop_size        = 10;
+
+	/* Get Codec from name */
+	codec = avcodec_find_encoder_by_name( codecName );
+	if ( codec == NULL ) {
+		Journal_Printf( errorStream, "Error in func %s for %s '%s' - Couldn't find codec '%s'. Available codecs are:\n",
+				__func__, self->type, self->name, codecName );
+
+		/* Go through linked list of all the codecs avaiable and print them out. */
+		Stream_Indent( errorStream );
+		for ( codec = first_avcodec ; codec != NULL ; codec = codec->next ) {
+			if ( codec->encode != NULL ) 
+				Journal_Printf( errorStream, "%s (id = %d)\n", codec->name, codec->id );
+		}
+		abort();
+	}
+
+	/* Open it */
+	if (avcodec_open(codecContext, codec) < 0) {
+		Journal_Printf( errorStream, "Error in func %s for %s '%s' - Cannot open codec '%s'.\n", 
+				__func__, self->type, self->name, codecName );
+		abort();
+	}
+
+	/* Open Output File */
+	Stg_asprintf( &filename, "%s/%s.mpeg", outputPath, window->name );
+	self->stream = Journal_MyStream( Dump_Type, self );
+	
+	if(!loadFromCheckPoint)
+		Stream_RedirectFile( self->stream, filename );
+	else
+		Stream_AppendFile( self->stream, filename );
+
+	Memory_Free( filename );
+
+	/* Create 'frame' data structure */
+	frame = self->frame = avcodec_alloc_frame();
+	frame->data[0] = Memory_Alloc_Array( unsigned char, pixelCount, "Y" );
+	frame->data[1] = Memory_Alloc_Array( unsigned char, pixelCount/4, "Cr" );
+	frame->data[2] = Memory_Alloc_Array( unsigned char, pixelCount/4, "Cb" );
+
+	frame->linesize[0] = width;
+	frame->linesize[1] = width / 2; 
+	frame->linesize[2] = width / 2;
+
+	/* Create output buffer which is what we write to the file for each frame */
+	self->outputBuffer = Memory_Alloc_Bytes(MAX_BUFFER_SIZE,char, "outputBufferForFrame");
+}
+
+void _lucEncoderLibavcodec_Delete( void* outputFormat ) {
+	lucEncoderLibavcodec*  self              = (lucEncoderLibavcodec*) outputFormat;
+	AVFrame*               frame             = (AVFrame*) self->frame;
+	uint8_t                endCodeSequence[] = { 0x00, 0x00, 0x01, 0xb7 };
+	int                    sizeToWrite;
+
+
+	/* Write the delayed frames to the file */
+	do {
+		sizeToWrite = avcodec_encode_video(self->codecContext, self->outputBuffer, MAX_BUFFER_SIZE, NULL);
+		Journal_Write( self->stream, self->outputBuffer, sizeToWrite, 1 );
+	} while ( sizeToWrite != 0 );
+	
+	/* Write the end code sequence to get a real mpeg file */
+	Journal_Write( self->stream, endCodeSequence, 4, 1 );
+
+	/* Free Memory */
+	Memory_Free( frame->data[0] );
+	Memory_Free( frame->data[1] );
+	Memory_Free( frame->data[2] );
+	Memory_Free( frame );
+	Memory_Free( self->codecContext );
+	Memory_Free( self->outputBuffer );
+
+	_lucOutputFormat_Delete( self );
+}
+
+void _lucEncoderLibavcodec_Print( void* outputFormat, Stream* stream ) {
+	lucEncoderLibavcodec*  self = (lucEncoderLibavcodec*) outputFormat;
+
+	_lucOutputFormat_Print( self, stream );
+}
+
+void* _lucEncoderLibavcodec_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucEncoderLibavcodec*  self = (lucEncoderLibavcodec*)outputFormat;
+	lucEncoderLibavcodec* newOutputFormat;
+
+	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newOutputFormat;
+}
+
+
+void* _lucEncoderLibavcodec_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucEncoderLibavcodec);
+	Type                                                      type = lucEncoderLibavcodec_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucEncoderLibavcodec_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucEncoderLibavcodec_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucEncoderLibavcodec_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucEncoderLibavcodec_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucEncoderLibavcodec_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucEncoderLibavcodec_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucEncoderLibavcodec_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucEncoderLibavcodec_Destroy;
+	lucOutputFormat_OutputFunction*                        _output = _lucEncoderLibavcodec_Output;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucEncoderLibavcodec_New(  LUCENCODERLIBAVCODEC_PASSARGS  );
+}
+
+void _lucEncoderLibavcodec_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucEncoderLibavcodec*  self = (lucEncoderLibavcodec*)outputFormat;
+	lucWindow*          window;
+	AbstractContext*    context;
+
+	/* Construct Parent */
+	lucOutputFormat_InitAll( self, "mpeg" );
+
+	window =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Window", lucWindow, True, data   ) ;
+	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ) ;
+        
+	_lucEncoderLibavcodec_Init( 
+			self,
+			window,
+			context->outputPath,
+			context->loadFromCheckPoint,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"codec", "mpeg1video"  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"frameRate", 25  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"bitRate", 400000 ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"includeFrame0", False)
+			 );
+}
+
+void _lucEncoderLibavcodec_Build( void* outputFormat, void* data ) {}
+void _lucEncoderLibavcodec_Initialise( void* outputFormat, void* data ) {}
+void _lucEncoderLibavcodec_Execute( void* outputFormat, void* data ) {}
+void _lucEncoderLibavcodec_Destroy( void* outputFormat, void* data ) {}
+
+void _lucEncoderLibavcodec_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucEncoderLibavcodec*         self            = (lucEncoderLibavcodec*) outputFormat;
+	AVFrame*                      frame           = (AVFrame*) self->frame;
+	Pixel_Index                   width           = window->width;
+	Pixel_Index                   height          = window->height;
+	Pixel_Index                   pixel_I;
+	Pixel_Index                   xPixel_I;
+	Pixel_Index                   yPixel_I;
+	unsigned char*                macroPixel0;
+	unsigned char*                macroPixel1;
+	unsigned char*                macroPixel2;
+	unsigned char*                macroPixel3;
+	float                         red, green, blue;
+	int                           sizeToWrite;
+
+	/* Setup the 'Y' part of the frame */
+	for ( yPixel_I = 0 ; yPixel_I < height ; yPixel_I++ ) {
+		for ( xPixel_I = 0 ; xPixel_I < width ; xPixel_I++ ) {
+			pixel_I = (height - yPixel_I - 1) * width + xPixel_I;
+			
+			red   = (float) pixelData[pixel_I][0];
+			green = (float) pixelData[pixel_I][1];
+			blue  = (float) pixelData[pixel_I][2];
+
+			frame->data[0][yPixel_I * frame->linesize[0] + xPixel_I] = 
+				(unsigned char)((0.257 * red) + (0.504 * green) + (0.098 * blue) + 16);
+		}
+	}
+
+	/* Setup the 'Cb (U)' and 'Cr (V)' part of the frame 
+	 * loop over macro pixels - pixels twice the size as the normal ones */
+	for ( yPixel_I = 0 ; yPixel_I < height/2 ; yPixel_I++ ) {
+		for ( xPixel_I = 0 ; xPixel_I < width/2 ; xPixel_I++ ) {
+			/* Find Four pixels in this macro pixel */
+			macroPixel0 = pixelData[ (height - yPixel_I*2 - 1) * width + xPixel_I * 2 ];
+			macroPixel1 = pixelData[ (height - yPixel_I*2 - 1) * width + xPixel_I * 2 + 1 ];
+			macroPixel2 = pixelData[ (height - yPixel_I*2 - 2) * width + xPixel_I * 2 ];
+			macroPixel3 = pixelData[ (height - yPixel_I*2 - 2) * width + xPixel_I * 2 + 1 ];
+
+			/* Average red, green and blue for four pixels around point */
+			red   = 0.25 * ((float) (macroPixel0[0] + macroPixel1[0] + macroPixel2[0] + macroPixel3[0] ));
+			green = 0.25 * ((float) (macroPixel0[1] + macroPixel1[1] + macroPixel2[1] + macroPixel3[1] ));
+			blue  = 0.25 * ((float) (macroPixel0[2] + macroPixel1[2] + macroPixel2[2] + macroPixel3[2] ));
+
+			/* 'Cb (U)' Component */
+			frame->data[1][yPixel_I * frame->linesize[1] + xPixel_I] = 
+				(unsigned char) (-(0.148 * red) - (0.291 * green) + (0.439 * blue) + 128);
+
+			/* 'Cr (V)' Component */
+			frame->data[2][yPixel_I * frame->linesize[2] + xPixel_I] = 
+				(unsigned char) ((0.439 * red) - (0.368 * green) - (0.071 * blue) + 128);
+		}
+	}
+	
+	/* Write data to file */
+	/* Never write frame 0  if it's a restart. If it's a normal run, write it only if specified. */
+	if( context->timeStep == 0 ){
+		if( self->includeFrame0 && (!context->loadFromCheckPoint) ) {
+			sizeToWrite = avcodec_encode_video(self->codecContext, self->outputBuffer, MAX_BUFFER_SIZE, frame);
+			Journal_Write( self->stream, self->outputBuffer, sizeToWrite, 1 );
+		}
+	}
+
+	else{
+		sizeToWrite = avcodec_encode_video(self->codecContext, self->outputBuffer, MAX_BUFFER_SIZE, frame);
+		Journal_Write( self->stream, self->outputBuffer, sizeToWrite, 1 );
+	}
+}
+
+#endif /* HAVE_LIBAVCODEC */
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/EncoderLibfame.c
--- a/OutputFormats/src/EncoderLibfame.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,379 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: EncoderLibfame.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_LIBFAME
-
-#include <fame.h>
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "EncoderLibfame.h"
-
-#include <assert.h>
-#include <string.h>
-
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucEncoderLibfame_Type = "lucEncoderLibfame";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucEncoderLibfame* _lucEncoderLibfame_New(  LUCENCODERLIBFAME_DEFARGS  ) 
-{
-	lucEncoderLibfame*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucEncoderLibfame) );
-	self = (lucEncoderLibfame*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucEncoderLibfame_Init( 
-		lucEncoderLibfame*                                                self,
-		lucWindow*                                                        window,
-		char*                                                             outputPath,
-		Bool                                                             loadFromCheckPoint,
-		unsigned int                                                      keyframe,
-		unsigned int                                                      quality,
-		unsigned int                                                      framesPerSecond,
-		char*                                                             profile,
-		Bool                                                              includeFrame0)
-{
-
-	Pixel_Index              width      = window->width;
-	Pixel_Index              height     = window->height;
-	unsigned int numpixels, numbytes, quarterpixels, linebytes;
-	fame_context_t*          famecontext;
-	fame_parameters_t*       fameparameters;
-	fame_frame_statistics_t* famestatistics;
-	fame_object_t*           fameprofile;
-	fame_yuv_t*              fameyuv;
-	Name                     filename;
-	Index                    i;
-
-   /* Output should only run on root node */
-	if (self->context->rank != MASTER) return;
-
-	/* Initialise the inlcudeFrame0 parameter */
-	self->includeFrame0 = includeFrame0;
-
-	/* Check to make sure width and height of window are multiples of 16 */
-	Journal_Firewall( width % 16 == 0, lucError, "In func %s: Width %u is not multiple of 16.", __func__, width );
-	Journal_Firewall( height % 16 == 0, lucError, "In func %s: Height %u is not multiple of 16.", __func__, height );
-
-	lucOutputFormat_Register_Add( window->outputFormat_Register, self );
-
-	/* Setup paramaters on context */
-	numpixels = self->numpixels = width * height;
-	numbytes = self->numbytes = self->numpixels * 3;
-	linebytes = self->linebytes = width * 3;
-	quarterpixels = self->quarterpixels = self->numpixels / 4;
-
-	/* Allocate Memory */
-	fameparameters = self->fameparameters = Memory_Alloc( fame_parameters_t, "Fame Parameters" );
-	famestatistics = self->famestatistics = Memory_Alloc( fame_frame_statistics_t, "Fame Statistics" );
-	fameyuv = self->fameyuv = Memory_Alloc( fame_yuv_t, "Fame YUV" );
-	self->buffer = Memory_Alloc_Array( unsigned char , numbytes, "Buffer" );
-
-	/* Set up YUV */
-	fameyuv->w = width;
-	fameyuv->h = height;
-	fameyuv->p = 0;
-	fameyuv->y = Memory_Alloc_Array( unsigned char, numpixels, "Y" );
-	fameyuv->u = Memory_Alloc_Array( unsigned char, quarterpixels, "U" );
-	fameyuv->v = Memory_Alloc_Array( unsigned char, quarterpixels, "V" );
-
-	/* Setup keyframe */
-	self->coding = Memory_Alloc_Array( char, keyframe + 1, "Coding" );
-	sprintf( self->coding, "I" );
-	for ( i = 1 ; i < keyframe ; i++ )
-		strcat( self->coding, "P" );
-
-	/* Set up Fame Parameters */
-	memset(fameparameters, 0, sizeof(fame_parameters_t));
-	fameparameters->width = width;
-	fameparameters->height = height;
-	fameparameters->coding = self->coding;
-	fameparameters->quality = quality;
-	fameparameters->bitrate = 0;
-	fameparameters->slices_per_frame = 1;
-	fameparameters->frames_per_sequence = 0xffffffff;
-	fameparameters->frame_rate_num = framesPerSecond;
-	fameparameters->frame_rate_den = 1;
-	fameparameters->shape_quality = 100;
-	fameparameters->search_range = 0;
-	fameparameters->verbose = 0;
-	fameparameters->profile = self->profile = StG_Strdup( profile );
-	fameparameters->total_frames = 0;
-
-	/* Open Output File */
-	Stg_asprintf( &filename, "%s/%s.mpeg", outputPath, window->name );
-	
-	if(!loadFromCheckPoint ) 
-	    self->stream = fopen( filename, "w" );
-	else  {
-		self->stream = fopen( filename, "a" );
-	}
-	Memory_Free( filename );
-
-	/* Fame Initialisation */
-	famecontext = self->famecontext = fame_open();
-	fameprofile = self->fameprofile = fame_get_object(famecontext, fameparameters->profile );
-	fame_register(famecontext, "profile", fameprofile);
-	fame_init(famecontext, fameparameters, self->buffer, numbytes);
-}
-
-void _lucEncoderLibfame_Delete( void* outputFormat ) {
-	lucEncoderLibfame*  self         = (lucEncoderLibfame*)outputFormat;
-	unsigned int        framebytes;
-
-   /* Output should only run on root node */
-	if (self->context->rank == MASTER) {
-      /* Finish writing mpeg and close file*/
-      framebytes = fame_close(self->famecontext);
-      fwrite(self->buffer, framebytes, 1, self->stream);
-      fflush(self->stream);
-      fclose(self->stream);
-
-      /* Free Memory */
-      Memory_Free( self->fameyuv->y );
-      Memory_Free( self->fameyuv->u );
-      Memory_Free( self->fameyuv->v );
-
-      Memory_Free( self->fameyuv );
-      Memory_Free( self->famestatistics );
-      Memory_Free( self->fameparameters );
-      Memory_Free( self->buffer );
-      
-      Memory_Free( self->coding );
-      Memory_Free( self->profile );
-   }
-
-	_lucOutputFormat_Delete( self );
-}
-
-void _lucEncoderLibfame_Print( void* outputFormat, Stream* stream ) {
-	lucEncoderLibfame*  self = (lucEncoderLibfame*)outputFormat;
-
-	_lucOutputFormat_Print( self, stream );
-}
-
-void* _lucEncoderLibfame_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucEncoderLibfame*  self = (lucEncoderLibfame*)outputFormat;
-	lucEncoderLibfame* newOutputFormat;
-
-	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newOutputFormat;
-}
-
-
-void* _lucEncoderLibfame_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucEncoderLibfame);
-	Type                                                      type = lucEncoderLibfame_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucEncoderLibfame_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucEncoderLibfame_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucEncoderLibfame_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucEncoderLibfame_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucEncoderLibfame_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucEncoderLibfame_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucEncoderLibfame_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucEncoderLibfame_Destroy;
-	lucOutputFormat_OutputFunction*                        _output = _lucEncoderLibfame_Output;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucEncoderLibfame_New(  LUCENCODERLIBFAME_PASSARGS  );
-}
-
-void _lucEncoderLibfame_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucEncoderLibfame*  self = (lucEncoderLibfame*)outputFormat;
-	lucWindow*          window;
-	AbstractContext*    context;
-
-	/* Construct Parent */
-	_lucOutputFormat_AssignFromXML( outputFormat, cf, data);
-	lucOutputFormat_InitAll( self, "mpeg" );
-
-	window =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Window", lucWindow, True, data   ) ;
-	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ) ;
-
-	_lucEncoderLibfame_Init( 
-			self,
-			window,
-			context->outputPath,
-			context->loadFromCheckPoint,
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"keyframe", 4  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"quality", 93  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"framesPerSecond", 30  ),
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"profile", "profile/mpeg1"  ),
-			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"includeFrame0", False)  );
-}
-
-void _lucEncoderLibfame_Build( void* outputFormat, void* data ) {}
-void _lucEncoderLibfame_Initialise( void* outputFormat, void* data ) {}
-void _lucEncoderLibfame_Execute( void* outputFormat, void* data ) {}
-void _lucEncoderLibfame_Destroy( void* outputFormat, void* data ) {}
-
-void _lucEncoderLibfame_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucEncoderLibfame*            self            = (lucEncoderLibfame*) outputFormat;
-	Pixel_Index                   width           = window->width;
-	unsigned int                  quarterpixels   = self->quarterpixels;
-	unsigned int                  numpixels       = self->numpixels;
-	unsigned int                  numbytes        = self->numbytes;
-	unsigned int                  linebytes       = self->linebytes;
-	fame_context_t*               famecontext     = self->famecontext;
-	fame_yuv_t*                   fameyuv         = self->fameyuv;
-	fame_frame_statistics_t*      famestatistics  = self->famestatistics; 
-	unsigned int                  i, j, k, tmp;
-	int                           framebytes;
-	unsigned char                 red, green, blue;
-	unsigned char*                rgbframe        = (unsigned char*) pixelData;
-
-
-    /* preparing yuv12 format */
-    memset(fameyuv->y, numpixels, 0);
-    memset(fameyuv->u, quarterpixels, 0);
-    memset(fameyuv->v, quarterpixels, 0);
-
-    i = 0;   //position in yuv.
-    j = numpixels - (width*2);   //position in rgb.
-    k = 0;   //position in scanline.
-    while(i < quarterpixels) {
-		tmp = j*3;
-		
-		red = (rgbframe[tmp] + rgbframe[tmp+3] + rgbframe[tmp+linebytes]
-			+ rgbframe[tmp+linebytes+3]) / 4;
-		green = (rgbframe[tmp+1] + rgbframe[tmp+4]
-			+ rgbframe[tmp+linebytes+1] + rgbframe[tmp+linebytes+4]) / 4;
-		blue = (rgbframe[tmp+2] + rgbframe[tmp+5]
-			+ rgbframe[tmp+linebytes+2] + rgbframe[tmp+linebytes+5]) / 4;
-			
-		fameyuv->u[i] = ((-38*red-74*green+112*blue+128)>>8)+128;
-		fameyuv->v[i] = ((112*red-94*green-18*blue+128)>>8)+128;
-		
-		j += 2;
-		k += 2;
-		
-		if(k == width) {
-			k = 0;
-			j -= (width*3);
-		}
-	
-		i++;
-	}
-
-    i = 0;
-    j = numpixels - width;
-    k = 0;
-    while(i < numbytes) {
-		red = rgbframe[i];
-		green = rgbframe[i+1];
-		blue = rgbframe[i+2];
-		
-		fameyuv->y[j] = ((66*red+129*green+25*blue+128)>>8)+16;
-		
-		j++;
-		k++;
-		if(k == width) {
-			k = 0;
-			j -= (width*2);
-		}
-		i += 3;
-	}
-	
-	/* Encode and Write frame 0 only if includeFrame0 is True and not in restart mode */
-
-	if( context->timeStep == 0 ){
-		if( self->includeFrame0 && (!context->loadFromCheckPoint) ) {	
-			/* Initialise memory */
-			memset(self->buffer,0, self->numbytes);
-			memset(famestatistics, 0, sizeof(fame_frame_statistics_t));
-			
-			/* Encode */
-			fame_start_frame(famecontext, fameyuv, NULL);
-			framebytes = fame_encode_slice(famecontext);
-			fame_end_frame(famecontext, famestatistics);
-			
-			/* Write encoded data to file */
-			fwrite(self->buffer, framebytes, 1, self->stream);
-			fflush(self->stream);
-		}	
-	}
-	else{
-		/* Initialise memory */
-		memset(self->buffer,0, self->numbytes);
-		memset(famestatistics, 0, sizeof(fame_frame_statistics_t));
-		
-		/* Encode */
-		fame_start_frame(famecontext, fameyuv, NULL);
-		framebytes = fame_encode_slice(famecontext);
-		fame_end_frame(famecontext, famestatistics);
-			
-		/* Write encoded data to file */
-		fwrite(self->buffer, framebytes, 1, self->stream);
-		fflush(self->stream);
-	}
-}
-
-#endif /* HAVE_LIBFAME */
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/EncoderLibfame.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/EncoderLibfame.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,379 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: EncoderLibfame.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_LIBFAME
+
+#include <fame.h>
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "EncoderLibfame.h"
+
+#include <assert.h>
+#include <string.h>
+
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucEncoderLibfame_Type = "lucEncoderLibfame";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucEncoderLibfame* _lucEncoderLibfame_New(  LUCENCODERLIBFAME_DEFARGS  ) 
+{
+	lucEncoderLibfame*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucEncoderLibfame) );
+	self = (lucEncoderLibfame*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucEncoderLibfame_Init( 
+		lucEncoderLibfame*                                                self,
+		lucWindow*                                                        window,
+		char*                                                             outputPath,
+		Bool                                                             loadFromCheckPoint,
+		unsigned int                                                      keyframe,
+		unsigned int                                                      quality,
+		unsigned int                                                      framesPerSecond,
+		char*                                                             profile,
+		Bool                                                              includeFrame0)
+{
+
+	Pixel_Index              width      = window->width;
+	Pixel_Index              height     = window->height;
+	unsigned int numpixels, numbytes, quarterpixels, linebytes;
+	fame_context_t*          famecontext;
+	fame_parameters_t*       fameparameters;
+	fame_frame_statistics_t* famestatistics;
+	fame_object_t*           fameprofile;
+	fame_yuv_t*              fameyuv;
+	Name                     filename;
+	Index                    i;
+
+   /* Output should only run on root node */
+	if (self->context->rank != MASTER) return;
+
+	/* Initialise the inlcudeFrame0 parameter */
+	self->includeFrame0 = includeFrame0;
+
+	/* Check to make sure width and height of window are multiples of 16 */
+	Journal_Firewall( width % 16 == 0, lucError, "In func %s: Width %u is not multiple of 16.", __func__, width );
+	Journal_Firewall( height % 16 == 0, lucError, "In func %s: Height %u is not multiple of 16.", __func__, height );
+
+	lucOutputFormat_Register_Add( window->outputFormat_Register, self );
+
+	/* Setup paramaters on context */
+	numpixels = self->numpixels = width * height;
+	numbytes = self->numbytes = self->numpixels * 3;
+	linebytes = self->linebytes = width * 3;
+	quarterpixels = self->quarterpixels = self->numpixels / 4;
+
+	/* Allocate Memory */
+	fameparameters = self->fameparameters = Memory_Alloc( fame_parameters_t, "Fame Parameters" );
+	famestatistics = self->famestatistics = Memory_Alloc( fame_frame_statistics_t, "Fame Statistics" );
+	fameyuv = self->fameyuv = Memory_Alloc( fame_yuv_t, "Fame YUV" );
+	self->buffer = Memory_Alloc_Array( unsigned char , numbytes, "Buffer" );
+
+	/* Set up YUV */
+	fameyuv->w = width;
+	fameyuv->h = height;
+	fameyuv->p = 0;
+	fameyuv->y = Memory_Alloc_Array( unsigned char, numpixels, "Y" );
+	fameyuv->u = Memory_Alloc_Array( unsigned char, quarterpixels, "U" );
+	fameyuv->v = Memory_Alloc_Array( unsigned char, quarterpixels, "V" );
+
+	/* Setup keyframe */
+	self->coding = Memory_Alloc_Array( char, keyframe + 1, "Coding" );
+	sprintf( self->coding, "I" );
+	for ( i = 1 ; i < keyframe ; i++ )
+		strcat( self->coding, "P" );
+
+	/* Set up Fame Parameters */
+	memset(fameparameters, 0, sizeof(fame_parameters_t));
+	fameparameters->width = width;
+	fameparameters->height = height;
+	fameparameters->coding = self->coding;
+	fameparameters->quality = quality;
+	fameparameters->bitrate = 0;
+	fameparameters->slices_per_frame = 1;
+	fameparameters->frames_per_sequence = 0xffffffff;
+	fameparameters->frame_rate_num = framesPerSecond;
+	fameparameters->frame_rate_den = 1;
+	fameparameters->shape_quality = 100;
+	fameparameters->search_range = 0;
+	fameparameters->verbose = 0;
+	fameparameters->profile = self->profile = StG_Strdup( profile );
+	fameparameters->total_frames = 0;
+
+	/* Open Output File */
+	Stg_asprintf( &filename, "%s/%s.mpeg", outputPath, window->name );
+	
+	if(!loadFromCheckPoint ) 
+	    self->stream = fopen( filename, "w" );
+	else  {
+		self->stream = fopen( filename, "a" );
+	}
+	Memory_Free( filename );
+
+	/* Fame Initialisation */
+	famecontext = self->famecontext = fame_open();
+	fameprofile = self->fameprofile = fame_get_object(famecontext, fameparameters->profile );
+	fame_register(famecontext, "profile", fameprofile);
+	fame_init(famecontext, fameparameters, self->buffer, numbytes);
+}
+
+void _lucEncoderLibfame_Delete( void* outputFormat ) {
+	lucEncoderLibfame*  self         = (lucEncoderLibfame*)outputFormat;
+	unsigned int        framebytes;
+
+   /* Output should only run on root node */
+	if (self->context->rank == MASTER) {
+      /* Finish writing mpeg and close file*/
+      framebytes = fame_close(self->famecontext);
+      fwrite(self->buffer, framebytes, 1, self->stream);
+      fflush(self->stream);
+      fclose(self->stream);
+
+      /* Free Memory */
+      Memory_Free( self->fameyuv->y );
+      Memory_Free( self->fameyuv->u );
+      Memory_Free( self->fameyuv->v );
+
+      Memory_Free( self->fameyuv );
+      Memory_Free( self->famestatistics );
+      Memory_Free( self->fameparameters );
+      Memory_Free( self->buffer );
+      
+      Memory_Free( self->coding );
+      Memory_Free( self->profile );
+   }
+
+	_lucOutputFormat_Delete( self );
+}
+
+void _lucEncoderLibfame_Print( void* outputFormat, Stream* stream ) {
+	lucEncoderLibfame*  self = (lucEncoderLibfame*)outputFormat;
+
+	_lucOutputFormat_Print( self, stream );
+}
+
+void* _lucEncoderLibfame_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucEncoderLibfame*  self = (lucEncoderLibfame*)outputFormat;
+	lucEncoderLibfame* newOutputFormat;
+
+	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newOutputFormat;
+}
+
+
+void* _lucEncoderLibfame_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucEncoderLibfame);
+	Type                                                      type = lucEncoderLibfame_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucEncoderLibfame_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucEncoderLibfame_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucEncoderLibfame_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucEncoderLibfame_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucEncoderLibfame_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucEncoderLibfame_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucEncoderLibfame_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucEncoderLibfame_Destroy;
+	lucOutputFormat_OutputFunction*                        _output = _lucEncoderLibfame_Output;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucEncoderLibfame_New(  LUCENCODERLIBFAME_PASSARGS  );
+}
+
+void _lucEncoderLibfame_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucEncoderLibfame*  self = (lucEncoderLibfame*)outputFormat;
+	lucWindow*          window;
+	AbstractContext*    context;
+
+	/* Construct Parent */
+	_lucOutputFormat_AssignFromXML( outputFormat, cf, data);
+	lucOutputFormat_InitAll( self, "mpeg" );
+
+	window =  Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"Window", lucWindow, True, data   ) ;
+	context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data  ) ;
+
+	_lucEncoderLibfame_Init( 
+			self,
+			window,
+			context->outputPath,
+			context->loadFromCheckPoint,
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"keyframe", 4  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"quality", 93  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"framesPerSecond", 30  ),
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"profile", "profile/mpeg1"  ),
+			Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"includeFrame0", False)  );
+}
+
+void _lucEncoderLibfame_Build( void* outputFormat, void* data ) {}
+void _lucEncoderLibfame_Initialise( void* outputFormat, void* data ) {}
+void _lucEncoderLibfame_Execute( void* outputFormat, void* data ) {}
+void _lucEncoderLibfame_Destroy( void* outputFormat, void* data ) {}
+
+void _lucEncoderLibfame_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucEncoderLibfame*            self            = (lucEncoderLibfame*) outputFormat;
+	Pixel_Index                   width           = window->width;
+	unsigned int                  quarterpixels   = self->quarterpixels;
+	unsigned int                  numpixels       = self->numpixels;
+	unsigned int                  numbytes        = self->numbytes;
+	unsigned int                  linebytes       = self->linebytes;
+	fame_context_t*               famecontext     = self->famecontext;
+	fame_yuv_t*                   fameyuv         = self->fameyuv;
+	fame_frame_statistics_t*      famestatistics  = self->famestatistics; 
+	unsigned int                  i, j, k, tmp;
+	int                           framebytes;
+	unsigned char                 red, green, blue;
+	unsigned char*                rgbframe        = (unsigned char*) pixelData;
+
+
+    /* preparing yuv12 format */
+    memset(fameyuv->y, numpixels, 0);
+    memset(fameyuv->u, quarterpixels, 0);
+    memset(fameyuv->v, quarterpixels, 0);
+
+    i = 0;   //position in yuv.
+    j = numpixels - (width*2);   //position in rgb.
+    k = 0;   //position in scanline.
+    while(i < quarterpixels) {
+		tmp = j*3;
+		
+		red = (rgbframe[tmp] + rgbframe[tmp+3] + rgbframe[tmp+linebytes]
+			+ rgbframe[tmp+linebytes+3]) / 4;
+		green = (rgbframe[tmp+1] + rgbframe[tmp+4]
+			+ rgbframe[tmp+linebytes+1] + rgbframe[tmp+linebytes+4]) / 4;
+		blue = (rgbframe[tmp+2] + rgbframe[tmp+5]
+			+ rgbframe[tmp+linebytes+2] + rgbframe[tmp+linebytes+5]) / 4;
+			
+		fameyuv->u[i] = ((-38*red-74*green+112*blue+128)>>8)+128;
+		fameyuv->v[i] = ((112*red-94*green-18*blue+128)>>8)+128;
+		
+		j += 2;
+		k += 2;
+		
+		if(k == width) {
+			k = 0;
+			j -= (width*3);
+		}
+	
+		i++;
+	}
+
+    i = 0;
+    j = numpixels - width;
+    k = 0;
+    while(i < numbytes) {
+		red = rgbframe[i];
+		green = rgbframe[i+1];
+		blue = rgbframe[i+2];
+		
+		fameyuv->y[j] = ((66*red+129*green+25*blue+128)>>8)+16;
+		
+		j++;
+		k++;
+		if(k == width) {
+			k = 0;
+			j -= (width*2);
+		}
+		i += 3;
+	}
+	
+	/* Encode and Write frame 0 only if includeFrame0 is True and not in restart mode */
+
+	if( context->timeStep == 0 ){
+		if( self->includeFrame0 && (!context->loadFromCheckPoint) ) {	
+			/* Initialise memory */
+			memset(self->buffer,0, self->numbytes);
+			memset(famestatistics, 0, sizeof(fame_frame_statistics_t));
+			
+			/* Encode */
+			fame_start_frame(famecontext, fameyuv, NULL);
+			framebytes = fame_encode_slice(famecontext);
+			fame_end_frame(famecontext, famestatistics);
+			
+			/* Write encoded data to file */
+			fwrite(self->buffer, framebytes, 1, self->stream);
+			fflush(self->stream);
+		}	
+	}
+	else{
+		/* Initialise memory */
+		memset(self->buffer,0, self->numbytes);
+		memset(famestatistics, 0, sizeof(fame_frame_statistics_t));
+		
+		/* Encode */
+		fame_start_frame(famecontext, fameyuv, NULL);
+		framebytes = fame_encode_slice(famecontext);
+		fame_end_frame(famecontext, famestatistics);
+			
+		/* Write encoded data to file */
+		fwrite(self->buffer, framebytes, 1, self->stream);
+		fflush(self->stream);
+	}
+}
+
+#endif /* HAVE_LIBFAME */
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/Finalise.c
--- a/OutputFormats/src/Finalise.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool lucOutputFormats_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/Finalise.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,60 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool lucOutputFormats_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/Init.c
--- a/OutputFormats/src/Init.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Init.c 768 2008-04-21 03:20:07Z JohnMansour $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-
-#include "OutputFormats.h"
-#ifdef HAVE_LIBAVCODEC
-	#include "ffmpeg/avcodec.h"
-#endif
-
-Bool lucOutputFormats_Init() {
-	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-
-	Stg_ComponentRegister_Add( componentRegister, lucOutputPPM_Type, (Name)"0", _lucOutputPPM_DefaultNew  );
-	RegisterParent( lucOutputPPM_Type,         lucOutputFormat_Type );
-
-	#ifdef HAVE_GL2PS
-	  Stg_ComponentRegister_Add( componentRegister, lucOutputVECTOR_Type, (Name)"0", _lucOutputVECTOR_DefaultNew  );
-	  RegisterParent( lucOutputVECTOR_Type,         lucOutputFormat_Type );
-	#endif
-
-	#ifdef HAVE_LIBPNG
-	   Stg_ComponentRegister_Add( componentRegister, lucOutputPNG_Type, (Name)"0", _lucOutputPNG_DefaultNew  );
-	   RegisterParent( lucOutputPNG_Type,         lucOutputFormat_Type );
-	#endif	
-	
-	#ifdef HAVE_LIBJPEG
-    	Stg_ComponentRegister_Add( componentRegister, lucOutputJPEG_Type, (Name)"0", _lucOutputJPEG_DefaultNew  );
-    	RegisterParent( lucOutputJPEG_Type,        lucOutputFormat_Type );
-    #endif
-    
-    #ifdef HAVE_TIFF
-    	Stg_ComponentRegister_Add( componentRegister, lucOutputTIFF_Type, (Name)"0", _lucOutputTIFF_DefaultNew  );
-    	RegisterParent( lucOutputTIFF_Type,        lucOutputFormat_Type );
-    #endif
-    
-    #ifdef HAVE_LIBFAME	
-    	Stg_ComponentRegister_Add( componentRegister, lucEncoderLibfame_Type, (Name)"0", _lucEncoderLibfame_DefaultNew  );
-    	RegisterParent( lucEncoderLibfame_Type,    lucOutputFormat_Type );
-    #endif
-    
-    #ifdef HAVE_LIBAVCODEC	
-    	Stg_ComponentRegister_Add( componentRegister, lucEncoderLibavcodec_Type, (Name)"0", _lucEncoderLibavcodec_DefaultNew  );
-    	RegisterParent( lucEncoderLibavcodec_Type,    lucOutputFormat_Type );
-		avcodec_init();
-		avcodec_register_all();
-    #endif
-
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/Init.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,99 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Init.c 768 2008-04-21 03:20:07Z JohnMansour $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+
+#include "OutputFormats.h"
+#ifdef HAVE_LIBAVCODEC
+	#include "ffmpeg/avcodec.h"
+#endif
+
+Bool lucOutputFormats_Init() {
+	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+
+	Stg_ComponentRegister_Add( componentRegister, lucOutputPPM_Type, (Name)"0", _lucOutputPPM_DefaultNew  );
+	RegisterParent( lucOutputPPM_Type,         lucOutputFormat_Type );
+
+	#ifdef HAVE_GL2PS
+	  Stg_ComponentRegister_Add( componentRegister, lucOutputVECTOR_Type, (Name)"0", _lucOutputVECTOR_DefaultNew  );
+	  RegisterParent( lucOutputVECTOR_Type,         lucOutputFormat_Type );
+	#endif
+
+	#ifdef HAVE_LIBPNG
+	   Stg_ComponentRegister_Add( componentRegister, lucOutputPNG_Type, (Name)"0", _lucOutputPNG_DefaultNew  );
+	   RegisterParent( lucOutputPNG_Type,         lucOutputFormat_Type );
+	#endif	
+	
+	#ifdef HAVE_LIBJPEG
+    	Stg_ComponentRegister_Add( componentRegister, lucOutputJPEG_Type, (Name)"0", _lucOutputJPEG_DefaultNew  );
+    	RegisterParent( lucOutputJPEG_Type,        lucOutputFormat_Type );
+    #endif
+    
+    #ifdef HAVE_TIFF
+    	Stg_ComponentRegister_Add( componentRegister, lucOutputTIFF_Type, (Name)"0", _lucOutputTIFF_DefaultNew  );
+    	RegisterParent( lucOutputTIFF_Type,        lucOutputFormat_Type );
+    #endif
+    
+    #ifdef HAVE_LIBFAME	
+    	Stg_ComponentRegister_Add( componentRegister, lucEncoderLibfame_Type, (Name)"0", _lucEncoderLibfame_DefaultNew  );
+    	RegisterParent( lucEncoderLibfame_Type,    lucOutputFormat_Type );
+    #endif
+    
+    #ifdef HAVE_LIBAVCODEC	
+    	Stg_ComponentRegister_Add( componentRegister, lucEncoderLibavcodec_Type, (Name)"0", _lucEncoderLibavcodec_DefaultNew  );
+    	RegisterParent( lucEncoderLibavcodec_Type,    lucOutputFormat_Type );
+		avcodec_init();
+		avcodec_register_all();
+    #endif
+
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputJPEG.c
--- a/OutputFormats/src/OutputJPEG.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OutputJPEG.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_LIBJPEG
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "OutputJPEG.h"
-
-#include <assert.h>
-#include <string.h>
-
-#include <jpeglib.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucOutputJPEG_Type = "lucOutputJPEG";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucOutputJPEG* _lucOutputJPEG_New(  LUCOUTPUTJPEG_DEFARGS  ) 
-{
-	lucOutputJPEG*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucOutputJPEG) );
-	self = (lucOutputJPEG*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucOutputJPEG_Init( 
-		lucOutputJPEG*                                                self,
-		int                                                           quality )
-{
-	self->quality = quality;
-
-	assert ( quality >= 0 && quality <= 100 );
-}
-
-void _lucOutputJPEG_Delete( void* outputFormat ) {
-	lucOutputJPEG*  self = (lucOutputJPEG*)outputFormat;
-
-	_lucOutputFormat_Delete( self );
-}
-
-void _lucOutputJPEG_Print( void* outputFormat, Stream* stream ) {
-	lucOutputJPEG*  self = (lucOutputJPEG*)outputFormat;
-
-	_lucOutputFormat_Print( self, stream );
-}
-
-void* _lucOutputJPEG_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucOutputJPEG*  self = (lucOutputJPEG*)outputFormat;
-	lucOutputJPEG* newOutputFormat;
-
-	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newOutputFormat;
-}
-
-
-void* _lucOutputJPEG_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucOutputJPEG);
-	Type                                                      type = lucOutputJPEG_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucOutputJPEG_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucOutputJPEG_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputJPEG_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucOutputJPEG_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucOutputJPEG_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputJPEG_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucOutputJPEG_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucOutputJPEG_Destroy;
-	lucOutputFormat_OutputFunction*                        _output = _lucOutputJPEG_Output;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucOutputJPEG_New(  LUCOUTPUTJPEG_PASSARGS  );
-}
-
-void _lucOutputJPEG_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucOutputJPEG*  self = (lucOutputJPEG*)outputFormat;
-
-	/* Construct Parent */
-	lucOutputFormat_InitAll( self, "jpeg" );
-
-	_lucOutputJPEG_Init( 
-			self,
-			Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"quality", 93 )  );
-}
-
-void _lucOutputJPEG_Build( void* outputFormat, void* data ) {}
-void _lucOutputJPEG_Initialise( void* outputFormat, void* data ) {}
-void _lucOutputJPEG_Execute( void* outputFormat, void* data ) {}
-void _lucOutputJPEG_Destroy( void* outputFormat, void* data ) {}
-
-void _lucOutputJPEG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucOutputJPEG*              self         = (lucOutputJPEG*) outputFormat;
-	Pixel_Index                 width        = window->width;
-	Pixel_Index                 height       = window->height;
-	int                         rowStride    = (width * 3 + 3) & ~0x3;
-	unsigned char*              pixels       = (unsigned char*) pixelData;
-	FILE*                       file         = lucOutputFormat_OpenFile( self, window, context, "wb" );
-	struct jpeg_compress_struct cinfo;
-	struct jpeg_error_mgr       jerr;
-    JSAMPROW                    row;
-
-	cinfo.err = jpeg_std_error(&jerr);
-	jpeg_create_compress(&cinfo);
-
-	jpeg_stdio_dest(&cinfo, file);
-
-	cinfo.image_width = width;
-	cinfo.image_height = height;
-	cinfo.input_components = 3;
-	cinfo.in_color_space = JCS_RGB;
-
-	jpeg_set_defaults(&cinfo);
-	jpeg_set_quality(&cinfo, self->quality, TRUE);
-
-	jpeg_start_compress(&cinfo, TRUE);
-
-	while (cinfo.next_scanline < cinfo.image_height) {
-		row = &pixels[rowStride * (cinfo.image_height - cinfo.next_scanline - 1)];
-		jpeg_write_scanlines(&cinfo, &row, 1);
-	}
-	
-	jpeg_finish_compress(&cinfo);
-	fclose(file);
-	jpeg_destroy_compress(&cinfo);	
-}
-
-#endif
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputJPEG.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/OutputJPEG.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,187 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OutputJPEG.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_LIBJPEG
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "OutputJPEG.h"
+
+#include <assert.h>
+#include <string.h>
+
+#include <jpeglib.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucOutputJPEG_Type = "lucOutputJPEG";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucOutputJPEG* _lucOutputJPEG_New(  LUCOUTPUTJPEG_DEFARGS  ) 
+{
+	lucOutputJPEG*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucOutputJPEG) );
+	self = (lucOutputJPEG*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucOutputJPEG_Init( 
+		lucOutputJPEG*                                                self,
+		int                                                           quality )
+{
+	self->quality = quality;
+
+	assert ( quality >= 0 && quality <= 100 );
+}
+
+void _lucOutputJPEG_Delete( void* outputFormat ) {
+	lucOutputJPEG*  self = (lucOutputJPEG*)outputFormat;
+
+	_lucOutputFormat_Delete( self );
+}
+
+void _lucOutputJPEG_Print( void* outputFormat, Stream* stream ) {
+	lucOutputJPEG*  self = (lucOutputJPEG*)outputFormat;
+
+	_lucOutputFormat_Print( self, stream );
+}
+
+void* _lucOutputJPEG_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucOutputJPEG*  self = (lucOutputJPEG*)outputFormat;
+	lucOutputJPEG* newOutputFormat;
+
+	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newOutputFormat;
+}
+
+
+void* _lucOutputJPEG_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucOutputJPEG);
+	Type                                                      type = lucOutputJPEG_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucOutputJPEG_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucOutputJPEG_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputJPEG_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucOutputJPEG_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucOutputJPEG_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputJPEG_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucOutputJPEG_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucOutputJPEG_Destroy;
+	lucOutputFormat_OutputFunction*                        _output = _lucOutputJPEG_Output;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucOutputJPEG_New(  LUCOUTPUTJPEG_PASSARGS  );
+}
+
+void _lucOutputJPEG_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucOutputJPEG*  self = (lucOutputJPEG*)outputFormat;
+
+	/* Construct Parent */
+	lucOutputFormat_InitAll( self, "jpeg" );
+
+	_lucOutputJPEG_Init( 
+			self,
+			Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"quality", 93 )  );
+}
+
+void _lucOutputJPEG_Build( void* outputFormat, void* data ) {}
+void _lucOutputJPEG_Initialise( void* outputFormat, void* data ) {}
+void _lucOutputJPEG_Execute( void* outputFormat, void* data ) {}
+void _lucOutputJPEG_Destroy( void* outputFormat, void* data ) {}
+
+void _lucOutputJPEG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucOutputJPEG*              self         = (lucOutputJPEG*) outputFormat;
+	Pixel_Index                 width        = window->width;
+	Pixel_Index                 height       = window->height;
+	int                         rowStride    = (width * 3 + 3) & ~0x3;
+	unsigned char*              pixels       = (unsigned char*) pixelData;
+	FILE*                       file         = lucOutputFormat_OpenFile( self, window, context, "wb" );
+	struct jpeg_compress_struct cinfo;
+	struct jpeg_error_mgr       jerr;
+    JSAMPROW                    row;
+
+	cinfo.err = jpeg_std_error(&jerr);
+	jpeg_create_compress(&cinfo);
+
+	jpeg_stdio_dest(&cinfo, file);
+
+	cinfo.image_width = width;
+	cinfo.image_height = height;
+	cinfo.input_components = 3;
+	cinfo.in_color_space = JCS_RGB;
+
+	jpeg_set_defaults(&cinfo);
+	jpeg_set_quality(&cinfo, self->quality, TRUE);
+
+	jpeg_start_compress(&cinfo, TRUE);
+
+	while (cinfo.next_scanline < cinfo.image_height) {
+		row = &pixels[rowStride * (cinfo.image_height - cinfo.next_scanline - 1)];
+		jpeg_write_scanlines(&cinfo, &row, 1);
+	}
+	
+	jpeg_finish_compress(&cinfo);
+	fclose(file);
+	jpeg_destroy_compress(&cinfo);	
+}
+
+#endif
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputPNG.c
--- a/OutputFormats/src/OutputPNG.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OutputPNG.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#ifdef HAVE_LIBPNG
-
-#include <mpi.h>
-#include <png.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "OutputPNG.h"
-
-#include <assert.h>
-#include <string.h>
-
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucOutputPNG_Type = "lucOutputPNG";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucOutputPNG* _lucOutputPNG_New(  LUCOUTPUTPNG_DEFARGS  ) 
-{
-	lucOutputPNG*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucOutputPNG) );
-	self = (lucOutputPNG*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucOutputPNG_Init( 
-		lucOutputPNG*                                                self )
-{
-}
-
-void _lucOutputPNG_Delete( void* outputFormat ) {
-	lucOutputPNG*  self = (lucOutputPNG*)outputFormat;
-
-	_lucOutputFormat_Delete( self );
-}
-
-void _lucOutputPNG_Print( void* outputFormat, Stream* stream ) {
-	lucOutputPNG*  self = (lucOutputPNG*)outputFormat;
-
-	_lucOutputFormat_Print( self, stream );
-}
-
-void* _lucOutputPNG_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucOutputPNG*  self = (lucOutputPNG*)outputFormat;
-	lucOutputPNG* newOutputFormat;
-
-	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newOutputFormat;
-}
-
-
-void* _lucOutputPNG_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucOutputPNG);
-	Type                                                      type = lucOutputPNG_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucOutputPNG_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucOutputPNG_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputPNG_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucOutputPNG_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucOutputPNG_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputPNG_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucOutputPNG_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucOutputPNG_Destroy;
-	lucOutputFormat_OutputFunction*                        _output = _lucOutputPNG_Output;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucOutputPNG_New(  LUCOUTPUTPNG_PASSARGS  );
-}
-
-void _lucOutputPNG_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucOutputPNG*  self = (lucOutputPNG*)outputFormat;
-
-	/* Construct Parent */
-	lucOutputFormat_InitAll( self, "png" );
-
-	_lucOutputPNG_Init( self );
-}
-
-void _lucOutputPNG_Build( void* outputFormat, void* data ) {}
-void _lucOutputPNG_Initialise( void* outputFormat, void* data ) {}
-void _lucOutputPNG_Execute( void* outputFormat, void* data ) {}
-void _lucOutputPNG_Destroy( void* outputFormat, void* data ) {}
-
-/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
-#ifndef png_jmpbuf
-	#define png_jmpbuf(png_ptr) png_ptr->jmpbuf
-#endif
-
-
-void lucImagePNG_Write(png_structp png_ptr, png_bytep data, png_size_t length) {
-	Stream* stream = (Stream*) png_get_io_ptr(png_ptr);
-	
-	Journal_Write( stream, (void*) data, 1, length );
-}
-
-void _lucOutputPNG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucOutputPNG* self       = (lucOutputPNG*) outputFormat;
-	Pixel_Index   width        = window->width;
-	Pixel_Index   height       = window->height;
-	png_bytep     pixels       = (png_bytep) pixelData;
-	int           rowStride    = width * 3; /* Don't pad lines! pack alignment is set to 1 */
-	Stream*       stream       = lucOutputFormat_OpenStream( self, window, context );
-	png_bytep*    row_pointers = Memory_Alloc_Array( png_bytep, height, "Row Pointers" );
-	png_structp   pngWrite;
-	png_infop     pngInfo;
-	Pixel_Index   pixel_I;
-	int           result;
-	
-	for ( pixel_I = 0 ; pixel_I < height ; pixel_I++ )
-		row_pointers[pixel_I] = (png_bytep) &pixels[rowStride * (height - pixel_I - 1)];
-
-	pngWrite = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-	Journal_Firewall( pngWrite != NULL, lucError, "Cannot create PNG write struct.\n" );
-
-	pngInfo = png_create_info_struct(pngWrite);
-	Journal_Firewall( pngInfo != NULL, lucError, "Cannot create PNG info struct.\n" );
-
-	result = setjmp(png_jmpbuf(pngWrite));
-	Journal_Firewall( result == 0, lucError, "In func %s: setjmp failed.\n", __func__ );
-
-	png_set_write_fn(pngWrite, (void*) stream, lucImagePNG_Write, NULL);
-	png_set_compression_level(pngWrite, Z_BEST_COMPRESSION);
-	
-	png_set_IHDR(pngWrite, pngInfo,
-		width, height,
-		8,
-		PNG_COLOR_TYPE_RGB,
-		PNG_INTERLACE_NONE,
-		PNG_COMPRESSION_TYPE_DEFAULT,
-		PNG_FILTER_TYPE_DEFAULT);
-
-	png_write_info(pngWrite, pngInfo);
-	
-	png_write_image(pngWrite, row_pointers);
-	png_write_end(pngWrite, pngInfo);
-
-	/* Clean Up */
-	png_destroy_info_struct(pngWrite, &pngInfo);
-	png_destroy_write_struct(&pngWrite, NULL);
-	Memory_Free( row_pointers );
-	Stream_CloseFile( stream );	/* Release this file. Otherwise too many files will be opened at a time. */
-}
-
-#endif /* HAVE_PNG */
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputPNG.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/OutputPNG.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,204 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OutputPNG.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#ifdef HAVE_LIBPNG
+
+#include <mpi.h>
+#include <png.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "OutputPNG.h"
+
+#include <assert.h>
+#include <string.h>
+
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucOutputPNG_Type = "lucOutputPNG";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucOutputPNG* _lucOutputPNG_New(  LUCOUTPUTPNG_DEFARGS  ) 
+{
+	lucOutputPNG*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucOutputPNG) );
+	self = (lucOutputPNG*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucOutputPNG_Init( 
+		lucOutputPNG*                                                self )
+{
+}
+
+void _lucOutputPNG_Delete( void* outputFormat ) {
+	lucOutputPNG*  self = (lucOutputPNG*)outputFormat;
+
+	_lucOutputFormat_Delete( self );
+}
+
+void _lucOutputPNG_Print( void* outputFormat, Stream* stream ) {
+	lucOutputPNG*  self = (lucOutputPNG*)outputFormat;
+
+	_lucOutputFormat_Print( self, stream );
+}
+
+void* _lucOutputPNG_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucOutputPNG*  self = (lucOutputPNG*)outputFormat;
+	lucOutputPNG* newOutputFormat;
+
+	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newOutputFormat;
+}
+
+
+void* _lucOutputPNG_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucOutputPNG);
+	Type                                                      type = lucOutputPNG_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucOutputPNG_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucOutputPNG_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputPNG_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucOutputPNG_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucOutputPNG_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputPNG_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucOutputPNG_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucOutputPNG_Destroy;
+	lucOutputFormat_OutputFunction*                        _output = _lucOutputPNG_Output;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucOutputPNG_New(  LUCOUTPUTPNG_PASSARGS  );
+}
+
+void _lucOutputPNG_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucOutputPNG*  self = (lucOutputPNG*)outputFormat;
+
+	/* Construct Parent */
+	lucOutputFormat_InitAll( self, "png" );
+
+	_lucOutputPNG_Init( self );
+}
+
+void _lucOutputPNG_Build( void* outputFormat, void* data ) {}
+void _lucOutputPNG_Initialise( void* outputFormat, void* data ) {}
+void _lucOutputPNG_Execute( void* outputFormat, void* data ) {}
+void _lucOutputPNG_Destroy( void* outputFormat, void* data ) {}
+
+/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
+#ifndef png_jmpbuf
+	#define png_jmpbuf(png_ptr) png_ptr->jmpbuf
+#endif
+
+
+void lucImagePNG_Write(png_structp png_ptr, png_bytep data, png_size_t length) {
+	Stream* stream = (Stream*) png_get_io_ptr(png_ptr);
+	
+	Journal_Write( stream, (void*) data, 1, length );
+}
+
+void _lucOutputPNG_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucOutputPNG* self       = (lucOutputPNG*) outputFormat;
+	Pixel_Index   width        = window->width;
+	Pixel_Index   height       = window->height;
+	png_bytep     pixels       = (png_bytep) pixelData;
+	int           rowStride    = width * 3; /* Don't pad lines! pack alignment is set to 1 */
+	Stream*       stream       = lucOutputFormat_OpenStream( self, window, context );
+	png_bytep*    row_pointers = Memory_Alloc_Array( png_bytep, height, "Row Pointers" );
+	png_structp   pngWrite;
+	png_infop     pngInfo;
+	Pixel_Index   pixel_I;
+	int           result;
+	
+	for ( pixel_I = 0 ; pixel_I < height ; pixel_I++ )
+		row_pointers[pixel_I] = (png_bytep) &pixels[rowStride * (height - pixel_I - 1)];
+
+	pngWrite = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+	Journal_Firewall( pngWrite != NULL, lucError, "Cannot create PNG write struct.\n" );
+
+	pngInfo = png_create_info_struct(pngWrite);
+	Journal_Firewall( pngInfo != NULL, lucError, "Cannot create PNG info struct.\n" );
+
+	result = setjmp(png_jmpbuf(pngWrite));
+	Journal_Firewall( result == 0, lucError, "In func %s: setjmp failed.\n", __func__ );
+
+	png_set_write_fn(pngWrite, (void*) stream, lucImagePNG_Write, NULL);
+	png_set_compression_level(pngWrite, Z_BEST_COMPRESSION);
+	
+	png_set_IHDR(pngWrite, pngInfo,
+		width, height,
+		8,
+		PNG_COLOR_TYPE_RGB,
+		PNG_INTERLACE_NONE,
+		PNG_COMPRESSION_TYPE_DEFAULT,
+		PNG_FILTER_TYPE_DEFAULT);
+
+	png_write_info(pngWrite, pngInfo);
+	
+	png_write_image(pngWrite, row_pointers);
+	png_write_end(pngWrite, pngInfo);
+
+	/* Clean Up */
+	png_destroy_info_struct(pngWrite, &pngInfo);
+	png_destroy_write_struct(&pngWrite, NULL);
+	Memory_Free( row_pointers );
+	Stream_CloseFile( stream );	/* Release this file. Otherwise too many files will be opened at a time. */
+}
+
+#endif /* HAVE_PNG */
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputPPM.c
--- a/OutputFormats/src/OutputPPM.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OutputPPM.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "OutputPPM.h"
-
-#include <assert.h>
-#include <string.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucOutputPPM_Type = "lucOutputPPM";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucOutputPPM* _lucOutputPPM_New(  LUCOUTPUTPPM_DEFARGS  ) 
-{
-	lucOutputPPM*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucOutputPPM) );
-	self = (lucOutputPPM*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucOutputPPM_Init( 
-		lucOutputPPM*                                                self )
-{
-}
-
-void _lucOutputPPM_Delete( void* outputFormat ) {
-	lucOutputPPM*  self = (lucOutputPPM*)outputFormat;
-
-	_lucOutputFormat_Delete( self );
-}
-
-void _lucOutputPPM_Print( void* outputFormat, Stream* stream ) {
-	lucOutputPPM*  self = (lucOutputPPM*)outputFormat;
-
-	_lucOutputFormat_Print( self, stream );
-}
-
-void* _lucOutputPPM_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucOutputPPM*  self = (lucOutputPPM*)outputFormat;
-	lucOutputPPM* newOutputFormat;
-
-	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newOutputFormat;
-}
-
-
-void* _lucOutputPPM_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucOutputPPM);
-	Type                                                      type = lucOutputPPM_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucOutputPPM_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucOutputPPM_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputPPM_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucOutputPPM_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucOutputPPM_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputPPM_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucOutputPPM_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucOutputPPM_Destroy;
-	lucOutputFormat_OutputFunction*                        _output = _lucOutputPPM_Output;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucOutputPPM_New(  LUCOUTPUTPPM_PASSARGS  );
-}
-
-void _lucOutputPPM_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucOutputPPM*  self = (lucOutputPPM*)outputFormat;
-
-	/* Construct Parent */
-	lucOutputFormat_InitAll( self, "ppm" );
-
-	_lucOutputPPM_Init( self );
-}
-
-void _lucOutputPPM_Build( void* outputFormat, void* data ) {}
-void _lucOutputPPM_Initialise( void* outputFormat, void* data ) {}
-void _lucOutputPPM_Execute( void* outputFormat, void* data ) {}
-void _lucOutputPPM_Destroy( void* outputFormat, void* data ) {}
-
-void _lucOutputPPM_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucOutputPPM*  self         = (lucOutputPPM*)outputFormat;
-	Pixel_Index    windowWidth  = window->width;
-	Pixel_Index    windowHeight = window->height;
-	int            i, j;
-	Stream*        stream;
-	
-	/* Open file */
-	stream = lucOutputFormat_OpenStream( self, window, context );
-	Journal_Firewall( stream != NULL, lucError, "Can't open file\n");
-
-	/* Write header for PPM */
-	Journal_Printf( stream, "P6\n%d %d\n255\n", windowWidth, windowHeight);
-	
-	/* Write RGB info */
-	/* Top to bottom */
-	for ( j = windowHeight - 1 ; j >= 0 ; j--) 
-		for ( i = 0 ; i < windowWidth ; i++) 
-			Journal_Write( stream,  &pixelData[ windowWidth * j + i ], sizeof(lucPixel), 1 );
-
-	/* Bottom to Top */
-	/* Journal_Write( stream, pixelData, sizeof(lucPixel), windowWidth * windowHeight ); */
-
-	Stream_CloseFile( stream );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputPPM.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/OutputPPM.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,165 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OutputPPM.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "OutputPPM.h"
+
+#include <assert.h>
+#include <string.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucOutputPPM_Type = "lucOutputPPM";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucOutputPPM* _lucOutputPPM_New(  LUCOUTPUTPPM_DEFARGS  ) 
+{
+	lucOutputPPM*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucOutputPPM) );
+	self = (lucOutputPPM*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucOutputPPM_Init( 
+		lucOutputPPM*                                                self )
+{
+}
+
+void _lucOutputPPM_Delete( void* outputFormat ) {
+	lucOutputPPM*  self = (lucOutputPPM*)outputFormat;
+
+	_lucOutputFormat_Delete( self );
+}
+
+void _lucOutputPPM_Print( void* outputFormat, Stream* stream ) {
+	lucOutputPPM*  self = (lucOutputPPM*)outputFormat;
+
+	_lucOutputFormat_Print( self, stream );
+}
+
+void* _lucOutputPPM_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucOutputPPM*  self = (lucOutputPPM*)outputFormat;
+	lucOutputPPM* newOutputFormat;
+
+	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newOutputFormat;
+}
+
+
+void* _lucOutputPPM_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucOutputPPM);
+	Type                                                      type = lucOutputPPM_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucOutputPPM_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucOutputPPM_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputPPM_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucOutputPPM_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucOutputPPM_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputPPM_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucOutputPPM_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucOutputPPM_Destroy;
+	lucOutputFormat_OutputFunction*                        _output = _lucOutputPPM_Output;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucOutputPPM_New(  LUCOUTPUTPPM_PASSARGS  );
+}
+
+void _lucOutputPPM_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucOutputPPM*  self = (lucOutputPPM*)outputFormat;
+
+	/* Construct Parent */
+	lucOutputFormat_InitAll( self, "ppm" );
+
+	_lucOutputPPM_Init( self );
+}
+
+void _lucOutputPPM_Build( void* outputFormat, void* data ) {}
+void _lucOutputPPM_Initialise( void* outputFormat, void* data ) {}
+void _lucOutputPPM_Execute( void* outputFormat, void* data ) {}
+void _lucOutputPPM_Destroy( void* outputFormat, void* data ) {}
+
+void _lucOutputPPM_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucOutputPPM*  self         = (lucOutputPPM*)outputFormat;
+	Pixel_Index    windowWidth  = window->width;
+	Pixel_Index    windowHeight = window->height;
+	int            i, j;
+	Stream*        stream;
+	
+	/* Open file */
+	stream = lucOutputFormat_OpenStream( self, window, context );
+	Journal_Firewall( stream != NULL, lucError, "Can't open file\n");
+
+	/* Write header for PPM */
+	Journal_Printf( stream, "P6\n%d %d\n255\n", windowWidth, windowHeight);
+	
+	/* Write RGB info */
+	/* Top to bottom */
+	for ( j = windowHeight - 1 ; j >= 0 ; j--) 
+		for ( i = 0 ; i < windowWidth ; i++) 
+			Journal_Write( stream,  &pixelData[ windowWidth * j + i ], sizeof(lucPixel), 1 );
+
+	/* Bottom to Top */
+	/* Journal_Write( stream, pixelData, sizeof(lucPixel), windowWidth * windowHeight ); */
+
+	Stream_CloseFile( stream );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputTIFF.c
--- a/OutputFormats/src/OutputTIFF.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OutputTIFF.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_TIFF
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "OutputTIFF.h"
-
-#include <assert.h>
-#include <string.h>
-
-#include <tiff.h>
-#include <tiffio.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucOutputTIFF_Type = "lucOutputTIFF";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucOutputTIFF* _lucOutputTIFF_New(  LUCOUTPUTTIFF_DEFARGS  ) 
-{
-	lucOutputTIFF*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucOutputTIFF) );
-	self = (lucOutputTIFF*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucOutputTIFF_Init( 
-		lucOutputTIFF*                                                self )
-{
-}
-
-void _lucOutputTIFF_Delete( void* outputFormat ) {
-	lucOutputTIFF*  self = (lucOutputTIFF*)outputFormat;
-
-	_lucOutputFormat_Delete( self );
-}
-
-void _lucOutputTIFF_Print( void* outputFormat, Stream* stream ) {
-	lucOutputTIFF*  self = (lucOutputTIFF*)outputFormat;
-
-	_lucOutputFormat_Print( self, stream );
-}
-
-void* _lucOutputTIFF_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucOutputTIFF*  self = (lucOutputTIFF*)outputFormat;
-	lucOutputTIFF* newOutputFormat;
-
-	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newOutputFormat;
-}
-
-
-void* _lucOutputTIFF_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucOutputTIFF);
-	Type                                                      type = lucOutputTIFF_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucOutputTIFF_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucOutputTIFF_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputTIFF_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucOutputTIFF_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucOutputTIFF_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputTIFF_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucOutputTIFF_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucOutputTIFF_Destroy;
-	lucOutputFormat_OutputFunction*                        _output = _lucOutputTIFF_Output;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucOutputTIFF_New(  LUCOUTPUTTIFF_PASSARGS  );
-}
-
-void _lucOutputTIFF_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucOutputTIFF*  self = (lucOutputTIFF*)outputFormat;
-
-	/* Construct Parent */
-	lucOutputFormat_InitAll( self, "tiff" );
-
-	_lucOutputTIFF_Init( self );
-}
-
-void _lucOutputTIFF_Build( void* outputFormat, void* data ) {}
-void _lucOutputTIFF_Initialise( void* outputFormat, void* data ) {}
-void _lucOutputTIFF_Execute( void* outputFormat, void* data ) {}
-void _lucOutputTIFF_Destroy( void* outputFormat, void* data ) {}
-
-void _lucOutputTIFF_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucOutputTIFF*              self         = (lucOutputTIFF*) outputFormat;
-	Pixel_Index                 width        = window->width;
-	Pixel_Index                 height       = window->height;
-	Pixel_Index                 line_I;
-	TIFF*                       file;
-	Name                        filename;
-	lucPixel*                   linePtr;
-
-	/* Open File */
-	filename = lucOutputFormat_GetImageFilename( self, window, context );
-	file = TIFFOpen(filename, "w");
-	Journal_Firewall( file != NULL, lucError, "Cannot Open File %s\n", filename );
-	Memory_Free( filename );
-
-	TIFFSetField(file, TIFFTAG_IMAGEWIDTH, (uint32) width);
-	TIFFSetField(file, TIFFTAG_IMAGELENGTH, (uint32) height);
-	TIFFSetField(file, TIFFTAG_BITSPERSAMPLE, 8);
-	TIFFSetField(file, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS );
-	TIFFSetField(file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
-	TIFFSetField(file, TIFFTAG_SAMPLESPERPIXEL, 3);
-	TIFFSetField(file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
-	TIFFSetField(file, TIFFTAG_ROWSPERSTRIP, 1);
-	TIFFSetField(file, TIFFTAG_IMAGEDESCRIPTION, window->name );
-	
-	linePtr = pixelData;
-	for ( line_I = height - 1;  line_I != (Pixel_Index) -1 ;  line_I--) {
-		if (TIFFWriteScanline(file, linePtr, line_I, 0) < 0) {
-			TIFFClose(file);
-			return;
-		}
-		linePtr = (lucPixel*)((ArithPointer)linePtr + (ArithPointer)(width * sizeof(lucPixel)));
-	}
-	TIFFClose(file);
-}
-
-#endif
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputTIFF.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/OutputTIFF.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,182 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OutputTIFF.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_TIFF
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "OutputTIFF.h"
+
+#include <assert.h>
+#include <string.h>
+
+#include <tiff.h>
+#include <tiffio.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucOutputTIFF_Type = "lucOutputTIFF";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucOutputTIFF* _lucOutputTIFF_New(  LUCOUTPUTTIFF_DEFARGS  ) 
+{
+	lucOutputTIFF*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucOutputTIFF) );
+	self = (lucOutputTIFF*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucOutputTIFF_Init( 
+		lucOutputTIFF*                                                self )
+{
+}
+
+void _lucOutputTIFF_Delete( void* outputFormat ) {
+	lucOutputTIFF*  self = (lucOutputTIFF*)outputFormat;
+
+	_lucOutputFormat_Delete( self );
+}
+
+void _lucOutputTIFF_Print( void* outputFormat, Stream* stream ) {
+	lucOutputTIFF*  self = (lucOutputTIFF*)outputFormat;
+
+	_lucOutputFormat_Print( self, stream );
+}
+
+void* _lucOutputTIFF_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucOutputTIFF*  self = (lucOutputTIFF*)outputFormat;
+	lucOutputTIFF* newOutputFormat;
+
+	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newOutputFormat;
+}
+
+
+void* _lucOutputTIFF_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucOutputTIFF);
+	Type                                                      type = lucOutputTIFF_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucOutputTIFF_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucOutputTIFF_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputTIFF_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucOutputTIFF_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucOutputTIFF_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputTIFF_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucOutputTIFF_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucOutputTIFF_Destroy;
+	lucOutputFormat_OutputFunction*                        _output = _lucOutputTIFF_Output;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucOutputTIFF_New(  LUCOUTPUTTIFF_PASSARGS  );
+}
+
+void _lucOutputTIFF_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucOutputTIFF*  self = (lucOutputTIFF*)outputFormat;
+
+	/* Construct Parent */
+	lucOutputFormat_InitAll( self, "tiff" );
+
+	_lucOutputTIFF_Init( self );
+}
+
+void _lucOutputTIFF_Build( void* outputFormat, void* data ) {}
+void _lucOutputTIFF_Initialise( void* outputFormat, void* data ) {}
+void _lucOutputTIFF_Execute( void* outputFormat, void* data ) {}
+void _lucOutputTIFF_Destroy( void* outputFormat, void* data ) {}
+
+void _lucOutputTIFF_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucOutputTIFF*              self         = (lucOutputTIFF*) outputFormat;
+	Pixel_Index                 width        = window->width;
+	Pixel_Index                 height       = window->height;
+	Pixel_Index                 line_I;
+	TIFF*                       file;
+	Name                        filename;
+	lucPixel*                   linePtr;
+
+	/* Open File */
+	filename = lucOutputFormat_GetImageFilename( self, window, context );
+	file = TIFFOpen(filename, "w");
+	Journal_Firewall( file != NULL, lucError, "Cannot Open File %s\n", filename );
+	Memory_Free( filename );
+
+	TIFFSetField(file, TIFFTAG_IMAGEWIDTH, (uint32) width);
+	TIFFSetField(file, TIFFTAG_IMAGELENGTH, (uint32) height);
+	TIFFSetField(file, TIFFTAG_BITSPERSAMPLE, 8);
+	TIFFSetField(file, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS );
+	TIFFSetField(file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
+	TIFFSetField(file, TIFFTAG_SAMPLESPERPIXEL, 3);
+	TIFFSetField(file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+	TIFFSetField(file, TIFFTAG_ROWSPERSTRIP, 1);
+	TIFFSetField(file, TIFFTAG_IMAGEDESCRIPTION, window->name );
+	
+	linePtr = pixelData;
+	for ( line_I = height - 1;  line_I != (Pixel_Index) -1 ;  line_I--) {
+		if (TIFFWriteScanline(file, linePtr, line_I, 0) < 0) {
+			TIFFClose(file);
+			return;
+		}
+		linePtr = (lucPixel*)((ArithPointer)linePtr + (ArithPointer)(width * sizeof(lucPixel)));
+	}
+	TIFFClose(file);
+}
+
+#endif
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputVECTOR.c
--- a/OutputFormats/src/OutputVECTOR.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** 
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#ifdef HAVE_GL2PS
-
-#include <gl2ps.h>
-#include <mpi.h>
-
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "OutputVECTOR.h"
-
-#include <assert.h>
-#include <string.h>
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucOutputVECTOR_Type = "lucOutputVECTOR";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucOutputVECTOR* _lucOutputVECTOR_New(  LUCOUTPUTVECTOR_DEFARGS  ) 
-{
-	lucOutputVECTOR*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucOutputVECTOR) );
-	self = (lucOutputVECTOR*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
-	
-	return self;
-}
-
-void _lucOutputVECTOR_Init( lucOutputVECTOR* self, Stg_ComponentFactory* cf ){
-	Name             formatName;
-	Index            buffersize;
-	
-	formatName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"Format", "ps"  );
-
-	if ( strcasecmp( formatName, "ps" ) == 0 ) {
-		self->format            = "ps";
-		self->gl2psFormatIndex = GL2PS_PS;
-	}
-	else if ( strcasecmp( formatName, "eps" ) == 0 ) {
-		self->format            = "eps";
-		self->gl2psFormatIndex = GL2PS_EPS;
-	}
-	else if ( strcasecmp( formatName, "svg" ) == 0 ) {
-		self->format            = "svg";
-		self->gl2psFormatIndex = GL2PS_SVG;
-	}
-	else if ( strcasecmp( formatName, "pdf" ) == 0 ) {
-		self->format            = "pdf";
-		self->gl2psFormatIndex = GL2PS_PDF;
-	}
-	else
-	Journal_Firewall( 
-			False,
-			Journal_MyStream( Error_Type, self ),
-			"\n Error:  Vector image output format '%s' appears to be incorrect or is unsupported. \n \n \
-			 Supported formats are: \n \
-			    svg  -  scalable vector graphics\n \
-			    ps   -  postscript \n \
-			    eps  -  encapsulated postscript \n \
-			    pdf  -  portable document format \n \n", \
-			formatName);	
-
-	buffersize = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"Buffersize", 4096*4096 );
-	self->buffersize = buffersize;
-}
-
-void _lucOutputVECTOR_Delete( void* outputFormat ) {
-	lucOutputVECTOR*  self = (lucOutputVECTOR*)outputFormat;
-
-	_lucOutputFormat_Delete( self  );
-}
-
-void _lucOutputVECTOR_Print( void* outputFormat, Stream* stream ) {
-	lucOutputVECTOR*  self = (lucOutputVECTOR*)outputFormat;
-
-	_lucOutputFormat_Print( self, stream );
-}
-
-void* _lucOutputVECTOR_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucOutputVECTOR*  self = (lucOutputVECTOR*)outputFormat;
-	lucOutputVECTOR* newOutputFormat;
-
-	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newOutputFormat;
-}
-
-
-void* _lucOutputVECTOR_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucOutputVECTOR);
-	Type                                                      type = lucOutputVECTOR_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucOutputVECTOR_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucOutputVECTOR_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputVECTOR_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucOutputVECTOR_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucOutputVECTOR_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputVECTOR_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucOutputVECTOR_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucOutputVECTOR_Destroy;
-	lucOutputFormat_OutputFunction*                        _output = _lucOutputVECTOR_Output;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucOutputVECTOR_New(  LUCOUTPUTVECTOR_PASSARGS  );
-}
-
-void _lucOutputVECTOR_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
-	lucOutputVECTOR*  self = (lucOutputVECTOR*)outputFormat;
-	AbstractContext* context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data ) ;
-	
-	if(context->rank == MASTER )
-		Journal_Firewall( context->nproc == 1, Journal_MyStream( Error_Type, self ), "\n \n     Vector outputting is not supported in parallel.\n     Please choose an alternate output format.\n\n");
-
-	_lucOutputVECTOR_Init( self, cf );
-	
-	/* Construct Parent */
-	lucOutputFormat_InitAll( self, self->format);
-	
-}
-
-void _lucOutputVECTOR_Build( void* outputFormat, void* data ) {}
-void _lucOutputVECTOR_Initialise( void* outputFormat, void* data ) {}
-void _lucOutputVECTOR_Execute( void* outputFormat, void* data ) {}
-void _lucOutputVECTOR_Destroy( void* outputFormat, void* data ) {}
-
-void _lucOutputVECTOR_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
-	lucOutputVECTOR* self       = (lucOutputVECTOR*) outputFormat;
-	Pixel_Index   width        = window->width;
-	Pixel_Index   height       = window->height;
-	/*FILE*         file         = fopen("test", "wb"); */
-	FILE*         file         = lucOutputFormat_OpenFile( self, window, context, "wb");
-	GLint         viewport[4];
-	GLint         state;
-	Name          filename;
-
-	viewport[0] = 0;
-	viewport[1] = 0;
-	viewport[2] = width;
-	viewport[3] = height;
-	
-	/* get filename for file headers */	
-	filename = lucOutputFormat_GetImageFilename( self, window, context );
-	/* remove directory from output filename */
-	filename = (filename + strlen(context->outputPath) + 1);
-
-	/* call to gl2ps which sets up glRenderMode(GL_FEEDBACK) and parses feedback to required format */
-	gl2psBeginPage(filename, "gLucifer", viewport, self->gl2psFormatIndex, GL2PS_SIMPLE_SORT,GL2PS_NONE,  
-		 GL_RGBA, 0, NULL, 0, 0, 0, self->buffersize, file, NULL);
-	
-	/* cleanup pre-existing scene (which was possibly used for current timestep raster images) */
-	lucWindow_CleanUp( window, context );
-	/* setup scene to be rendered again now that feedback mode is enabled */
-	lucWindow_SetViewportNeedsToSetupFlag( window, True );
-	lucWindow_SetViewportNeedsToDrawFlag( window, True );
-	lucWindow_Draw( window, context );
-
-	/* return to glRenderMode(GL_RENDER), and complete writing output file */
-	state = gl2psEndPage();
-	if(state == 5)
-		Journal_Printf( Journal_MyStream( Error_Type, self ), "\nError. Insufficient GL feedback buffer size. \ 
-								       \nConsider increasing the OutputVECTOR buffersize. \
-								      \nVector image will not be created correctly.\n\n" );
-
-	/* Clean Up */
-	fclose(file);	
-
-}
-
-#endif /* HAVE_GL2PS */
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef OutputFormats/src/OutputVECTOR.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/OutputFormats/src/OutputVECTOR.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,228 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** 
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#ifdef HAVE_GL2PS
+
+#include <gl2ps.h>
+#include <mpi.h>
+
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "OutputVECTOR.h"
+
+#include <assert.h>
+#include <string.h>
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucOutputVECTOR_Type = "lucOutputVECTOR";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucOutputVECTOR* _lucOutputVECTOR_New(  LUCOUTPUTVECTOR_DEFARGS  ) 
+{
+	lucOutputVECTOR*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucOutputVECTOR) );
+	self = (lucOutputVECTOR*) _lucOutputFormat_New(  LUCOUTPUTFORMAT_PASSARGS  );
+	
+	return self;
+}
+
+void _lucOutputVECTOR_Init( lucOutputVECTOR* self, Stg_ComponentFactory* cf ){
+	Name             formatName;
+	Index            buffersize;
+	
+	formatName = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"Format", "ps"  );
+
+	if ( strcasecmp( formatName, "ps" ) == 0 ) {
+		self->format            = "ps";
+		self->gl2psFormatIndex = GL2PS_PS;
+	}
+	else if ( strcasecmp( formatName, "eps" ) == 0 ) {
+		self->format            = "eps";
+		self->gl2psFormatIndex = GL2PS_EPS;
+	}
+	else if ( strcasecmp( formatName, "svg" ) == 0 ) {
+		self->format            = "svg";
+		self->gl2psFormatIndex = GL2PS_SVG;
+	}
+	else if ( strcasecmp( formatName, "pdf" ) == 0 ) {
+		self->format            = "pdf";
+		self->gl2psFormatIndex = GL2PS_PDF;
+	}
+	else
+	Journal_Firewall( 
+			False,
+			Journal_MyStream( Error_Type, self ),
+			"\n Error:  Vector image output format '%s' appears to be incorrect or is unsupported. \n \n \
+			 Supported formats are: \n \
+			    svg  -  scalable vector graphics\n \
+			    ps   -  postscript \n \
+			    eps  -  encapsulated postscript \n \
+			    pdf  -  portable document format \n \n", \
+			formatName);	
+
+	buffersize = Stg_ComponentFactory_GetInt( cf, self->name, (Dictionary_Entry_Key)"Buffersize", 4096*4096 );
+	self->buffersize = buffersize;
+}
+
+void _lucOutputVECTOR_Delete( void* outputFormat ) {
+	lucOutputVECTOR*  self = (lucOutputVECTOR*)outputFormat;
+
+	_lucOutputFormat_Delete( self  );
+}
+
+void _lucOutputVECTOR_Print( void* outputFormat, Stream* stream ) {
+	lucOutputVECTOR*  self = (lucOutputVECTOR*)outputFormat;
+
+	_lucOutputFormat_Print( self, stream );
+}
+
+void* _lucOutputVECTOR_Copy( void* outputFormat, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucOutputVECTOR*  self = (lucOutputVECTOR*)outputFormat;
+	lucOutputVECTOR* newOutputFormat;
+
+	newOutputFormat = _lucOutputFormat_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newOutputFormat;
+}
+
+
+void* _lucOutputVECTOR_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucOutputVECTOR);
+	Type                                                      type = lucOutputVECTOR_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucOutputVECTOR_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucOutputVECTOR_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOutputVECTOR_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucOutputVECTOR_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucOutputVECTOR_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucOutputVECTOR_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucOutputVECTOR_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucOutputVECTOR_Destroy;
+	lucOutputFormat_OutputFunction*                        _output = _lucOutputVECTOR_Output;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucOutputVECTOR_New(  LUCOUTPUTVECTOR_PASSARGS  );
+}
+
+void _lucOutputVECTOR_AssignFromXML( void* outputFormat, Stg_ComponentFactory* cf, void* data ){
+	lucOutputVECTOR*  self = (lucOutputVECTOR*)outputFormat;
+	AbstractContext* context = Stg_ComponentFactory_ConstructByName( cf, (Name)"context", AbstractContext, True, data ) ;
+	
+	if(context->rank == MASTER )
+		Journal_Firewall( context->nproc == 1, Journal_MyStream( Error_Type, self ), "\n \n     Vector outputting is not supported in parallel.\n     Please choose an alternate output format.\n\n");
+
+	_lucOutputVECTOR_Init( self, cf );
+	
+	/* Construct Parent */
+	lucOutputFormat_InitAll( self, self->format);
+	
+}
+
+void _lucOutputVECTOR_Build( void* outputFormat, void* data ) {}
+void _lucOutputVECTOR_Initialise( void* outputFormat, void* data ) {}
+void _lucOutputVECTOR_Execute( void* outputFormat, void* data ) {}
+void _lucOutputVECTOR_Destroy( void* outputFormat, void* data ) {}
+
+void _lucOutputVECTOR_Output( void* outputFormat, lucWindow* window, AbstractContext* context, lucPixel* pixelData ) {
+	lucOutputVECTOR* self       = (lucOutputVECTOR*) outputFormat;
+	Pixel_Index   width        = window->width;
+	Pixel_Index   height       = window->height;
+	/*FILE*         file         = fopen("test", "wb"); */
+	FILE*         file         = lucOutputFormat_OpenFile( self, window, context, "wb");
+	GLint         viewport[4];
+	GLint         state;
+	Name          filename;
+
+	viewport[0] = 0;
+	viewport[1] = 0;
+	viewport[2] = width;
+	viewport[3] = height;
+	
+	/* get filename for file headers */	
+	filename = lucOutputFormat_GetImageFilename( self, window, context );
+	/* remove directory from output filename */
+	filename = (filename + strlen(context->outputPath) + 1);
+
+	/* call to gl2ps which sets up glRenderMode(GL_FEEDBACK) and parses feedback to required format */
+	gl2psBeginPage(filename, "gLucifer", viewport, self->gl2psFormatIndex, GL2PS_SIMPLE_SORT,GL2PS_NONE,  
+		 GL_RGBA, 0, NULL, 0, 0, 0, self->buffersize, file, NULL);
+	
+	/* cleanup pre-existing scene (which was possibly used for current timestep raster images) */
+	lucWindow_CleanUp( window, context );
+	/* setup scene to be rendered again now that feedback mode is enabled */
+	lucWindow_SetViewportNeedsToSetupFlag( window, True );
+	lucWindow_SetViewportNeedsToDrawFlag( window, True );
+	lucWindow_Draw( window, context );
+
+	/* return to glRenderMode(GL_RENDER), and complete writing output file */
+	state = gl2psEndPage();
+	if(state == 5)
+		Journal_Printf( Journal_MyStream( Error_Type, self ), "\nError. Insufficient GL feedback buffer size. \ 
+								       \nConsider increasing the OutputVECTOR buffersize. \
+								      \nVector image will not be created correctly.\n\n" );
+
+	/* Clean Up */
+	fclose(file);	
+
+}
+
+#endif /* HAVE_GL2PS */
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/src/Finalise.c
--- a/RenderingEngines/src/Finalise.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool lucRenderingEngines_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RenderingEngines/src/Finalise.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,60 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool lucRenderingEngines_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/src/Init.c
--- a/RenderingEngines/src/Init.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-
-#include "RenderingEngines.h"
-
-Bool lucRenderingEngines_Init() {
-	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	Stg_ComponentRegister_Add( componentRegister, lucRenderingEngineGL_Type, (Name)"0", _lucRenderingEngineGL_DefaultNew  );
-
-	/* Register Parents for type checking */
-	RegisterParent( lucRenderingEngineGL_Type,         lucRenderingEngine_Type );
-
-  #ifdef HAVE_VTK
-	Stg_ComponentRegister_Add( componentRegister, lucRenderingEngineVTK_Type, (Name)"0", _lucRenderingEngineVTK_DefaultNew  );
-
-	/* Register Parents for type checking */
-	RegisterParent( lucRenderingEngineVTK_Type,         lucRenderingEngine_Type );
-
-	
-	#endif
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RenderingEngines/src/Init.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,74 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+
+#include "RenderingEngines.h"
+
+Bool lucRenderingEngines_Init() {
+	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	Stg_ComponentRegister_Add( componentRegister, lucRenderingEngineGL_Type, (Name)"0", _lucRenderingEngineGL_DefaultNew  );
+
+	/* Register Parents for type checking */
+	RegisterParent( lucRenderingEngineGL_Type,         lucRenderingEngine_Type );
+
+  #ifdef HAVE_VTK
+	Stg_ComponentRegister_Add( componentRegister, lucRenderingEngineVTK_Type, (Name)"0", _lucRenderingEngineVTK_DefaultNew  );
+
+	/* Register Parents for type checking */
+	RegisterParent( lucRenderingEngineVTK_Type,         lucRenderingEngine_Type );
+
+	
+	#endif
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/src/OpenGlUtil.c
--- a/RenderingEngines/src/OpenGlUtil.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,948 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OpenGlUtil.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "OpenGlUtil.h"
-#include <gl.h>
-#include <glu.h>
-#include <string.h>
-
-#include  "font.h"
-
-unsigned int fontbase = -1, fontcharset = FONT_DEFAULT, texture;
-
-void lucViewport2d(Bool enabled, lucViewportInfo* viewportInfo)
-{
-	if (enabled)
-	{
-		/* Set up 2D Viewer the size of the viewport */
-		glDisable( GL_DEPTH_TEST );
-		glPushMatrix();
-		glMatrixMode(GL_PROJECTION);
-		glLoadIdentity();
-		glOrtho((GLfloat) 0.0, (GLfloat) viewportInfo->width, (GLfloat) viewportInfo->height, (GLfloat) 0.0, -1.0f,1.0f);
-		
-		glMatrixMode(GL_MODELVIEW);
-		glLoadIdentity();
-		
-		/* Disable lighting because we don't want a 3D effect */
-		glDisable(GL_LIGHTING);
-		/* Disable line smoothing in 2d mode */
-		glDisable(GL_LINE_SMOOTH);
-	}
-	else
-	{
-		/* Put back settings */
-		glEnable(GL_LIGHTING);
-		glEnable( GL_DEPTH_TEST );
-		glEnable(GL_LINE_SMOOTH);
-		glPopMatrix();
-		
-		/*Set back the viewport to what it should be to render any other object */
-		/* If this is not done, than any object displayed after the colour bar will not appear,*/
-		/* because the projection matrix and lookAt point have been altered */
-		lucViewportInfo_SetOpenGLCamera( viewportInfo );
-	}
-}
-
-void lucPrintString(const char* str)
-{
-	if (fontbase < 0)								/* Load font if not yet done */
-		lucSetupRasterFont();
-	
-	if (fontcharset > FONT_LARGE || fontcharset < FONT_FIXED)		/* Character set valid? */
-		fontcharset = FONT_FIXED;	
-
-    glActiveTexture(GL_TEXTURE0);
-	glEnable(GL_TEXTURE_2D);				 					/* Enable Texture Mapping */
-	glBindTexture(GL_TEXTURE_2D, texture);
-	glListBase(fontbase - 32 + (96 * fontcharset));		/* Choose the font and charset */
-	glCallLists(strlen(str),GL_UNSIGNED_BYTE, str);		/* Display */
-	glDisable(GL_TEXTURE_2D);									/* Disable Texture Mapping */
-
-	#ifdef HAVE_GL2PS
-	/* call to gl2pText is required for text output using vector formats, 
-	 * as no text is stored in the GL feedback buffer */  
-		gl2psText( A, "Times-Roman", 16);
-	#endif
-}
-
-void lucPrintf(int x, int y, const char *fmt, ...)
-{
-    char    text[512];
-    va_list ap;                 /* Pointer to arguments list */
-    if (fmt == NULL) return;    /* No format string */
-    va_start(ap, fmt);          /* Parse format string for variables */
-    vsprintf(text, fmt, ap);    /* Convert symbols */
-    va_end(ap);
-
-    lucPrint(x, y, text);       /* Print result string */
-}
-
-void lucPrint(int x, int y, const char *str)
-{
-	glPushMatrix();
-	glLoadIdentity();
-	glTranslated(x, y, 0);
-	lucPrintString(str);
-	glPopMatrix();
-}
-
-void lucPrint3d(double x, double y, double z, const char *str)
-{
-    /* Calculate projected screen coords in viewport */
-   	GLdouble modelMatrix[16];
-	GLdouble projMatrix[16];
-	GLint    viewportArray[4];
-	double  xPos, yPos, depth;
-
-	glGetDoublev( GL_MODELVIEW_MATRIX, modelMatrix );
-	glGetDoublev( GL_PROJECTION_MATRIX, projMatrix );
-	glGetIntegerv( GL_VIEWPORT, viewportArray );
-
-	gluProject(x, y, z, 
-		modelMatrix,
-		projMatrix,
-		viewportArray,
-		&xPos,
-		&yPos,
-		&depth
-	);
-
-    /* Switch to ortho view with 1 unit = 1 pixel and print using calculated screen coords */
-	glMatrixMode(GL_PROJECTION);
-	glPushMatrix();
-	glLoadIdentity();
-
-	glOrtho((GLfloat) 0.0, viewportArray[2], viewportArray[3], 0.0, -1.0f,1.0f);
-
-	glMatrixMode(GL_MODELVIEW);
-	glPushMatrix();
-	glLoadIdentity();   
-
-    glDisable( GL_DEPTH_TEST );
-
-    /* Print at calculated position, compensating for viewport offset */
-    int xs, ys;
-    xs = (int)(xPos - viewportArray[0]);
-    ys = (int)(viewportArray[3] - yPos - viewportArray[1]);
-    if (depth <= 1.0 && xs > 0 && ys > 0 && xs < viewportArray[2] && ys < viewportArray[3]) 
-        lucPrint(xs, ys, str);  /* Print if in view */
-
-    /* Restore state */
-    glPopMatrix();
-    glMatrixMode(GL_PROJECTION);
-	glPopMatrix();
-	glMatrixMode(GL_MODELVIEW);
-
-	glEnable( GL_DEPTH_TEST );
-}
-
-void lucSetFontCharset(int charset)
-{
-	fontcharset = charset;
-}
-
-/* String width calc */ 
-int lucStringWidth(const char *string)
-{
-	/* Sum character widths in string */
-	int i, len = 0, slen = strlen(string);
-	for (i = 0; i < slen; i++)
-		len += font_charwidths[string[i]-32 + (96 * fontcharset)];
-
-	return len + slen;	/* Additional pixel of spacing for each character */
-}
-
-void lucSetupRasterFont() {
-	/* Load font bitmaps and Convert To Textures */
-	int i, j;
- 	unsigned char pixel_data[IMAGE_HEIGHT * IMAGE_WIDTH * IMAGE_BYTES_PER_PIXEL];
-   	unsigned char fontdata[IMAGE_HEIGHT][IMAGE_WIDTH];	/* font texture data */
-	
-	/* Get font pixels from source data - only need alpha channel */
-	IMAGE_RUN_LENGTH_DECODE(pixel_data, IMAGE_RLE_PIXEL_DATA, IMAGE_WIDTH * IMAGE_HEIGHT, IMAGE_BYTES_PER_PIXEL);
-	for (i = 0; i < IMAGE_HEIGHT; i++)
-		for (j = 0; j < IMAGE_WIDTH; j++)
-				fontdata[ i ][ j ] = pixel_data[ IMAGE_BYTES_PER_PIXEL * (IMAGE_WIDTH * i + j) + 3 ];
-	
-	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-	glEnable(GL_BLEND);
-
-	/* create and bind texture */
-    glActiveTexture(GL_TEXTURE0);
-	glGenTextures(1, &texture);	
-	glBindTexture(GL_TEXTURE_2D, texture);
-	glEnable(GL_COLOR_MATERIAL);
-	/* use linear filtering */
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-	/* generate the texture from bitmap alpha data */
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, IMAGE_WIDTH, IMAGE_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, fontdata);
-	fontbase = glGenLists(GLYPHS);
-
-	/* Build font display lists */
-	lucBuildFont(16, 16, 0, 384);		/* 16x16 glyphs, 16 columns - glyphs 0-383 = first 4 fonts */
-	lucBuildFont(18, 14, 384, 512);	/* 18x18 glyphs, 14 columns - glyphs 384-511 = last font */
-}
-
-void lucBuildFont(int glyphsize, int columns, int startidx, int stopidx)
-{
-	/* Build font display lists */
-	int i;
-	static float yoffset;
-	float divX = IMAGE_WIDTH / (float)glyphsize;
-	float divY = IMAGE_HEIGHT / (float)glyphsize;
-	float glyphX = 1 / divX;	/* Width & height of a glyph in texture coords */
-	float glyphY = 1 / divY;
-	GLfloat cx, cy;         /* the character coordinates in our texture */
-
-	if (startidx == 0)
-		yoffset = 0;
-	glBindTexture(GL_TEXTURE_2D, texture);
-
-	for (i = 0; i < (stopidx - startidx); i++) {
-		cx = (float) (i % columns) / divX;
-		cy = yoffset + (float) (i / columns) / divY;
-		glNewList(fontbase + startidx + i, GL_COMPILE);
-			glBegin(GL_QUADS);
-				glTexCoord2f(cx, cy + glyphY);
-				glVertex2i(0, glyphsize);
-				glTexCoord2f(cx + glyphX, cy + glyphY);
-				glVertex2i(glyphsize, glyphsize);
-				glTexCoord2f(cx + glyphX, cy);
-				glVertex2i(glyphsize, 0);
-				glTexCoord2f(cx, cy);
-				glVertex2i(0, 0);
-			glEnd();
-			/* Shift right width of character + 1 */
-			glTranslated(font_charwidths[startidx + i]+1, 0, 0);
-		glEndList();
-	}
-	/* Save vertical offset to resume from */
-	yoffset = cy + glyphY;
-}
-
-void lucDeleteFont()
-{
-	/* Delete fonts */
-    if (fontbase >= 0) glDeleteLists(fontbase, GLYPHS);
-    fontbase = -1;
-    if (texture) glDeleteTextures(1, &texture);
-    texture = 0;
-}
-
-void lucColour_SetOpenGLColour( lucColour* colour ) {
-	glColor4f(
-			colour->red,
-			colour->green,
-			colour->blue,
-			colour->opacity );
-}
-void lucColour_SetComplimentaryOpenGLColour( lucColour* colour ) {
-	glColor4f(
-			1.0 - colour->red,
-			1.0 - colour->green,
-			1.0 - colour->blue,
-			colour->opacity );
-}
-
-void lucColourMap_SetOpenGLColourFromValue( lucColourMap* cmap, double value ) {
-	lucColour colour;
-
-	lucColourMap_GetColourFromValue( cmap, value, &colour);
-	lucColour_SetOpenGLColour( &colour );
-}
-
-void lucColourMap_SetOpenGLColourFromScaledValue( lucColourMap* cmap, float scaledValue ) {
-	lucColour colour;
- 
-	lucColourMap_GetColourFromScaledValue( cmap, scaledValue, &colour);
-	lucColour_SetOpenGLColour( &colour );
-}
-
-void lucColourMap_SetOpenGLColourFromValue_ExplicitOpacity( lucColourMap* cmap, double value, float opacity ) {
-	lucColour colour;
-
-	lucColourMap_GetColourFromValue( cmap, value, &colour);
-	colour.opacity = opacity;
-	lucColour_SetOpenGLColour( &colour );
-}
-
-void lucColourMap_SetOpenGLColourFromRGB( double red, double green, double blue) {
-	glColor4f(
-			red,
-			green,
-			blue,
-			1.0 );
-}
-void lucColourMap_SetOpenGLColourFromRGB_ExplicitOpacity( double red, double green, double blue, float opacity ) {
-		glColor4f(
-			red,
-			green,
-			blue,
-			opacity );
-}
-void lucViewportInfo_GetCoordFromPixel( lucViewportInfo* viewportInfo, Pixel_Index xPos, Pixel_Index yPos, Coord coord ) {
-	GLdouble modelMatrix[16];
-	GLdouble projMatrix[16];
-	GLint    viewportArray[4];
-	float    depth;
-
-	glViewport( viewportInfo->startx, viewportInfo->starty, viewportInfo->width, viewportInfo->height);
-	lucViewportInfo_SetOpenGLCamera( viewportInfo );
-
-	glGetDoublev( GL_MODELVIEW_MATRIX, modelMatrix );
-	glGetDoublev( GL_PROJECTION_MATRIX, projMatrix );
-	glGetIntegerv( GL_VIEWPORT, viewportArray );
-
-	glReadBuffer(GL_FRONT);
-	glReadPixels( xPos, yPos, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth );
-
-	gluUnProject(
-		(double) xPos,
-		(double) yPos,
-		(double) depth,
-		modelMatrix,
-		projMatrix,
-		viewportArray,
-		&coord[I_AXIS],
-		&coord[J_AXIS],
-		&coord[K_AXIS]
-	);
-}
-
-void lucViewportInfo_SetOpenGLCamera( lucViewportInfo* viewportInfo ) {
-	lucViewport* viewport  = viewportInfo->viewport;
-	lucCamera*   camera      = viewport->camera;
-	Coord        currEyePos;
-	
-	/*Declarations for the lucStereoAsymetric part*/
-	double ratio, radians, wd2, ndfl;
-	double left, right, top, bottom, near=0.1, far=1000;
-	#define DTOR 0.0174532925
-	GLenum pname = GL_STEREO;
-	GLboolean stereo_enabled;
-
-	switch ( camera->stereoType ) {
-		case lucMono: case lucStereoToeIn:
-			/* set up projection transform */
-			glMatrixMode(GL_PROJECTION);  
-			glLoadIdentity();
-
-			gluPerspective( camera->aperture, lucViewportInfo_AspectRatio(viewportInfo), 
-					viewport->nearClipPlane, viewport->farClipPlane );
-			glMatrixMode(GL_MODELVIEW);
-			glLoadIdentity();
-
-			lucCamera_CurrentEyePosition( camera, currEyePos );
-
-			/* Change viewer location */
-			gluLookAt( currEyePos[ I_AXIS ],          currEyePos[ J_AXIS ],          currEyePos[ K_AXIS ], 
-					   camera->focalPoint[ I_AXIS ],  camera->focalPoint[ J_AXIS ],  camera->focalPoint[ K_AXIS ], 
-					   camera->upDirection[ I_AXIS ], camera->upDirection[ J_AXIS ], camera->upDirection[ K_AXIS ] ); 
-			break;
-		
-		
-		case lucStereoAsymmetric:
-		
-			/* test if the strereo can be enabled */
-			
-			glGetBooleanv(pname, &stereo_enabled);
-			if( stereo_enabled == GL_FALSE)
-				Journal_DPrintfL( lucDebug, 2, " Stereo not supported\n");
-			else 
-				Journal_DPrintfL( lucDebug, 2, " Stereo is supported\n");
-				
-				
-			radians = DTOR * camera->aperture/2.0;
-			wd2 = viewport->nearClipPlane * tan(radians);
-			
-			ndfl = (viewport->nearClipPlane ) / camera->focalLength;
-			
-			/* View vector for each camera is parrallel and glFrustum() is used to describe the perspective projection*/
-			lucCamera_CurrentEyePosition( camera, currEyePos );
-			
-			if(camera->buffer == lucRight){
-				glMatrixMode (GL_PROJECTION);
-				glLoadIdentity();
-			 	left = -ratio * wd2 - 0.5* camera->eyeSeparation * ndfl;
-				right = ratio * wd2 - 0.5* camera->eyeSeparation * ndfl;
-				top = wd2;
-				bottom = -wd2;
-				glFrustum(left, right, bottom, top, near, far);
-		
-				glMatrixMode(GL_MODELVIEW);
-				/*glDrawBuffer(GL_BACK_RIGHT);*/
-				glDrawBuffer(GL_BACK);
-				glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-				glLoadIdentity();
-			
-				gluLookAt(currEyePos[ I_AXIS ], currEyePos[ J_AXIS ], currEyePos[ K_AXIS ], 
-								currEyePos[ I_AXIS ] + camera->focalPoint[ I_AXIS ], 
-								currEyePos[ J_AXIS ] + camera->focalPoint[ J_AXIS ],  
-								currEyePos[ K_AXIS ] + camera->focalPoint[ K_AXIS ],
-								camera->upDirection[ I_AXIS ], camera->upDirection[ J_AXIS ], camera->upDirection[ K_AXIS ] ); 
-								
-			}
-			else if (camera->buffer == lucLeft){
-			 	
-				glMatrixMode (GL_PROJECTION);
-				glLoadIdentity();
-				left = -ratio * wd2 + 0.5* camera->eyeSeparation * ndfl;
-				right = ratio * wd2 + 0.5* camera->eyeSeparation * ndfl;
-				top = wd2;
-				bottom = -wd2;
-				glFrustum(left, right, bottom, top, near, far);
-		
-				glMatrixMode(GL_MODELVIEW);
-				glDrawBuffer(GL_BACK);
-				/*glDrawBuffer(GL_BACK_RIGHT);*/
-				glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-				glLoadIdentity();
-			
-				gluLookAt(currEyePos[ I_AXIS ], currEyePos[ J_AXIS ], currEyePos[ K_AXIS ], 
-								currEyePos[ I_AXIS ] + camera->focalPoint[ I_AXIS ], 
-								currEyePos[ J_AXIS ] + camera->focalPoint[ J_AXIS ],  
-								currEyePos[ K_AXIS ] + camera->focalPoint[ K_AXIS ],
-								camera->upDirection[ I_AXIS ], camera->upDirection[ J_AXIS ], camera->upDirection[ K_AXIS ] ); 
-								
-			
-			}			
-			else {}					
-		/*	abort();*/
-			break;
-	}
-}
-
-void luc_OpenGlSquare( Dimension_Index dim, double* pos, double* normal, double* orientation, double width) {
-	double plane2[3], corner[3];
-	double imposedOrientation[3];
-	double *plane;
-	
-	if(width == 0.0)
-		return;
-	
-	if(orientation==NULL) {  /* Note the danger - if normal points precisely along z axis this fails !*/
-		imposedOrientation[0] = -normal[1];
-		imposedOrientation[1] =  normal[0];
-		imposedOrientation[2] = 0.0; 
-		plane = imposedOrientation;	
-	}
-	else
-		plane = orientation;
-	
-	if (dim == 2) {
-		luc_DrawVector( dim, pos, plane, width, 0.0 );
-		return;
-	}
-	
-	if(normal[1] < 0.0) { /* Planes can face (abitrarily) up or down - choose the upward facing normal for consistent shading */
-		normal[0] *= -1.0;
-		normal[1] *= -1.0;
-		normal[2] *= -1.0;
-	}
-	
-	StGermain_VectorCrossProduct(plane2, normal, plane);
-
-	corner[0] = pos[0] - plane[0]*width/2.0 - plane2[0]*width/2.0;
-	corner[1] = pos[1] - plane[1]*width/2.0 - plane2[1]*width/2.0;
-	corner[2] = pos[2] - plane[2]*width/2.0 - plane2[2]*width/2.0;
-
-	glBegin(GL_QUADS);
-		glNormal3dv(normal);
-		glVertex3d (corner[0], corner[1], corner[2]);
-		glVertex3d (corner[0] + plane2[0]*width, corner[1] + plane2[1]*width, corner[2] + plane2[2]*width);
-		glVertex3d (corner[0] + plane[0]*width + plane2[0]*width, corner[1] + plane[1]*width + plane2[1]*width, 
-			corner[2] + plane[2]*width + plane2[2]*width);
-		glVertex3d (corner[0] + plane[0]*width, corner[1] + plane[1]*width, corner[2] + plane[2]*width);
-		
-		glVertex3d (corner[0], corner[1], corner[2]);
-		glVertex3d (corner[0] + plane2[0]*width, corner[1] + plane2[1]*width, corner[2] + plane2[2]*width);
-		glVertex3d (corner[0] + plane[0]*width + plane2[0]*width, corner[1] + plane[1]*width + plane2[1]*width, 
-			corner[2] + plane[2]*width + plane2[2]*width);
-		glVertex3d (corner[0] + plane[0]*width, corner[1] + plane[1]*width, corner[2] + plane[2]*width);
-		
-		
-	glEnd();
-}
-
-void luc_OpenGlFatSquare( Dimension_Index dim, double* pos, double* normal, double* orientation, double width, double thickness) {
-	double plane2[3], corner[3], corner2[3];
-	double imposedOrientation[3];
-	double vertex[8][3];
-	double *plane;
-	
-	if(width == 0.0 || thickness == 0.0)
-		return;
-	
-	if(orientation==NULL) {  /* Note the danger - if normal points precisely along z axis this fails !*/
-		imposedOrientation[0] = -normal[1];
-		imposedOrientation[1] =  normal[0];
-		imposedOrientation[2] = 0.0; 
-		plane = imposedOrientation;	
-	}
-	else
-		plane = orientation;
-	
-	if (dim == 2) {
-		luc_DrawVector( dim, pos, plane, width, 0.0 );
-		return;
-	}
-	
-	if(normal[1] < 0.0) { /* Planes can face (abitrarily) up or down - choose the upward facing normal for consistent shading */
-		normal[0] *= -1.0;
-		normal[1] *= -1.0;
-		normal[2] *= -1.0;
-	}
-		
-	StGermain_VectorCrossProduct(plane2, normal, plane);
-
-	corner[0] = pos[0] - plane[0]*width/2.0 - plane2[0]*width/2.0 - 0.5 * normal[0] * thickness;
-	corner[1] = pos[1] - plane[1]*width/2.0 - plane2[1]*width/2.0 - 0.5 * normal[1] * thickness;
-	corner[2] = pos[2] - plane[2]*width/2.0 - plane2[2]*width/2.0 - 0.5 * normal[2] * thickness;
-
-	corner2[0] = corner[0] + normal[0] * thickness;
-	corner2[1] = corner[1] + normal[1] * thickness;
-	corner2[2] = corner[2] + normal[2] * thickness;
-	
-	vertex[0][0] = corner[0];
-	vertex[0][1] = corner[1];
-	vertex[0][2] = corner[2];
-
-	vertex[1][0] = corner[0] + plane2[0]*width;
-	vertex[1][1] = corner[1] + plane2[1]*width;
-	vertex[1][2] = corner[2] + plane2[2]*width;
-
-	vertex[2][0] = corner[0] + plane[0]*width;
-	vertex[2][1] = corner[1] + plane[1]*width;
-	vertex[2][2] = corner[2] + plane[2]*width;
-	
-	vertex[3][0] = corner[0] + plane[0]*width + plane2[0]*width;
-	vertex[3][1] = corner[1] + plane[1]*width + plane2[1]*width;
-	vertex[3][2] = corner[2] + plane[2]*width + plane2[2]*width;
-	
-	vertex[4][0] = corner2[0];
-	vertex[4][1] = corner2[1];
-	vertex[4][2] = corner2[2];
-
-	vertex[5][0] = corner2[0] + plane2[0]*width;
-	vertex[5][1] = corner2[1] + plane2[1]*width;
-	vertex[5][2] = corner2[2] + plane2[2]*width;
-
-	vertex[6][0] = corner2[0] + plane[0]*width;
-	vertex[6][1] = corner2[1] + plane[1]*width;
-	vertex[6][2] = corner2[2] + plane[2]*width;
-	
-	vertex[7][0] = corner2[0] + plane[0]*width + plane2[0]*width;
-	vertex[7][1] = corner2[1] + plane[1]*width + plane2[1]*width;
-	vertex[7][2] = corner2[2] + plane[2]*width + plane2[2]*width;
-	
-	
-	glBegin(GL_QUADS);
-		glNormal3d(-normal[0],-normal[1],-normal[2]);
-
-		glVertex3dv(vertex[0]);
-		glVertex3dv(vertex[1]);
-		glVertex3dv(vertex[3]);
-		glVertex3dv(vertex[2]);
-		                    
-		glNormal3d(normal[0],normal[1],normal[2]);
-		
-		glVertex3dv(vertex[4]);
-		glVertex3dv(vertex[5]);
-		glVertex3dv(vertex[7]);
-		glVertex3dv(vertex[6]);
-		
-		// Keep constant shading for the edges so they don't glint in the sun and distract the viewer 
-		
-		glVertex3dv(vertex[0]);
-		glVertex3dv(vertex[1]);
-		glVertex3dv(vertex[5]);
-		glVertex3dv(vertex[4]);
-				
-		glVertex3dv(vertex[2]);
-		glVertex3dv(vertex[3]);
-		glVertex3dv(vertex[7]);
-		glVertex3dv(vertex[6]);
-		
-		glVertex3dv(vertex[0]);
-		glVertex3dv(vertex[2]);
-		glVertex3dv(vertex[6]);
-		glVertex3dv(vertex[4]);
-		
-		glVertex3dv(vertex[1]);
-		glVertex3dv(vertex[3]);
-		glVertex3dv(vertex[7]);
-		glVertex3dv(vertex[5]);
-
-		
-	glEnd();
-	
-}
-
-void luc_OpenGlCircle( Dimension_Index dim, double* pos, double* normal, double radius, Index nSides) {
-	double vector_polar[3], vector_rect[3];
-	double normal_polar[3];
-	int theta;
-
-	if (dim == 2) {
-		double plane[] = {normal[1], normal[0]};
-		luc_DrawVector( dim, pos, plane, radius, 0.0 );
-		return;
-	}
-
-	/* Convert Normal into spherical coordinates */
-	StGermain_RectangularToSpherical( normal_polar, normal, 3);
-	
-
-	/* Draw circle */
-	glBegin(GL_POLYGON) ; 
-		glNormal3dv(normal);
-		for (theta = 0 ; theta < 360 ; theta = theta + 360/nSides) {
-			/* Find vector from centre of circle to edge of circle */
-			vector_polar[0] = radius;
-			vector_polar[1] = StGermain_DegreeToRadian( theta );
-			vector_polar[2] = atan(			-1.0/
-						(tan(normal_polar[2])*cos( normal_polar[1] - vector_polar[1] ) ) );
-			/* Correct for arctan domain */
-			if ( vector_polar[2] < 0.0) vector_polar[2] = vector_polar[2] + M_PI;
-			
-			/*Convert back to cartesian coordinates */
-			StGermain_SphericalToRectangular( vector_rect, vector_polar, 3 );
-			
-			/* Find position vectors of edge of circle */
-			vector_rect[0] = pos[0] + vector_rect[0];
-			vector_rect[1] = pos[1] + vector_rect[1];
-			vector_rect[2] = pos[2] + vector_rect[2];
-			
-			/* Plot them */
-			glVertex3dv( vector_rect );
-		}
-	glEnd();
-
-}
-
-#define OFFSET2D	0.01
-
-void luc_DrawVector( Dimension_Index dim , double* pos, double* vector, double scale, double headSize ) {
-	Coord A, B, C;
-	Dimension_Index dim_I;
-
-	glDisable(GL_LIGHTING);
-	/* headSize = |BC|/|AC|: 
-		i.e. head size of 1.0, means that B -> A, 
-		     head size of 0.0, means that B ->C */
-
-	/* ASCII art describing vertices for arrow 
-	                                D
-	                                |\
-	                                | \
-	                                |  \
-	A                  O           B|   \
-	--------------------------------|    > C
-	                                |   /
-	                                |  /
-	                                | /
-	                                |/
-	                                E  
-	*/
-
-	for ( dim_I = 0 ; dim_I < dim ; dim_I++ ) {
-		A[ dim_I ] = pos[ dim_I ] - scale * 0.5 * vector[ dim_I ];
-		C[ dim_I ] = pos[ dim_I ] + scale * 0.5 * vector[ dim_I ];
-
-		B[ dim_I ] = A[ dim_I ] * headSize + C[ dim_I ] * (1.0 - headSize);
-	}
-	if ( dim == 2 ) 
-		A[ K_AXIS ] = B[ K_AXIS ] = C[ K_AXIS ] = OFFSET2D;
-
-	/* Draw Line */
-	glBegin(GL_LINES);
-		glVertex3dv( A );
-		glVertex3dv( B );
-	glEnd();
-			
-
-	/* Draw Arrow Head */
-	if ( dim == 2 ) {
-		glBegin(GL_TRIANGLES);
-			glVertex3dv( C );
-			/* Vertex D */
-			glVertex3d(
-				B[ I_AXIS ] + 0.8 * headSize * scale * vector[1], 
-				B[ J_AXIS ] - 0.8 * headSize * scale * vector[0], 
-				OFFSET2D );
-			/* Vertex E */
-			glVertex3d(
-				B[ I_AXIS ] - 0.8 * headSize * scale * vector[1], 
-				B[ J_AXIS ] + 0.8 * headSize * scale * vector[0], 
-				OFFSET2D );
-		glEnd();
-	}
-	else {
-		double radius = 0.8 * headSize * scale * StGermain_VectorMagnitude( vector, dim );
-		double vector_polar[3], vector_rect[3];
-		double normal_polar[3], normal_rect[3];
-		int theta;
-
-		/* Don't bother drawing head for tiny vectors */
-		if ( radius < 1.0e-10 )
-			return;
-
-		/* normalise vector */
-		memcpy( normal_rect, vector, sizeof(double) * 3 );
-		StGermain_VectorNormalise( normal_rect, dim );
-	
-		/* Convert Normal into spherical coordinates */
-		StGermain_RectangularToSpherical( normal_polar, normal_rect, 3 );
-	
-		glBegin(GL_TRIANGLE_FAN);
-			/* Vertex C - Point of the triangle fan */
-			glVertex3dv( C );
-
-			for ( theta = 0 ; theta <= 360 ; theta += 1 ) {
-				/* Find vector from centre of circle to edge of circle */
-				vector_polar[0] = radius;
-				vector_polar[1] = StGermain_DegreeToRadian( theta );
-				vector_polar[2] = atan(			-1.0/
-							(tan(normal_polar[2])*cos( normal_polar[1] - vector_polar[1] ) ) );
-
-				/* Correct for arctan domain */
-				if ( vector_polar[2] < 0.0 )
-					vector_polar[2] += M_PI;
-				
-				/*Convert back to cartesian coordinates */
-				StGermain_SphericalToRectangular( vector_rect, vector_polar, 3 );
-				
-				/* Find position vectors of edge of circle */
-				vector_rect[0] += B[0];
-				vector_rect[1] += B[1];
-				vector_rect[2] += B[2];
-				
-				/* Plot them */
-				glVertex3dv( vector_rect );
-			}
-		glEnd();
-	}
-	
-	glEnable(GL_LIGHTING);
-}
-
-
-void luc_DrawRod( Dimension_Index dim , double* pos, double* vector, double scale ) {
-	double magnitude;
-	double normal[3], i[] = {1.0, 0.0, 0.0}, k[] = {0.0,0.0,1.0};
-	double angle;
-
-	magnitude = StGermain_VectorMagnitude( vector, dim );
-	scale *= magnitude;
-	angle = StGermain_RadianToDegree( acos(vector[0] / magnitude) );
-	glPushMatrix();
-	
-	if (dim == 2) {
-		if (vector[1] < 0) angle = -angle;
-		glTranslated(pos[0], pos[1], 0.0);
-		glRotated( angle, k[0], k[1], k[2] ); 
-		glScaled( scale, scale, scale );
-		glDisable(GL_LIGHTING);
-		glBegin(GL_LINES);
-			glVertex3d(-0.5,0.0, OFFSET2D);
-			glVertex3d(0.5, 0.0, OFFSET2D);
-		glEnd();
-		glEnable(GL_LIGHTING);
-	}
-	else {
-		
-		StGermain_VectorCrossProduct( normal, i, vector );
-		
-		glTranslated( pos[0], pos[1], pos[2] );
-		glRotated( angle, normal[0], normal[1], normal[2] ); 
-		glScaled( scale, scale, scale );
-
-		glDisable(GL_LIGHTING);
-		glBegin(GL_LINES);
-			glVertex3f(-0.5, 0.0, 0.0);
-			glVertex3f(0.5, 0.0, 0.0);
-		glEnd();
-		glEnable(GL_LIGHTING);
-	}
-	glPopMatrix();	
-}
-
-void luc_OpenGlDebug_PrintAll( Stream* stream, int debugLevel ) {
-    GLint r, g, b, a, depth, sten, aux, dbl;
-    glGetIntegerv(GL_RED_BITS, &r);
-    glGetIntegerv(GL_GREEN_BITS, &g);
-    glGetIntegerv(GL_BLUE_BITS, &b);
-    glGetIntegerv(GL_ALPHA_BITS, &a);
-    glGetIntegerv(GL_DEPTH_BITS, &depth);
-    glGetIntegerv(GL_STENCIL_BITS, &sten);
-    glGetIntegerv(GL_AUX_BUFFERS, &aux);
-    glGetIntegerv(GL_DOUBLEBUFFER, &dbl);
-    Journal_PrintfL(stream, 2, "framebuffer: rgba %d %d %d %d, depth %d, stencil %d, aux bfr %d, double bfr %d\n",
-        r, g, b, a, depth, sten, aux, dbl);
-
-    GLint a_test, a_func; float a_ref;
-    glGetIntegerv(GL_ALPHA_TEST, &a_test);
-    glGetIntegerv(GL_ALPHA_TEST_FUNC, &a_func);
-    glGetFloatv(GL_ALPHA_TEST_REF, &a_ref);
-    Journal_PrintfL(stream, 2, "alpha testing: %d, func %04x ref %f\n", a_test, a_func, a_ref);
-
-    GLint blend, b_src, b_equ, b_dst;
-    GLfloat b_c[4];
-    glGetIntegerv(GL_BLEND, &blend);
-    glGetIntegerv(GL_BLEND_SRC, &b_src);
-    glGetIntegerv(GL_BLEND_EQUATION, &b_equ);
-    glGetIntegerv(GL_BLEND_DST, &b_dst);
-    glGetFloatv(GL_BLEND_COLOR, b_c);
-    Journal_PrintfL(stream, 2, "blending: %d, src %04x equ %04x dst %04x color %.2f %.2f %.2f %.2f\n",
-        blend, b_src, b_equ, b_dst, b_c[0], b_c[1], b_c[2], b_c[3]);
-
-    GLint logic, logmode, mask[4], cull, cullmode, front, draw;
-    glGetIntegerv(GL_COLOR_LOGIC_OP, &logic);
-    glGetIntegerv(GL_LOGIC_OP_MODE, &logmode);
-    glGetIntegerv(GL_COLOR_WRITEMASK, mask);
-    glGetIntegerv(GL_CULL_FACE, &cull);
-    glGetIntegerv(GL_CULL_FACE_MODE, &cullmode);
-    glGetIntegerv(GL_FRONT_FACE, &front);
-    glGetIntegerv(GL_DRAW_BUFFER, &draw);
-    Journal_PrintfL(stream, 2, "draw env: logic %d logmode %04x, mask %d %d %d %d, cull %d cullmode %04x frontface %04x, drawbuffer %04x\n",
-        logic, logmode, mask[0], mask[1], mask[2], mask[3], cull, cullmode, front, draw);
-        
-    Journal_PrintfL(stream, 2, "GL err was %04x\n", glGetError());
-    Journal_PrintfL(stream, 2, "***\n");
-
-
-	luc_OpenGlDebug( stream, GL_LIST_INDEX, debugLevel);
-	luc_OpenGlDebug( stream, GL_LIST_MODE, debugLevel);
-	luc_OpenGlDebug( stream, GL_MATRIX_MODE, debugLevel);
-	luc_OpenGlDebug( stream, GL_MODELVIEW_MATRIX, debugLevel);
-	luc_OpenGlDebug( stream, GL_PROJECTION_MATRIX, debugLevel);
-	luc_OpenGlDebug( stream, GL_CURRENT_RASTER_POSITION, debugLevel);
-	luc_OpenGlDebug( stream, GL_CURRENT_RASTER_TEXTURE_COORDS, debugLevel);
-	luc_OpenGlDebug( stream, GL_CURRENT_RASTER_POSITION_VALID, debugLevel);
-	luc_OpenGlDebug( stream, GL_TEXTURE_ENV_MODE, debugLevel);
-	luc_OpenGlDebug( stream, GL_TEXTURE_ENV_COLOR, debugLevel);
-}
-
-void luc_OpenGlDebug( Stream* stream, int mode, int debugLevel){
-	GLfloat    modelviewMatrix[16];
-	GLfloat    projectionMatrix[16];
-	GLint      listIndex;
-	GLfloat    listMode;
-	GLfloat    matrixMode;
-	GLfloat    currentRasterPosition[4];
-	GLfloat    currentRasterTextureCoords[4];
-	GLfloat    currentRasterPositionValid;
-	GLfloat    textureEnvColor[4];
-	
-	Journal_PrintfL( stream, 2, "In func %s OpenglMode is is %d\n", __func__, mode);
-	Journal_PrintfL(stream, 2, "GL err was %04x\n", glGetError());
-	
-	if(mode == GL_LIST_INDEX){
-		glGetIntegerv(GL_LIST_INDEX, &listIndex);
-		Journal_PrintfL( stream, debugLevel, "In func '%s' list index is %d\n", __func__, listIndex );	
-	} 
-	
-	if(mode == GL_LIST_MODE){
-		glGetFloatv(GL_LIST_MODE, &listMode);
-		Journal_PrintfL( stream, debugLevel, "In func '%s' list index is %d\n", __func__, listMode);
-	}  
-	
-	if(mode == GL_MATRIX_MODE){
-		glGetFloatv(GL_MATRIX_MODE, &matrixMode);
-		Journal_PrintfL( stream, debugLevel, "In func '%s' list index is %d\n", __func__, matrixMode);
-	}
-		
-    if(mode == GL_MODELVIEW_MATRIX){
-		glGetFloatv(GL_MODELVIEW_MATRIX, modelviewMatrix); 
-		Journal_PrintfL( stream, debugLevel, "In func '%s' Model View matrix is \n",__func__);
-		
-		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", modelviewMatrix[0], modelviewMatrix[1], modelviewMatrix[2],modelviewMatrix[3]);
-		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", modelviewMatrix[4], modelviewMatrix[5], modelviewMatrix[6],modelviewMatrix[7]);
-		
-		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", modelviewMatrix[8], modelviewMatrix[9], modelviewMatrix[10],modelviewMatrix[11]);
-		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", modelviewMatrix[12], modelviewMatrix[13], modelviewMatrix[14],modelviewMatrix[15]);
-	}
-	
-	if(mode == GL_PROJECTION_MATRIX){
-		glGetFloatv(GL_PROJECTION_MATRIX, projectionMatrix); 
-		Journal_PrintfL( stream, debugLevel, "In func '%s' projection matrix is \n",__func__);
-		
-		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", projectionMatrix[0], projectionMatrix[1], projectionMatrix[2],projectionMatrix[3]);
-		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", projectionMatrix[4], projectionMatrix[5], projectionMatrix[6],projectionMatrix[7]); 
-		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", projectionMatrix[8], projectionMatrix[9], projectionMatrix[10],projectionMatrix[11]);
-		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", projectionMatrix[10], projectionMatrix[13], projectionMatrix[14],projectionMatrix[15]);
-	}		 
-	
-	if(mode == GL_CURRENT_RASTER_POSITION){
-		glGetFloatv(GL_CURRENT_RASTER_POSITION, currentRasterPosition); 
-		Journal_PrintfL( stream, debugLevel, "In func %s current raster position is \n %f %f %f %f  \n",__func__, currentRasterPosition[0], currentRasterPosition[1], currentRasterPosition[2], currentRasterPosition[3]);
-	}
-	
-	if(mode == GL_CURRENT_RASTER_TEXTURE_COORDS){
-		glGetFloatv(GL_CURRENT_RASTER_TEXTURE_COORDS, currentRasterTextureCoords);
-		Journal_PrintfL( stream, debugLevel, "In func %s current raster texture coords is \n, %f %f %f %f  \n",__func__, currentRasterTextureCoords[0], currentRasterTextureCoords[1],currentRasterTextureCoords[2], currentRasterTextureCoords[3]);
-	}
-	
-	if(mode == GL_CURRENT_RASTER_POSITION_VALID){
-		glGetFloatv(GL_CURRENT_RASTER_POSITION_VALID, &currentRasterPositionValid);
-		Journal_PrintfL( stream, debugLevel, "In func %s current raster position valid  is \n %f  \n",__func__, currentRasterPositionValid);
-	}
-	
-	if(mode == GL_TEXTURE_ENV_COLOR){
-		glGetFloatv(GL_TEXTURE_ENV_COLOR, textureEnvColor);
-		Journal_PrintfL( stream, debugLevel, "In func %s Texture Env Color is \n %f %f %f %f  \n",__func__, textureEnvColor[0], textureEnvColor[1], textureEnvColor[2], textureEnvColor[3]);
-	} 
-
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/src/OpenGlUtil.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RenderingEngines/src/OpenGlUtil.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,948 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OpenGlUtil.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "OpenGlUtil.h"
+#include <gl.h>
+#include <glu.h>
+#include <string.h>
+
+#include  "font.h"
+
+unsigned int fontbase = -1, fontcharset = FONT_DEFAULT, texture;
+
+void lucViewport2d(Bool enabled, lucViewportInfo* viewportInfo)
+{
+	if (enabled)
+	{
+		/* Set up 2D Viewer the size of the viewport */
+		glDisable( GL_DEPTH_TEST );
+		glPushMatrix();
+		glMatrixMode(GL_PROJECTION);
+		glLoadIdentity();
+		glOrtho((GLfloat) 0.0, (GLfloat) viewportInfo->width, (GLfloat) viewportInfo->height, (GLfloat) 0.0, -1.0f,1.0f);
+		
+		glMatrixMode(GL_MODELVIEW);
+		glLoadIdentity();
+		
+		/* Disable lighting because we don't want a 3D effect */
+		glDisable(GL_LIGHTING);
+		/* Disable line smoothing in 2d mode */
+		glDisable(GL_LINE_SMOOTH);
+	}
+	else
+	{
+		/* Put back settings */
+		glEnable(GL_LIGHTING);
+		glEnable( GL_DEPTH_TEST );
+		glEnable(GL_LINE_SMOOTH);
+		glPopMatrix();
+		
+		/*Set back the viewport to what it should be to render any other object */
+		/* If this is not done, than any object displayed after the colour bar will not appear,*/
+		/* because the projection matrix and lookAt point have been altered */
+		lucViewportInfo_SetOpenGLCamera( viewportInfo );
+	}
+}
+
+void lucPrintString(const char* str)
+{
+	if (fontbase < 0)								/* Load font if not yet done */
+		lucSetupRasterFont();
+	
+	if (fontcharset > FONT_LARGE || fontcharset < FONT_FIXED)		/* Character set valid? */
+		fontcharset = FONT_FIXED;	
+
+    glActiveTexture(GL_TEXTURE0);
+	glEnable(GL_TEXTURE_2D);				 					/* Enable Texture Mapping */
+	glBindTexture(GL_TEXTURE_2D, texture);
+	glListBase(fontbase - 32 + (96 * fontcharset));		/* Choose the font and charset */
+	glCallLists(strlen(str),GL_UNSIGNED_BYTE, str);		/* Display */
+	glDisable(GL_TEXTURE_2D);									/* Disable Texture Mapping */
+
+	#ifdef HAVE_GL2PS
+	/* call to gl2pText is required for text output using vector formats, 
+	 * as no text is stored in the GL feedback buffer */  
+		gl2psText( A, "Times-Roman", 16);
+	#endif
+}
+
+void lucPrintf(int x, int y, const char *fmt, ...)
+{
+    char    text[512];
+    va_list ap;                 /* Pointer to arguments list */
+    if (fmt == NULL) return;    /* No format string */
+    va_start(ap, fmt);          /* Parse format string for variables */
+    vsprintf(text, fmt, ap);    /* Convert symbols */
+    va_end(ap);
+
+    lucPrint(x, y, text);       /* Print result string */
+}
+
+void lucPrint(int x, int y, const char *str)
+{
+	glPushMatrix();
+	glLoadIdentity();
+	glTranslated(x, y, 0);
+	lucPrintString(str);
+	glPopMatrix();
+}
+
+void lucPrint3d(double x, double y, double z, const char *str)
+{
+    /* Calculate projected screen coords in viewport */
+   	GLdouble modelMatrix[16];
+	GLdouble projMatrix[16];
+	GLint    viewportArray[4];
+	double  xPos, yPos, depth;
+
+	glGetDoublev( GL_MODELVIEW_MATRIX, modelMatrix );
+	glGetDoublev( GL_PROJECTION_MATRIX, projMatrix );
+	glGetIntegerv( GL_VIEWPORT, viewportArray );
+
+	gluProject(x, y, z, 
+		modelMatrix,
+		projMatrix,
+		viewportArray,
+		&xPos,
+		&yPos,
+		&depth
+	);
+
+    /* Switch to ortho view with 1 unit = 1 pixel and print using calculated screen coords */
+	glMatrixMode(GL_PROJECTION);
+	glPushMatrix();
+	glLoadIdentity();
+
+	glOrtho((GLfloat) 0.0, viewportArray[2], viewportArray[3], 0.0, -1.0f,1.0f);
+
+	glMatrixMode(GL_MODELVIEW);
+	glPushMatrix();
+	glLoadIdentity();   
+
+    glDisable( GL_DEPTH_TEST );
+
+    /* Print at calculated position, compensating for viewport offset */
+    int xs, ys;
+    xs = (int)(xPos - viewportArray[0]);
+    ys = (int)(viewportArray[3] - yPos - viewportArray[1]);
+    if (depth <= 1.0 && xs > 0 && ys > 0 && xs < viewportArray[2] && ys < viewportArray[3]) 
+        lucPrint(xs, ys, str);  /* Print if in view */
+
+    /* Restore state */
+    glPopMatrix();
+    glMatrixMode(GL_PROJECTION);
+	glPopMatrix();
+	glMatrixMode(GL_MODELVIEW);
+
+	glEnable( GL_DEPTH_TEST );
+}
+
+void lucSetFontCharset(int charset)
+{
+	fontcharset = charset;
+}
+
+/* String width calc */ 
+int lucStringWidth(const char *string)
+{
+	/* Sum character widths in string */
+	int i, len = 0, slen = strlen(string);
+	for (i = 0; i < slen; i++)
+		len += font_charwidths[string[i]-32 + (96 * fontcharset)];
+
+	return len + slen;	/* Additional pixel of spacing for each character */
+}
+
+void lucSetupRasterFont() {
+	/* Load font bitmaps and Convert To Textures */
+	int i, j;
+ 	unsigned char pixel_data[IMAGE_HEIGHT * IMAGE_WIDTH * IMAGE_BYTES_PER_PIXEL];
+   	unsigned char fontdata[IMAGE_HEIGHT][IMAGE_WIDTH];	/* font texture data */
+	
+	/* Get font pixels from source data - only need alpha channel */
+	IMAGE_RUN_LENGTH_DECODE(pixel_data, IMAGE_RLE_PIXEL_DATA, IMAGE_WIDTH * IMAGE_HEIGHT, IMAGE_BYTES_PER_PIXEL);
+	for (i = 0; i < IMAGE_HEIGHT; i++)
+		for (j = 0; j < IMAGE_WIDTH; j++)
+				fontdata[ i ][ j ] = pixel_data[ IMAGE_BYTES_PER_PIXEL * (IMAGE_WIDTH * i + j) + 3 ];
+	
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glEnable(GL_BLEND);
+
+	/* create and bind texture */
+    glActiveTexture(GL_TEXTURE0);
+	glGenTextures(1, &texture);	
+	glBindTexture(GL_TEXTURE_2D, texture);
+	glEnable(GL_COLOR_MATERIAL);
+	/* use linear filtering */
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+	/* generate the texture from bitmap alpha data */
+	glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, IMAGE_WIDTH, IMAGE_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, fontdata);
+	fontbase = glGenLists(GLYPHS);
+
+	/* Build font display lists */
+	lucBuildFont(16, 16, 0, 384);		/* 16x16 glyphs, 16 columns - glyphs 0-383 = first 4 fonts */
+	lucBuildFont(18, 14, 384, 512);	/* 18x18 glyphs, 14 columns - glyphs 384-511 = last font */
+}
+
+void lucBuildFont(int glyphsize, int columns, int startidx, int stopidx)
+{
+	/* Build font display lists */
+	int i;
+	static float yoffset;
+	float divX = IMAGE_WIDTH / (float)glyphsize;
+	float divY = IMAGE_HEIGHT / (float)glyphsize;
+	float glyphX = 1 / divX;	/* Width & height of a glyph in texture coords */
+	float glyphY = 1 / divY;
+	GLfloat cx, cy;         /* the character coordinates in our texture */
+
+	if (startidx == 0)
+		yoffset = 0;
+	glBindTexture(GL_TEXTURE_2D, texture);
+
+	for (i = 0; i < (stopidx - startidx); i++) {
+		cx = (float) (i % columns) / divX;
+		cy = yoffset + (float) (i / columns) / divY;
+		glNewList(fontbase + startidx + i, GL_COMPILE);
+			glBegin(GL_QUADS);
+				glTexCoord2f(cx, cy + glyphY);
+				glVertex2i(0, glyphsize);
+				glTexCoord2f(cx + glyphX, cy + glyphY);
+				glVertex2i(glyphsize, glyphsize);
+				glTexCoord2f(cx + glyphX, cy);
+				glVertex2i(glyphsize, 0);
+				glTexCoord2f(cx, cy);
+				glVertex2i(0, 0);
+			glEnd();
+			/* Shift right width of character + 1 */
+			glTranslated(font_charwidths[startidx + i]+1, 0, 0);
+		glEndList();
+	}
+	/* Save vertical offset to resume from */
+	yoffset = cy + glyphY;
+}
+
+void lucDeleteFont()
+{
+	/* Delete fonts */
+    if (fontbase >= 0) glDeleteLists(fontbase, GLYPHS);
+    fontbase = -1;
+    if (texture) glDeleteTextures(1, &texture);
+    texture = 0;
+}
+
+void lucColour_SetOpenGLColour( lucColour* colour ) {
+	glColor4f(
+			colour->red,
+			colour->green,
+			colour->blue,
+			colour->opacity );
+}
+void lucColour_SetComplimentaryOpenGLColour( lucColour* colour ) {
+	glColor4f(
+			1.0 - colour->red,
+			1.0 - colour->green,
+			1.0 - colour->blue,
+			colour->opacity );
+}
+
+void lucColourMap_SetOpenGLColourFromValue( lucColourMap* cmap, double value ) {
+	lucColour colour;
+
+	lucColourMap_GetColourFromValue( cmap, value, &colour);
+	lucColour_SetOpenGLColour( &colour );
+}
+
+void lucColourMap_SetOpenGLColourFromScaledValue( lucColourMap* cmap, float scaledValue ) {
+	lucColour colour;
+ 
+	lucColourMap_GetColourFromScaledValue( cmap, scaledValue, &colour);
+	lucColour_SetOpenGLColour( &colour );
+}
+
+void lucColourMap_SetOpenGLColourFromValue_ExplicitOpacity( lucColourMap* cmap, double value, float opacity ) {
+	lucColour colour;
+
+	lucColourMap_GetColourFromValue( cmap, value, &colour);
+	colour.opacity = opacity;
+	lucColour_SetOpenGLColour( &colour );
+}
+
+void lucColourMap_SetOpenGLColourFromRGB( double red, double green, double blue) {
+	glColor4f(
+			red,
+			green,
+			blue,
+			1.0 );
+}
+void lucColourMap_SetOpenGLColourFromRGB_ExplicitOpacity( double red, double green, double blue, float opacity ) {
+		glColor4f(
+			red,
+			green,
+			blue,
+			opacity );
+}
+void lucViewportInfo_GetCoordFromPixel( lucViewportInfo* viewportInfo, Pixel_Index xPos, Pixel_Index yPos, Coord coord ) {
+	GLdouble modelMatrix[16];
+	GLdouble projMatrix[16];
+	GLint    viewportArray[4];
+	float    depth;
+
+	glViewport( viewportInfo->startx, viewportInfo->starty, viewportInfo->width, viewportInfo->height);
+	lucViewportInfo_SetOpenGLCamera( viewportInfo );
+
+	glGetDoublev( GL_MODELVIEW_MATRIX, modelMatrix );
+	glGetDoublev( GL_PROJECTION_MATRIX, projMatrix );
+	glGetIntegerv( GL_VIEWPORT, viewportArray );
+
+	glReadBuffer(GL_FRONT);
+	glReadPixels( xPos, yPos, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth );
+
+	gluUnProject(
+		(double) xPos,
+		(double) yPos,
+		(double) depth,
+		modelMatrix,
+		projMatrix,
+		viewportArray,
+		&coord[I_AXIS],
+		&coord[J_AXIS],
+		&coord[K_AXIS]
+	);
+}
+
+void lucViewportInfo_SetOpenGLCamera( lucViewportInfo* viewportInfo ) {
+	lucViewport* viewport  = viewportInfo->viewport;
+	lucCamera*   camera      = viewport->camera;
+	Coord        currEyePos;
+	
+	/*Declarations for the lucStereoAsymetric part*/
+	double ratio, radians, wd2, ndfl;
+	double left, right, top, bottom, near=0.1, far=1000;
+	#define DTOR 0.0174532925
+	GLenum pname = GL_STEREO;
+	GLboolean stereo_enabled;
+
+	switch ( camera->stereoType ) {
+		case lucMono: case lucStereoToeIn:
+			/* set up projection transform */
+			glMatrixMode(GL_PROJECTION);  
+			glLoadIdentity();
+
+			gluPerspective( camera->aperture, lucViewportInfo_AspectRatio(viewportInfo), 
+					viewport->nearClipPlane, viewport->farClipPlane );
+			glMatrixMode(GL_MODELVIEW);
+			glLoadIdentity();
+
+			lucCamera_CurrentEyePosition( camera, currEyePos );
+
+			/* Change viewer location */
+			gluLookAt( currEyePos[ I_AXIS ],          currEyePos[ J_AXIS ],          currEyePos[ K_AXIS ], 
+					   camera->focalPoint[ I_AXIS ],  camera->focalPoint[ J_AXIS ],  camera->focalPoint[ K_AXIS ], 
+					   camera->upDirection[ I_AXIS ], camera->upDirection[ J_AXIS ], camera->upDirection[ K_AXIS ] ); 
+			break;
+		
+		
+		case lucStereoAsymmetric:
+		
+			/* test if the strereo can be enabled */
+			
+			glGetBooleanv(pname, &stereo_enabled);
+			if( stereo_enabled == GL_FALSE)
+				Journal_DPrintfL( lucDebug, 2, " Stereo not supported\n");
+			else 
+				Journal_DPrintfL( lucDebug, 2, " Stereo is supported\n");
+				
+				
+			radians = DTOR * camera->aperture/2.0;
+			wd2 = viewport->nearClipPlane * tan(radians);
+			
+			ndfl = (viewport->nearClipPlane ) / camera->focalLength;
+			
+			/* View vector for each camera is parrallel and glFrustum() is used to describe the perspective projection*/
+			lucCamera_CurrentEyePosition( camera, currEyePos );
+			
+			if(camera->buffer == lucRight){
+				glMatrixMode (GL_PROJECTION);
+				glLoadIdentity();
+			 	left = -ratio * wd2 - 0.5* camera->eyeSeparation * ndfl;
+				right = ratio * wd2 - 0.5* camera->eyeSeparation * ndfl;
+				top = wd2;
+				bottom = -wd2;
+				glFrustum(left, right, bottom, top, near, far);
+		
+				glMatrixMode(GL_MODELVIEW);
+				/*glDrawBuffer(GL_BACK_RIGHT);*/
+				glDrawBuffer(GL_BACK);
+				glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+				glLoadIdentity();
+			
+				gluLookAt(currEyePos[ I_AXIS ], currEyePos[ J_AXIS ], currEyePos[ K_AXIS ], 
+								currEyePos[ I_AXIS ] + camera->focalPoint[ I_AXIS ], 
+								currEyePos[ J_AXIS ] + camera->focalPoint[ J_AXIS ],  
+								currEyePos[ K_AXIS ] + camera->focalPoint[ K_AXIS ],
+								camera->upDirection[ I_AXIS ], camera->upDirection[ J_AXIS ], camera->upDirection[ K_AXIS ] ); 
+								
+			}
+			else if (camera->buffer == lucLeft){
+			 	
+				glMatrixMode (GL_PROJECTION);
+				glLoadIdentity();
+				left = -ratio * wd2 + 0.5* camera->eyeSeparation * ndfl;
+				right = ratio * wd2 + 0.5* camera->eyeSeparation * ndfl;
+				top = wd2;
+				bottom = -wd2;
+				glFrustum(left, right, bottom, top, near, far);
+		
+				glMatrixMode(GL_MODELVIEW);
+				glDrawBuffer(GL_BACK);
+				/*glDrawBuffer(GL_BACK_RIGHT);*/
+				glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+				glLoadIdentity();
+			
+				gluLookAt(currEyePos[ I_AXIS ], currEyePos[ J_AXIS ], currEyePos[ K_AXIS ], 
+								currEyePos[ I_AXIS ] + camera->focalPoint[ I_AXIS ], 
+								currEyePos[ J_AXIS ] + camera->focalPoint[ J_AXIS ],  
+								currEyePos[ K_AXIS ] + camera->focalPoint[ K_AXIS ],
+								camera->upDirection[ I_AXIS ], camera->upDirection[ J_AXIS ], camera->upDirection[ K_AXIS ] ); 
+								
+			
+			}			
+			else {}					
+		/*	abort();*/
+			break;
+	}
+}
+
+void luc_OpenGlSquare( Dimension_Index dim, double* pos, double* normal, double* orientation, double width) {
+	double plane2[3], corner[3];
+	double imposedOrientation[3];
+	double *plane;
+	
+	if(width == 0.0)
+		return;
+	
+	if(orientation==NULL) {  /* Note the danger - if normal points precisely along z axis this fails !*/
+		imposedOrientation[0] = -normal[1];
+		imposedOrientation[1] =  normal[0];
+		imposedOrientation[2] = 0.0; 
+		plane = imposedOrientation;	
+	}
+	else
+		plane = orientation;
+	
+	if (dim == 2) {
+		luc_DrawVector( dim, pos, plane, width, 0.0 );
+		return;
+	}
+	
+	if(normal[1] < 0.0) { /* Planes can face (abitrarily) up or down - choose the upward facing normal for consistent shading */
+		normal[0] *= -1.0;
+		normal[1] *= -1.0;
+		normal[2] *= -1.0;
+	}
+	
+	StGermain_VectorCrossProduct(plane2, normal, plane);
+
+	corner[0] = pos[0] - plane[0]*width/2.0 - plane2[0]*width/2.0;
+	corner[1] = pos[1] - plane[1]*width/2.0 - plane2[1]*width/2.0;
+	corner[2] = pos[2] - plane[2]*width/2.0 - plane2[2]*width/2.0;
+
+	glBegin(GL_QUADS);
+		glNormal3dv(normal);
+		glVertex3d (corner[0], corner[1], corner[2]);
+		glVertex3d (corner[0] + plane2[0]*width, corner[1] + plane2[1]*width, corner[2] + plane2[2]*width);
+		glVertex3d (corner[0] + plane[0]*width + plane2[0]*width, corner[1] + plane[1]*width + plane2[1]*width, 
+			corner[2] + plane[2]*width + plane2[2]*width);
+		glVertex3d (corner[0] + plane[0]*width, corner[1] + plane[1]*width, corner[2] + plane[2]*width);
+		
+		glVertex3d (corner[0], corner[1], corner[2]);
+		glVertex3d (corner[0] + plane2[0]*width, corner[1] + plane2[1]*width, corner[2] + plane2[2]*width);
+		glVertex3d (corner[0] + plane[0]*width + plane2[0]*width, corner[1] + plane[1]*width + plane2[1]*width, 
+			corner[2] + plane[2]*width + plane2[2]*width);
+		glVertex3d (corner[0] + plane[0]*width, corner[1] + plane[1]*width, corner[2] + plane[2]*width);
+		
+		
+	glEnd();
+}
+
+void luc_OpenGlFatSquare( Dimension_Index dim, double* pos, double* normal, double* orientation, double width, double thickness) {
+	double plane2[3], corner[3], corner2[3];
+	double imposedOrientation[3];
+	double vertex[8][3];
+	double *plane;
+	
+	if(width == 0.0 || thickness == 0.0)
+		return;
+	
+	if(orientation==NULL) {  /* Note the danger - if normal points precisely along z axis this fails !*/
+		imposedOrientation[0] = -normal[1];
+		imposedOrientation[1] =  normal[0];
+		imposedOrientation[2] = 0.0; 
+		plane = imposedOrientation;	
+	}
+	else
+		plane = orientation;
+	
+	if (dim == 2) {
+		luc_DrawVector( dim, pos, plane, width, 0.0 );
+		return;
+	}
+	
+	if(normal[1] < 0.0) { /* Planes can face (abitrarily) up or down - choose the upward facing normal for consistent shading */
+		normal[0] *= -1.0;
+		normal[1] *= -1.0;
+		normal[2] *= -1.0;
+	}
+		
+	StGermain_VectorCrossProduct(plane2, normal, plane);
+
+	corner[0] = pos[0] - plane[0]*width/2.0 - plane2[0]*width/2.0 - 0.5 * normal[0] * thickness;
+	corner[1] = pos[1] - plane[1]*width/2.0 - plane2[1]*width/2.0 - 0.5 * normal[1] * thickness;
+	corner[2] = pos[2] - plane[2]*width/2.0 - plane2[2]*width/2.0 - 0.5 * normal[2] * thickness;
+
+	corner2[0] = corner[0] + normal[0] * thickness;
+	corner2[1] = corner[1] + normal[1] * thickness;
+	corner2[2] = corner[2] + normal[2] * thickness;
+	
+	vertex[0][0] = corner[0];
+	vertex[0][1] = corner[1];
+	vertex[0][2] = corner[2];
+
+	vertex[1][0] = corner[0] + plane2[0]*width;
+	vertex[1][1] = corner[1] + plane2[1]*width;
+	vertex[1][2] = corner[2] + plane2[2]*width;
+
+	vertex[2][0] = corner[0] + plane[0]*width;
+	vertex[2][1] = corner[1] + plane[1]*width;
+	vertex[2][2] = corner[2] + plane[2]*width;
+	
+	vertex[3][0] = corner[0] + plane[0]*width + plane2[0]*width;
+	vertex[3][1] = corner[1] + plane[1]*width + plane2[1]*width;
+	vertex[3][2] = corner[2] + plane[2]*width + plane2[2]*width;
+	
+	vertex[4][0] = corner2[0];
+	vertex[4][1] = corner2[1];
+	vertex[4][2] = corner2[2];
+
+	vertex[5][0] = corner2[0] + plane2[0]*width;
+	vertex[5][1] = corner2[1] + plane2[1]*width;
+	vertex[5][2] = corner2[2] + plane2[2]*width;
+
+	vertex[6][0] = corner2[0] + plane[0]*width;
+	vertex[6][1] = corner2[1] + plane[1]*width;
+	vertex[6][2] = corner2[2] + plane[2]*width;
+	
+	vertex[7][0] = corner2[0] + plane[0]*width + plane2[0]*width;
+	vertex[7][1] = corner2[1] + plane[1]*width + plane2[1]*width;
+	vertex[7][2] = corner2[2] + plane[2]*width + plane2[2]*width;
+	
+	
+	glBegin(GL_QUADS);
+		glNormal3d(-normal[0],-normal[1],-normal[2]);
+
+		glVertex3dv(vertex[0]);
+		glVertex3dv(vertex[1]);
+		glVertex3dv(vertex[3]);
+		glVertex3dv(vertex[2]);
+		                    
+		glNormal3d(normal[0],normal[1],normal[2]);
+		
+		glVertex3dv(vertex[4]);
+		glVertex3dv(vertex[5]);
+		glVertex3dv(vertex[7]);
+		glVertex3dv(vertex[6]);
+		
+		// Keep constant shading for the edges so they don't glint in the sun and distract the viewer 
+		
+		glVertex3dv(vertex[0]);
+		glVertex3dv(vertex[1]);
+		glVertex3dv(vertex[5]);
+		glVertex3dv(vertex[4]);
+				
+		glVertex3dv(vertex[2]);
+		glVertex3dv(vertex[3]);
+		glVertex3dv(vertex[7]);
+		glVertex3dv(vertex[6]);
+		
+		glVertex3dv(vertex[0]);
+		glVertex3dv(vertex[2]);
+		glVertex3dv(vertex[6]);
+		glVertex3dv(vertex[4]);
+		
+		glVertex3dv(vertex[1]);
+		glVertex3dv(vertex[3]);
+		glVertex3dv(vertex[7]);
+		glVertex3dv(vertex[5]);
+
+		
+	glEnd();
+	
+}
+
+void luc_OpenGlCircle( Dimension_Index dim, double* pos, double* normal, double radius, Index nSides) {
+	double vector_polar[3], vector_rect[3];
+	double normal_polar[3];
+	int theta;
+
+	if (dim == 2) {
+		double plane[] = {normal[1], normal[0]};
+		luc_DrawVector( dim, pos, plane, radius, 0.0 );
+		return;
+	}
+
+	/* Convert Normal into spherical coordinates */
+	StGermain_RectangularToSpherical( normal_polar, normal, 3);
+	
+
+	/* Draw circle */
+	glBegin(GL_POLYGON) ; 
+		glNormal3dv(normal);
+		for (theta = 0 ; theta < 360 ; theta = theta + 360/nSides) {
+			/* Find vector from centre of circle to edge of circle */
+			vector_polar[0] = radius;
+			vector_polar[1] = StGermain_DegreeToRadian( theta );
+			vector_polar[2] = atan(			-1.0/
+						(tan(normal_polar[2])*cos( normal_polar[1] - vector_polar[1] ) ) );
+			/* Correct for arctan domain */
+			if ( vector_polar[2] < 0.0) vector_polar[2] = vector_polar[2] + M_PI;
+			
+			/*Convert back to cartesian coordinates */
+			StGermain_SphericalToRectangular( vector_rect, vector_polar, 3 );
+			
+			/* Find position vectors of edge of circle */
+			vector_rect[0] = pos[0] + vector_rect[0];
+			vector_rect[1] = pos[1] + vector_rect[1];
+			vector_rect[2] = pos[2] + vector_rect[2];
+			
+			/* Plot them */
+			glVertex3dv( vector_rect );
+		}
+	glEnd();
+
+}
+
+#define OFFSET2D	0.01
+
+void luc_DrawVector( Dimension_Index dim , double* pos, double* vector, double scale, double headSize ) {
+	Coord A, B, C;
+	Dimension_Index dim_I;
+
+	glDisable(GL_LIGHTING);
+	/* headSize = |BC|/|AC|: 
+		i.e. head size of 1.0, means that B -> A, 
+		     head size of 0.0, means that B ->C */
+
+	/* ASCII art describing vertices for arrow 
+	                                D
+	                                |\
+	                                | \
+	                                |  \
+	A                  O           B|   \
+	--------------------------------|    > C
+	                                |   /
+	                                |  /
+	                                | /
+	                                |/
+	                                E  
+	*/
+
+	for ( dim_I = 0 ; dim_I < dim ; dim_I++ ) {
+		A[ dim_I ] = pos[ dim_I ] - scale * 0.5 * vector[ dim_I ];
+		C[ dim_I ] = pos[ dim_I ] + scale * 0.5 * vector[ dim_I ];
+
+		B[ dim_I ] = A[ dim_I ] * headSize + C[ dim_I ] * (1.0 - headSize);
+	}
+	if ( dim == 2 ) 
+		A[ K_AXIS ] = B[ K_AXIS ] = C[ K_AXIS ] = OFFSET2D;
+
+	/* Draw Line */
+	glBegin(GL_LINES);
+		glVertex3dv( A );
+		glVertex3dv( B );
+	glEnd();
+			
+
+	/* Draw Arrow Head */
+	if ( dim == 2 ) {
+		glBegin(GL_TRIANGLES);
+			glVertex3dv( C );
+			/* Vertex D */
+			glVertex3d(
+				B[ I_AXIS ] + 0.8 * headSize * scale * vector[1], 
+				B[ J_AXIS ] - 0.8 * headSize * scale * vector[0], 
+				OFFSET2D );
+			/* Vertex E */
+			glVertex3d(
+				B[ I_AXIS ] - 0.8 * headSize * scale * vector[1], 
+				B[ J_AXIS ] + 0.8 * headSize * scale * vector[0], 
+				OFFSET2D );
+		glEnd();
+	}
+	else {
+		double radius = 0.8 * headSize * scale * StGermain_VectorMagnitude( vector, dim );
+		double vector_polar[3], vector_rect[3];
+		double normal_polar[3], normal_rect[3];
+		int theta;
+
+		/* Don't bother drawing head for tiny vectors */
+		if ( radius < 1.0e-10 )
+			return;
+
+		/* normalise vector */
+		memcpy( normal_rect, vector, sizeof(double) * 3 );
+		StGermain_VectorNormalise( normal_rect, dim );
+	
+		/* Convert Normal into spherical coordinates */
+		StGermain_RectangularToSpherical( normal_polar, normal_rect, 3 );
+	
+		glBegin(GL_TRIANGLE_FAN);
+			/* Vertex C - Point of the triangle fan */
+			glVertex3dv( C );
+
+			for ( theta = 0 ; theta <= 360 ; theta += 1 ) {
+				/* Find vector from centre of circle to edge of circle */
+				vector_polar[0] = radius;
+				vector_polar[1] = StGermain_DegreeToRadian( theta );
+				vector_polar[2] = atan(			-1.0/
+							(tan(normal_polar[2])*cos( normal_polar[1] - vector_polar[1] ) ) );
+
+				/* Correct for arctan domain */
+				if ( vector_polar[2] < 0.0 )
+					vector_polar[2] += M_PI;
+				
+				/*Convert back to cartesian coordinates */
+				StGermain_SphericalToRectangular( vector_rect, vector_polar, 3 );
+				
+				/* Find position vectors of edge of circle */
+				vector_rect[0] += B[0];
+				vector_rect[1] += B[1];
+				vector_rect[2] += B[2];
+				
+				/* Plot them */
+				glVertex3dv( vector_rect );
+			}
+		glEnd();
+	}
+	
+	glEnable(GL_LIGHTING);
+}
+
+
+void luc_DrawRod( Dimension_Index dim , double* pos, double* vector, double scale ) {
+	double magnitude;
+	double normal[3], i[] = {1.0, 0.0, 0.0}, k[] = {0.0,0.0,1.0};
+	double angle;
+
+	magnitude = StGermain_VectorMagnitude( vector, dim );
+	scale *= magnitude;
+	angle = StGermain_RadianToDegree( acos(vector[0] / magnitude) );
+	glPushMatrix();
+	
+	if (dim == 2) {
+		if (vector[1] < 0) angle = -angle;
+		glTranslated(pos[0], pos[1], 0.0);
+		glRotated( angle, k[0], k[1], k[2] ); 
+		glScaled( scale, scale, scale );
+		glDisable(GL_LIGHTING);
+		glBegin(GL_LINES);
+			glVertex3d(-0.5,0.0, OFFSET2D);
+			glVertex3d(0.5, 0.0, OFFSET2D);
+		glEnd();
+		glEnable(GL_LIGHTING);
+	}
+	else {
+		
+		StGermain_VectorCrossProduct( normal, i, vector );
+		
+		glTranslated( pos[0], pos[1], pos[2] );
+		glRotated( angle, normal[0], normal[1], normal[2] ); 
+		glScaled( scale, scale, scale );
+
+		glDisable(GL_LIGHTING);
+		glBegin(GL_LINES);
+			glVertex3f(-0.5, 0.0, 0.0);
+			glVertex3f(0.5, 0.0, 0.0);
+		glEnd();
+		glEnable(GL_LIGHTING);
+	}
+	glPopMatrix();	
+}
+
+void luc_OpenGlDebug_PrintAll( Stream* stream, int debugLevel ) {
+    GLint r, g, b, a, depth, sten, aux, dbl;
+    glGetIntegerv(GL_RED_BITS, &r);
+    glGetIntegerv(GL_GREEN_BITS, &g);
+    glGetIntegerv(GL_BLUE_BITS, &b);
+    glGetIntegerv(GL_ALPHA_BITS, &a);
+    glGetIntegerv(GL_DEPTH_BITS, &depth);
+    glGetIntegerv(GL_STENCIL_BITS, &sten);
+    glGetIntegerv(GL_AUX_BUFFERS, &aux);
+    glGetIntegerv(GL_DOUBLEBUFFER, &dbl);
+    Journal_PrintfL(stream, 2, "framebuffer: rgba %d %d %d %d, depth %d, stencil %d, aux bfr %d, double bfr %d\n",
+        r, g, b, a, depth, sten, aux, dbl);
+
+    GLint a_test, a_func; float a_ref;
+    glGetIntegerv(GL_ALPHA_TEST, &a_test);
+    glGetIntegerv(GL_ALPHA_TEST_FUNC, &a_func);
+    glGetFloatv(GL_ALPHA_TEST_REF, &a_ref);
+    Journal_PrintfL(stream, 2, "alpha testing: %d, func %04x ref %f\n", a_test, a_func, a_ref);
+
+    GLint blend, b_src, b_equ, b_dst;
+    GLfloat b_c[4];
+    glGetIntegerv(GL_BLEND, &blend);
+    glGetIntegerv(GL_BLEND_SRC, &b_src);
+    glGetIntegerv(GL_BLEND_EQUATION, &b_equ);
+    glGetIntegerv(GL_BLEND_DST, &b_dst);
+    glGetFloatv(GL_BLEND_COLOR, b_c);
+    Journal_PrintfL(stream, 2, "blending: %d, src %04x equ %04x dst %04x color %.2f %.2f %.2f %.2f\n",
+        blend, b_src, b_equ, b_dst, b_c[0], b_c[1], b_c[2], b_c[3]);
+
+    GLint logic, logmode, mask[4], cull, cullmode, front, draw;
+    glGetIntegerv(GL_COLOR_LOGIC_OP, &logic);
+    glGetIntegerv(GL_LOGIC_OP_MODE, &logmode);
+    glGetIntegerv(GL_COLOR_WRITEMASK, mask);
+    glGetIntegerv(GL_CULL_FACE, &cull);
+    glGetIntegerv(GL_CULL_FACE_MODE, &cullmode);
+    glGetIntegerv(GL_FRONT_FACE, &front);
+    glGetIntegerv(GL_DRAW_BUFFER, &draw);
+    Journal_PrintfL(stream, 2, "draw env: logic %d logmode %04x, mask %d %d %d %d, cull %d cullmode %04x frontface %04x, drawbuffer %04x\n",
+        logic, logmode, mask[0], mask[1], mask[2], mask[3], cull, cullmode, front, draw);
+        
+    Journal_PrintfL(stream, 2, "GL err was %04x\n", glGetError());
+    Journal_PrintfL(stream, 2, "***\n");
+
+
+	luc_OpenGlDebug( stream, GL_LIST_INDEX, debugLevel);
+	luc_OpenGlDebug( stream, GL_LIST_MODE, debugLevel);
+	luc_OpenGlDebug( stream, GL_MATRIX_MODE, debugLevel);
+	luc_OpenGlDebug( stream, GL_MODELVIEW_MATRIX, debugLevel);
+	luc_OpenGlDebug( stream, GL_PROJECTION_MATRIX, debugLevel);
+	luc_OpenGlDebug( stream, GL_CURRENT_RASTER_POSITION, debugLevel);
+	luc_OpenGlDebug( stream, GL_CURRENT_RASTER_TEXTURE_COORDS, debugLevel);
+	luc_OpenGlDebug( stream, GL_CURRENT_RASTER_POSITION_VALID, debugLevel);
+	luc_OpenGlDebug( stream, GL_TEXTURE_ENV_MODE, debugLevel);
+	luc_OpenGlDebug( stream, GL_TEXTURE_ENV_COLOR, debugLevel);
+}
+
+void luc_OpenGlDebug( Stream* stream, int mode, int debugLevel){
+	GLfloat    modelviewMatrix[16];
+	GLfloat    projectionMatrix[16];
+	GLint      listIndex;
+	GLfloat    listMode;
+	GLfloat    matrixMode;
+	GLfloat    currentRasterPosition[4];
+	GLfloat    currentRasterTextureCoords[4];
+	GLfloat    currentRasterPositionValid;
+	GLfloat    textureEnvColor[4];
+	
+	Journal_PrintfL( stream, 2, "In func %s OpenglMode is is %d\n", __func__, mode);
+	Journal_PrintfL(stream, 2, "GL err was %04x\n", glGetError());
+	
+	if(mode == GL_LIST_INDEX){
+		glGetIntegerv(GL_LIST_INDEX, &listIndex);
+		Journal_PrintfL( stream, debugLevel, "In func '%s' list index is %d\n", __func__, listIndex );	
+	} 
+	
+	if(mode == GL_LIST_MODE){
+		glGetFloatv(GL_LIST_MODE, &listMode);
+		Journal_PrintfL( stream, debugLevel, "In func '%s' list index is %d\n", __func__, listMode);
+	}  
+	
+	if(mode == GL_MATRIX_MODE){
+		glGetFloatv(GL_MATRIX_MODE, &matrixMode);
+		Journal_PrintfL( stream, debugLevel, "In func '%s' list index is %d\n", __func__, matrixMode);
+	}
+		
+    if(mode == GL_MODELVIEW_MATRIX){
+		glGetFloatv(GL_MODELVIEW_MATRIX, modelviewMatrix); 
+		Journal_PrintfL( stream, debugLevel, "In func '%s' Model View matrix is \n",__func__);
+		
+		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", modelviewMatrix[0], modelviewMatrix[1], modelviewMatrix[2],modelviewMatrix[3]);
+		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", modelviewMatrix[4], modelviewMatrix[5], modelviewMatrix[6],modelviewMatrix[7]);
+		
+		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", modelviewMatrix[8], modelviewMatrix[9], modelviewMatrix[10],modelviewMatrix[11]);
+		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", modelviewMatrix[12], modelviewMatrix[13], modelviewMatrix[14],modelviewMatrix[15]);
+	}
+	
+	if(mode == GL_PROJECTION_MATRIX){
+		glGetFloatv(GL_PROJECTION_MATRIX, projectionMatrix); 
+		Journal_PrintfL( stream, debugLevel, "In func '%s' projection matrix is \n",__func__);
+		
+		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", projectionMatrix[0], projectionMatrix[1], projectionMatrix[2],projectionMatrix[3]);
+		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", projectionMatrix[4], projectionMatrix[5], projectionMatrix[6],projectionMatrix[7]); 
+		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", projectionMatrix[8], projectionMatrix[9], projectionMatrix[10],projectionMatrix[11]);
+		Journal_PrintfL( stream, debugLevel, " %f  %f  %f  %f\n", projectionMatrix[10], projectionMatrix[13], projectionMatrix[14],projectionMatrix[15]);
+	}		 
+	
+	if(mode == GL_CURRENT_RASTER_POSITION){
+		glGetFloatv(GL_CURRENT_RASTER_POSITION, currentRasterPosition); 
+		Journal_PrintfL( stream, debugLevel, "In func %s current raster position is \n %f %f %f %f  \n",__func__, currentRasterPosition[0], currentRasterPosition[1], currentRasterPosition[2], currentRasterPosition[3]);
+	}
+	
+	if(mode == GL_CURRENT_RASTER_TEXTURE_COORDS){
+		glGetFloatv(GL_CURRENT_RASTER_TEXTURE_COORDS, currentRasterTextureCoords);
+		Journal_PrintfL( stream, debugLevel, "In func %s current raster texture coords is \n, %f %f %f %f  \n",__func__, currentRasterTextureCoords[0], currentRasterTextureCoords[1],currentRasterTextureCoords[2], currentRasterTextureCoords[3]);
+	}
+	
+	if(mode == GL_CURRENT_RASTER_POSITION_VALID){
+		glGetFloatv(GL_CURRENT_RASTER_POSITION_VALID, &currentRasterPositionValid);
+		Journal_PrintfL( stream, debugLevel, "In func %s current raster position valid  is \n %f  \n",__func__, currentRasterPositionValid);
+	}
+	
+	if(mode == GL_TEXTURE_ENV_COLOR){
+		glGetFloatv(GL_TEXTURE_ENV_COLOR, textureEnvColor);
+		Journal_PrintfL( stream, debugLevel, "In func %s Texture Env Color is \n %f %f %f %f  \n",__func__, textureEnvColor[0], textureEnvColor[1], textureEnvColor[2], textureEnvColor[3]);
+	} 
+
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/src/RenderingEngineGL.c
--- a/RenderingEngines/src/RenderingEngineGL.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,611 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: RenderingEngineGL.c 791 2008-09-01 02:09:06Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "RenderingEngineGL.h"
-#include "OpenGlUtil.h"
-
-#include <assert.h>
-
-#include <string.h>
-
-#ifdef HAVE_GL2PS
-	#include <gl2ps.h>
-#endif
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucRenderingEngineGL_Type = "lucRenderingEngineGL";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucRenderingEngineGL* _lucRenderingEngineGL_New(  LUCRENDERINGENGINEGL_DEFARGS  ) 
-{
-	lucRenderingEngineGL*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucRenderingEngineGL) );
-	self = (lucRenderingEngineGL*) _lucRenderingEngine_New(  LUCRENDERINGENGINE_PASSARGS  );
-	
-	return self;
-}
-
-void _lucRenderingEngineGL_Init( 
-		lucRenderingEngineGL*                                      self  ) {}
-
-void _lucRenderingEngineGL_Delete( void* renderingEngine ) {
-	lucRenderingEngineGL*  self = (lucRenderingEngineGL*)renderingEngine;
-
-	_lucRenderingEngine_Delete( self );
-}
-
-void _lucRenderingEngineGL_Print( void* renderingEngine, Stream* stream ) {
-	lucRenderingEngineGL*  self = (lucRenderingEngineGL*)renderingEngine;
-
-	_lucRenderingEngine_Print( self, stream );
-}
-
-void* _lucRenderingEngineGL_Copy( void* renderingEngine, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucRenderingEngineGL*  self = (lucRenderingEngineGL*)renderingEngine;
-	lucRenderingEngineGL* newRenderingEngine;
-
-	newRenderingEngine = _lucRenderingEngine_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newRenderingEngine;
-}
-
-
-void* _lucRenderingEngineGL_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                  _sizeOfSelf = sizeof(lucRenderingEngineGL);
-	Type                                                          type = lucRenderingEngineGL_Type;
-	Stg_Class_DeleteFunction*                                  _delete = _lucRenderingEngineGL_Delete;
-	Stg_Class_PrintFunction*                                    _print = _lucRenderingEngineGL_Print;
-	Stg_Class_CopyFunction*                                      _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucRenderingEngineGL_DefaultNew;
-	Stg_Component_ConstructFunction*                        _construct = _lucRenderingEngineGL_AssignFromXML;
-	Stg_Component_BuildFunction*                                _build = _lucRenderingEngineGL_Build;
-	Stg_Component_InitialiseFunction*                      _initialise = _lucRenderingEngineGL_Initialise;
-	Stg_Component_ExecuteFunction*                            _execute = _lucRenderingEngineGL_Execute;
-	Stg_Component_DestroyFunction*                            _destroy = _lucRenderingEngineGL_Destroy;
-	lucRenderingEngine_RenderFunction*                         _render = _lucRenderingEngineGL_Render;
-	lucRenderingEngine_ClearFunction*                           _clear = _lucRenderingEngineGL_Clear;
-	lucRenderingEngine_GetPixelDataFunction*             _getPixelData = _lucRenderingEngineGL_GetPixelData;
-	lucRenderingEngine_CompositeViewportFunction*   _compositeViewport = _lucRenderingEngineGL_CompositeViewport_Stencil;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucRenderingEngineGL_New(  LUCRENDERINGENGINEGL_PASSARGS  );
-}
-
-void _lucRenderingEngineGL_AssignFromXML( void* renderingEngine, Stg_ComponentFactory* cf, void* data ){
-	lucRenderingEngineGL*  self = (lucRenderingEngineGL*)renderingEngine;
-
-	/* Construct Parent */
-	_lucRenderingEngine_AssignFromXML( self, cf, data );
-	
-	_lucRenderingEngineGL_Init( self );
-}
-
-void _lucRenderingEngineGL_Build( void* renderingEngine, void* data ) {}
-void _lucRenderingEngineGL_Initialise( void* renderingEngine, void* data ) {}
-void _lucRenderingEngineGL_Execute( void* renderingEngine, void* data ) {}
-void _lucRenderingEngineGL_Destroy( void* renderingEngine, void* data ) {}
-
-void _lucRenderingEngineGL_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) {
-	lucRenderingEngineGL*	self = (lucRenderingEngineGL*) renderingEngine;
-	lucViewport*				viewport;
-	Viewport_Index				viewport_I;
-	Viewport_Index				viewportCount = window->viewportCount;
-	lucViewportInfo*			viewportInfo;
-	#ifdef HAVE_GL2PS
-	GLint							viewport_gl2ps[4];
-	GLint							state;
-	#endif
-	
-	Journal_DPrintfL( lucDebug, 2, "In func: %s for %s '%s'\n", __func__, self->type, self->name );
-	Stream_Indent( lucDebug );
-
-    /* Determine if context is double buffered or not and save flag */
-    glGetBooleanv(GL_DOUBLEBUFFER, &self->doubleBuffered);
-	/* Set up OpenGl Colour */
-	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);	
-	glEnable(GL_COLOR_MATERIAL);
-	glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
- 	/*	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);  -- Done in the viewport now	*/	
-    glDrawBuffer(self->doubleBuffered ? GL_BACK_LEFT : GL_FRONT_LEFT);
-    GL_Error_Check
-
-	/* Allow Transparency */
-	glEnable (GL_BLEND);
-	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
-	glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
-
-    /* Interpolate colours between polygon vertices, looks nice but not technically accurate */
-    glShadeModel( GL_SMOOTH ); 
-
-	glEnable(GL_DEPTH_TEST);
-
-	lucWindow_Broadcast( window, 0, MPI_COMM_WORLD );
-	lucWindow_CheckCameraFlag( window );
-	lucWindow_CheckLightFlag( window );
-
-	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
-		viewportInfo = &window->viewportInfoList[ viewport_I ];
-		viewport = viewportInfo->viewport;
-
-		Journal_DPrintfL( lucDebug, 2, "In loop for viewport '%s'.\n", viewport->name );
-		Stream_Indent( lucDebug );
-		
-		/* Set viewport */
-		Journal_DPrintfL( lucDebug, 2, "Rendering viewport: (%d,%d) %d x %d\n", viewportInfo->startx, viewportInfo->starty, viewportInfo->width, viewportInfo->height);
-		glViewport( viewportInfo->startx, viewportInfo->starty, viewportInfo->width, viewportInfo->height);
-		glScissor( viewportInfo->startx, viewportInfo->starty, viewportInfo->width, viewportInfo->height);
-		if ( ! viewportInfo->needsToDraw ) {
-			Journal_DPrintfL( lucDebug, 2, "Viewport '%s' doesn't need to be redrawn.\n", viewport->name );
-			Stream_UnIndent( lucDebug );
-			continue;
-		}
-		
-		#ifdef HAVE_GL2PS
-			/* calls to gl2ps so that different viewports are created for vector image outputs */
-			glGetIntegerv(GL_VIEWPORT, viewport_gl2ps);
-			state = gl2psBeginViewport(viewport_gl2ps);
-			if(state == 5)
-				Journal_Printf( Journal_MyStream( Error_Type, self ), "\nError. Insufficient GL feedback buffer size. \
-										       \nConsider increasing the OutputVECTOR buffersize. \
-										      \nVector image will not be created correctly.\n\n" );
-		#endif
-		
-		/* Clear viewport */
-		self->_clear(self, window, False);
-
-		if (context->rank == MASTER)
-			lucRenderingEngineGL_WriteViewportText( self, window, viewportInfo, context );
-			
-			
-		Journal_DPrintfL( lucDebug, 2, "(%s) Resetting camera...", __func__);
-		
-		switch ( viewport->camera->stereoType ) {
-			case lucMono:
-				lucViewportInfo_SetOpenGLCamera( viewportInfo );
-				lucViewport_Draw( viewport, window, viewportInfo, context );
-				break;
-			case lucStereoToeIn: case lucStereoAsymmetric:
-                glDrawBuffer(self->doubleBuffered ? GL_BACK_RIGHT : GL_FRONT_RIGHT);
-				viewport->camera->buffer = lucRight;
-
-				lucViewportInfo_SetOpenGLCamera( viewportInfo );
-				lucViewport_Draw( viewport, window, viewportInfo, context );
-
-                glDrawBuffer(self->doubleBuffered ? GL_BACK_LEFT : GL_FRONT_LEFT);
-				viewport->camera->buffer = lucLeft;
-				
-				lucViewportInfo_SetOpenGLCamera( viewportInfo );
-				lucViewport_Draw( viewport, window, viewportInfo, context );
-		}
-		
-		viewportInfo->needsToDraw = False;
-
-		Stream_UnIndent( lucDebug );
-		Journal_DPrintfL( lucDebug, 2, "Finished loop.\n" );
-
-		#ifdef HAVE_GL2PS		
-			state = gl2psEndViewport();
-			if(state == 5)
-				Journal_Printf( Journal_MyStream( Error_Type, self ), "\nError. Insufficient GL feedback buffer size. \
-										       \nConsider increasing the OutputVECTOR buffersize. \
-										      \nVector image will not be created correctly.\n\n" );
-		#endif		
-	}
-
-	Stream_UnIndent( lucDebug );
-	Journal_DPrintfL( lucDebug, 2, "Leaving func %s\n", __func__ );
-}
-
-void _lucRenderingEngineGL_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* buffer ) {
-	lucRenderingEngineGL* self              = (lucRenderingEngineGL*) renderingEngine;
-	GLsizei width  = window->width;
-	GLsizei height = window->height;
-	
-	glPixelStorei(GL_PACK_ALIGNMENT,1);
-	
-	if ( lucWindow_HasStereoCamera( window ) ) {
-		if ( window->currStereoBuffer == lucRight )
-			glReadBuffer( self->doubleBuffered ? GL_BACK_RIGHT : GL_FRONT_RIGHT );
-		else
-			glReadBuffer( self->doubleBuffered ? GL_BACK_LEFT : GL_FRONT_LEFT);
-	}
-	else
-		glReadBuffer( self->doubleBuffered ? GL_BACK : GL_FRONT );
-	
-	/* Actually read the pixels. */
-	glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer); 
-}
-
-void lucRenderingEngineGL_WriteViewportText( void* renderingEngine, lucWindow* window, lucViewportInfo* viewportInfo, AbstractContext* context ) {
-	lucViewport* viewport = viewportInfo->viewport;
-
-	/* Set up 2D Viewer the size of the viewport */
-	lucViewport2d(True, viewportInfo);
-	
-	/* Set the colour so that it'll show up against the background */
-	lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
-
-
-	/* Print Time Stamp */
-	if (viewport->drawTime) {
-		char* timeString;
-		Stg_asprintf( &timeString, "%g", context->currentTime );
-		glRasterPos2i( 0, 13 );
-		lucPrintString( timeString );
-		Memory_Free( timeString );
-	}
-
-	/* Restore the viewport */
-	lucViewport2d(False, viewportInfo);	
-}
-
-void _lucRenderingEngineGL_Clear( void* renderingEngineGL, lucWindow* window, Bool clearAll ) {
-	if (clearAll)
-	{
-		glViewport(0, 0, window->width, window->height);
-		glScissor(0, 0, window->width, window->height);
-	}
-    
-    glEnable (GL_SCISSOR_TEST);
-    glClearColor(window->backgroundColour.red, window->backgroundColour.green,
-                 window->backgroundColour.blue, window->backgroundColour.opacity );
-    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-}
-
-Index lucRenderingEngineGL_MapBufferIdToRank( void* renderingEngineGL, Index bufferId, Index mergeCount ) {
-	Index merge_I;
-	Index rank;
-
-	rank = bufferId;
-	for ( merge_I = 0 ; merge_I < mergeCount ; merge_I++ )
-		rank *= 2;
-
-	return rank;
-}
-
-/* This function is quite a bit faster that the _lucRenderingEngineGL_CompositeViewport_Manual one but it will not work if
- * you don't have the stencil buffer */ 
-void _lucRenderingEngineGL_CompositeViewport_Stencil( 
-		void*                                              renderingEngine, 
-		lucViewportInfo*                                   viewportInfo, 
-		AbstractContext*                                   context, 
-		Bool                                               broadcast ) 
-{
-	lucRenderingEngineGL* self                 = (lucRenderingEngineGL*) renderingEngine;
-	Pixel_Index           width                = viewportInfo->width;
-	Pixel_Index           height               = viewportInfo->height;
-	Pixel_Index           startx               = viewportInfo->startx;
-	Pixel_Index           starty               = viewportInfo->starty;
-	Index                 buffersToMerge;
-	Index                 neighbourRank;
-	Index                 bufferId             = context->rank;
-	Pixel_Index           pixelCount           = width*height;
-	Index                 mergeCount           = 0;
-	float*                depthBuffer;
-	lucPixel*             imageBuffer;
-	MPI_Status            status;
-	MPI_Comm              comm                 = context->communicator;
-	
-	glEnable(GL_STENCIL_TEST);				
-	/* Make sure that we can use the stencil buffer */
-	if ( !glIsEnabled( GL_STENCIL_TEST ) ) {
-		self->_compositeViewport = _lucRenderingEngineGL_CompositeViewport_Manual;
-		_lucRenderingEngineGL_CompositeViewport_Manual( self, viewportInfo, context, broadcast );
-		return;
-	}
-
-	/* Set matrices up so we are in pixel coordinates */
-	glPushMatrix();
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-	gluOrtho2D( 0.0, (GLfloat) width, 0.0, (GLfloat) height );
-	glMatrixMode(GL_MODELVIEW);
-	glLoadIdentity();	
-	glRasterPos2i( 0, 0 );
-	glPixelStorei(GL_PACK_ALIGNMENT,1);
-	glPixelStorei(GL_UNPACK_ALIGNMENT,1);
-	glClearStencil(0x0);
-
-	imageBuffer = Memory_Alloc_Array( lucPixel, pixelCount, "Image Buffer" );
-	depthBuffer = Memory_Alloc_Array( float,    pixelCount, "Depth Buffer" );
-
-	/* Merge Buffers */
-	for ( buffersToMerge = context->nproc - 1 ; buffersToMerge > 0 ; buffersToMerge = div( buffersToMerge, 2 ).quot ) {
-		/* If my ID is odd - then send the buffer and get out of loop */
-		if ( bufferId % 2 == 1 ) {
-			/* Send buffer to left */
-			neighbourRank = lucRenderingEngineGL_MapBufferIdToRank( self, bufferId - 1, mergeCount );
-			Journal_DPrintfL( lucDebug, 2, "Sending buffers to processor '%d'\n", neighbourRank );
-
-			glReadPixels( startx, starty, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer);
-			MPI_Send( depthBuffer, pixelCount, MPI_FLOAT, neighbourRank, GL_DEPTH_COMPONENT, comm );
-
-			glReadPixels( startx, starty, width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer);
-			MPI_Send( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, neighbourRank, GL_RGB,             comm );
-			
-			/* Now that I've sent my info - I can quit this loop */
-			break;
-		}
-		else {
-			/* Only merge if you are not the last processor to have a buffer */
-			if ( bufferId < buffersToMerge ) {
-				/* Receive Buffer from Right */
-				neighbourRank = lucRenderingEngineGL_MapBufferIdToRank( self, bufferId + 1, mergeCount );
-				Journal_DPrintfL( lucDebug, 2, "Receiving buffers from processor '%d'\n", neighbourRank );
-
-				/**************** Merge these two buffers ***********************/
-				/* See http://www.opengl.org/resources/tutorials/advanced/advanced97/notes/node200.html */
-
-				/* Clear the stencil buffer */
-				glClear( GL_STENCIL_BUFFER_BIT );
-
-				/* Ensure depth testing is set */
-				glEnable(GL_DEPTH_TEST);
-
-				/* Disable the color buffer for writing */
-				glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
-
-				/* Set stencil values to 1 when the depth test passes */
-				glStencilFunc(GL_ALWAYS, 1, 1);
-				glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
-
-				/* Draw the depth values to the frame buffer */
-				glRasterPos2i( 0, 0 );
-				MPI_Recv( depthBuffer, pixelCount, MPI_FLOAT, neighbourRank, GL_DEPTH_COMPONENT, comm, &status );
-				glDrawPixels( width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer );
-
-				/* Set the stencil buffer to test for stencil values of 1 */
-				glStencilFunc(GL_EQUAL, 1, 1);
-				glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-
-				/* Disable the depth testing */
-				glDisable(GL_DEPTH_TEST);
-
-				/* Draw the color values to the frame buffer */
-				glRasterPos2i( 0, 0 );
-				glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
-				MPI_Recv( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, neighbourRank, GL_RGB, comm, &status );
-				glDrawPixels( width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer );
-			}
-
-			/* Change buffer id */
-			bufferId = div( bufferId, 2 ).quot;
-		}
-		mergeCount++;
-	}
-
-	if ( broadcast ) {
-		/* All pixels are composited onto the master's processor - 
-		 * we'll grab these pixels */
-		if ( context->rank == MASTER ) {
-			glReadPixels( startx, starty, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer);
-			glReadPixels( startx, starty, width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer);
-		}
-
-		/* Send composited pixel data to other processors */
-		MPI_Bcast ( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, 0, comm );
-		MPI_Bcast ( depthBuffer, pixelCount,     MPI_FLOAT,         0, comm );
-
-		if ( context->rank != MASTER ) {
-			glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-			glDisable( GL_DEPTH_TEST );
-			
-			/* Apply Master's composited depth buffer to this processor */
-			glRasterPos2i( 0, 0 );
-			glDrawPixels( width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer );
-			
-			/* Apply Master's composited image buffer to this processor */
-			glRasterPos2i( 0, 0 );
-			glDrawPixels( width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer );
-		}
-	}
-	
-	/* Reset some opengl stuff */
-	glDisable( GL_STENCIL_TEST );
-	glEnable(GL_DEPTH_TEST);
-	glPopMatrix();
-	Journal_DPrintfL( lucDebug, 2, "(%s) Resetting camera...", __func__);
-	lucViewportInfo_SetOpenGLCamera( viewportInfo );
-
-	/* Clean up allocated memory */
-	Memory_Free( imageBuffer );
-	Memory_Free( depthBuffer );
-}
-
-void lucRenderingEngineGL_CombineToMaster( 
-		void*                                              renderingEngine,
-		lucViewportInfo*                                   viewportInfo,
-		AbstractContext*                                   context,
-		lucPixel*                                          imageBuffer, 
-		float*                                             depthBuffer )
-{
-	lucRenderingEngineGL* self                 = (lucRenderingEngineGL*) renderingEngine;
-	Pixel_Index           width                = viewportInfo->width;
-	Pixel_Index           height               = viewportInfo->height;
-	Index                 buffersToMerge;
-	Index                 neighbourRank;
-	Index                 bufferId             = context->rank;
-	Pixel_Index           pixel_I;
-	Pixel_Index           pixelCount           = width*height;
-	Index                 mergeCount           = 0;
-	float*                neighbourDepthBuffer;
-	lucPixel*             neighbourImageBuffer;
-	MPI_Status            status;
-	MPI_Comm              comm                 = context->communicator;
-	
-	Journal_DPrintfL( lucDebug, 2, "In func: %s\n", __func__ );
-	
-	neighbourImageBuffer = Memory_Alloc_Array( lucPixel, pixelCount, "Neighbour's Image Buffer" );
-	neighbourDepthBuffer = Memory_Alloc_Array( float,    pixelCount, "Neighbour's Depth Buffer" );
-
-	/* Merge Buffers */
-	for ( buffersToMerge = context->nproc - 1 ; buffersToMerge > 0 ; buffersToMerge = div( buffersToMerge, 2 ).quot ) {
-		/* If my ID is odd - then send the buffer and get out of loop */
-		if ( bufferId % 2 == 1 ) {
-			/* Send buffer to left */
-			neighbourRank = lucRenderingEngineGL_MapBufferIdToRank( self, bufferId - 1, mergeCount );
-			MPI_Send( depthBuffer, pixelCount,     MPI_FLOAT,         neighbourRank, GL_DEPTH_COMPONENT, comm );
-			MPI_Send( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, neighbourRank, GL_RGB,             comm );
-			
-			/* Now that I've sent my info - I can quit this loop */
-			break;
-		}
-		else {
-			/* Only merge if you are not the last processor to have a buffer */
-			if ( bufferId < buffersToMerge ) {
-				/* Receive Buffer from Right */
-				neighbourRank = lucRenderingEngineGL_MapBufferIdToRank( self, bufferId + 1, mergeCount );
-				MPI_Recv( neighbourDepthBuffer, pixelCount, MPI_FLOAT, neighbourRank, GL_DEPTH_COMPONENT, comm, &status );
-				MPI_Recv( neighbourImageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, neighbourRank, GL_RGB, comm, &status );
-
-				/* Merge two buffers */
-				for ( pixel_I = 0 ; pixel_I < pixelCount ; pixel_I++ ) {
-					if ( neighbourDepthBuffer[ pixel_I ] < depthBuffer[ pixel_I ] ) {
-						memcpy( &depthBuffer[ pixel_I ], &neighbourDepthBuffer[ pixel_I ], sizeof( float ) );
-						memcpy( &imageBuffer[ pixel_I ], &neighbourImageBuffer[ pixel_I ], sizeof( lucPixel ) );
-					}
-				}
-			}
-
-			/* Change buffer id */
-			bufferId = div( bufferId, 2 ).quot;
-		}
-		mergeCount++;
-	}
-	
-	Memory_Free( neighbourImageBuffer );
-	Memory_Free( neighbourDepthBuffer );
-	
-	Journal_DPrintfL( lucDebug, 2, "Leaving: %s\n", __func__ );
-}
-
-void _lucRenderingEngineGL_CompositeViewport_Manual( 
-		void*                                              renderingEngine, 
-		lucViewportInfo*                                   viewportInfo, 
-		AbstractContext*                                   context, 
-		Bool                                               broadcast ) 
-{
-	lucRenderingEngineGL* self              = (lucRenderingEngineGL*) renderingEngine;
-	Pixel_Index           width             = viewportInfo->width;
-	Pixel_Index           height            = viewportInfo->height;
-	Pixel_Index           startx            = viewportInfo->startx;
-	Pixel_Index           starty            = viewportInfo->starty;
-	lucViewport*          viewport          = viewportInfo->viewport;
-	Pixel_Index           pixelCount        = width*height;
-	float*                depthBuffer;
-	lucPixel*             imageBuffer;
-	MPI_Comm              comm              = context->communicator;
-
-	Journal_DPrintfL( lucDebug, 2, "In func: %s - Viewport %s\n", __func__, viewport->name );
-
-	/* Allocate Memory */
-	imageBuffer          = Memory_Alloc_Array( lucPixel, pixelCount, "Image Buffer" );
-	depthBuffer          = Memory_Alloc_Array( float,    pixelCount, "Depth Buffer" );
-	
-	/* Read depth buffer */
-	glPixelStorei(GL_PACK_ALIGNMENT,1);
-	glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
-	glReadPixels( startx, starty, width, height, GL_RGB,             GL_UNSIGNED_BYTE, imageBuffer);
-	glReadPixels( startx, starty, width, height, GL_DEPTH_COMPONENT, GL_FLOAT,         depthBuffer);
-
-	lucRenderingEngineGL_CombineToMaster( self, viewportInfo, context, imageBuffer, depthBuffer );
-
-	/* Broadcast master's pixels info */
-	if (broadcast) {
-		MPI_Bcast ( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, 0, comm );
-		MPI_Bcast ( depthBuffer, pixelCount,     MPI_FLOAT,         0, comm );
-	}
-		
-	/* Reset Pixels */
-	if (context->rank == MASTER || broadcast) {
-		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
-		glPushMatrix();
-		glMatrixMode(GL_PROJECTION);
-		glLoadIdentity();
-		gluOrtho2D( 0.0, (GLfloat) width, 0.0, (GLfloat) height );
-		glMatrixMode(GL_MODELVIEW);
-		glLoadIdentity();	
-
-		glPixelStorei(GL_UNPACK_ALIGNMENT,1);
-		glRasterPos2i( 0, 0 );
-		glDrawPixels( width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer );
-		
-		glRasterPos2i( 0, 0 );
-		glDisable(GL_DEPTH_TEST);
-		glDrawPixels( width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer );
-		glEnable(GL_DEPTH_TEST);
-		
-		glPopMatrix();
-		lucViewportInfo_SetOpenGLCamera( viewportInfo );
-	}
-
-	/* Clean up */
-	Memory_Free( imageBuffer );
-	Memory_Free( depthBuffer );
-	
-	Journal_DPrintfL( lucDebug, 2, "Leaving: %s\n", __func__ );
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/src/RenderingEngineGL.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RenderingEngines/src/RenderingEngineGL.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,611 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: RenderingEngineGL.c 791 2008-09-01 02:09:06Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "RenderingEngineGL.h"
+#include "OpenGlUtil.h"
+
+#include <assert.h>
+
+#include <string.h>
+
+#ifdef HAVE_GL2PS
+	#include <gl2ps.h>
+#endif
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucRenderingEngineGL_Type = "lucRenderingEngineGL";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucRenderingEngineGL* _lucRenderingEngineGL_New(  LUCRENDERINGENGINEGL_DEFARGS  ) 
+{
+	lucRenderingEngineGL*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucRenderingEngineGL) );
+	self = (lucRenderingEngineGL*) _lucRenderingEngine_New(  LUCRENDERINGENGINE_PASSARGS  );
+	
+	return self;
+}
+
+void _lucRenderingEngineGL_Init( 
+		lucRenderingEngineGL*                                      self  ) {}
+
+void _lucRenderingEngineGL_Delete( void* renderingEngine ) {
+	lucRenderingEngineGL*  self = (lucRenderingEngineGL*)renderingEngine;
+
+	_lucRenderingEngine_Delete( self );
+}
+
+void _lucRenderingEngineGL_Print( void* renderingEngine, Stream* stream ) {
+	lucRenderingEngineGL*  self = (lucRenderingEngineGL*)renderingEngine;
+
+	_lucRenderingEngine_Print( self, stream );
+}
+
+void* _lucRenderingEngineGL_Copy( void* renderingEngine, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucRenderingEngineGL*  self = (lucRenderingEngineGL*)renderingEngine;
+	lucRenderingEngineGL* newRenderingEngine;
+
+	newRenderingEngine = _lucRenderingEngine_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newRenderingEngine;
+}
+
+
+void* _lucRenderingEngineGL_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                  _sizeOfSelf = sizeof(lucRenderingEngineGL);
+	Type                                                          type = lucRenderingEngineGL_Type;
+	Stg_Class_DeleteFunction*                                  _delete = _lucRenderingEngineGL_Delete;
+	Stg_Class_PrintFunction*                                    _print = _lucRenderingEngineGL_Print;
+	Stg_Class_CopyFunction*                                      _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucRenderingEngineGL_DefaultNew;
+	Stg_Component_ConstructFunction*                        _construct = _lucRenderingEngineGL_AssignFromXML;
+	Stg_Component_BuildFunction*                                _build = _lucRenderingEngineGL_Build;
+	Stg_Component_InitialiseFunction*                      _initialise = _lucRenderingEngineGL_Initialise;
+	Stg_Component_ExecuteFunction*                            _execute = _lucRenderingEngineGL_Execute;
+	Stg_Component_DestroyFunction*                            _destroy = _lucRenderingEngineGL_Destroy;
+	lucRenderingEngine_RenderFunction*                         _render = _lucRenderingEngineGL_Render;
+	lucRenderingEngine_ClearFunction*                           _clear = _lucRenderingEngineGL_Clear;
+	lucRenderingEngine_GetPixelDataFunction*             _getPixelData = _lucRenderingEngineGL_GetPixelData;
+	lucRenderingEngine_CompositeViewportFunction*   _compositeViewport = _lucRenderingEngineGL_CompositeViewport_Stencil;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucRenderingEngineGL_New(  LUCRENDERINGENGINEGL_PASSARGS  );
+}
+
+void _lucRenderingEngineGL_AssignFromXML( void* renderingEngine, Stg_ComponentFactory* cf, void* data ){
+	lucRenderingEngineGL*  self = (lucRenderingEngineGL*)renderingEngine;
+
+	/* Construct Parent */
+	_lucRenderingEngine_AssignFromXML( self, cf, data );
+	
+	_lucRenderingEngineGL_Init( self );
+}
+
+void _lucRenderingEngineGL_Build( void* renderingEngine, void* data ) {}
+void _lucRenderingEngineGL_Initialise( void* renderingEngine, void* data ) {}
+void _lucRenderingEngineGL_Execute( void* renderingEngine, void* data ) {}
+void _lucRenderingEngineGL_Destroy( void* renderingEngine, void* data ) {}
+
+void _lucRenderingEngineGL_Render( void* renderingEngine, lucWindow* window, AbstractContext* context ) {
+	lucRenderingEngineGL*	self = (lucRenderingEngineGL*) renderingEngine;
+	lucViewport*				viewport;
+	Viewport_Index				viewport_I;
+	Viewport_Index				viewportCount = window->viewportCount;
+	lucViewportInfo*			viewportInfo;
+	#ifdef HAVE_GL2PS
+	GLint							viewport_gl2ps[4];
+	GLint							state;
+	#endif
+	
+	Journal_DPrintfL( lucDebug, 2, "In func: %s for %s '%s'\n", __func__, self->type, self->name );
+	Stream_Indent( lucDebug );
+
+    /* Determine if context is double buffered or not and save flag */
+    glGetBooleanv(GL_DOUBLEBUFFER, &self->doubleBuffered);
+	/* Set up OpenGl Colour */
+	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);	
+	glEnable(GL_COLOR_MATERIAL);
+	glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
+ 	/*	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);  -- Done in the viewport now	*/	
+    glDrawBuffer(self->doubleBuffered ? GL_BACK_LEFT : GL_FRONT_LEFT);
+    GL_Error_Check
+
+	/* Allow Transparency */
+	glEnable (GL_BLEND);
+	glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+	glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
+
+    /* Interpolate colours between polygon vertices, looks nice but not technically accurate */
+    glShadeModel( GL_SMOOTH ); 
+
+	glEnable(GL_DEPTH_TEST);
+
+	lucWindow_Broadcast( window, 0, MPI_COMM_WORLD );
+	lucWindow_CheckCameraFlag( window );
+	lucWindow_CheckLightFlag( window );
+
+	for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+		viewportInfo = &window->viewportInfoList[ viewport_I ];
+		viewport = viewportInfo->viewport;
+
+		Journal_DPrintfL( lucDebug, 2, "In loop for viewport '%s'.\n", viewport->name );
+		Stream_Indent( lucDebug );
+		
+		/* Set viewport */
+		Journal_DPrintfL( lucDebug, 2, "Rendering viewport: (%d,%d) %d x %d\n", viewportInfo->startx, viewportInfo->starty, viewportInfo->width, viewportInfo->height);
+		glViewport( viewportInfo->startx, viewportInfo->starty, viewportInfo->width, viewportInfo->height);
+		glScissor( viewportInfo->startx, viewportInfo->starty, viewportInfo->width, viewportInfo->height);
+		if ( ! viewportInfo->needsToDraw ) {
+			Journal_DPrintfL( lucDebug, 2, "Viewport '%s' doesn't need to be redrawn.\n", viewport->name );
+			Stream_UnIndent( lucDebug );
+			continue;
+		}
+		
+		#ifdef HAVE_GL2PS
+			/* calls to gl2ps so that different viewports are created for vector image outputs */
+			glGetIntegerv(GL_VIEWPORT, viewport_gl2ps);
+			state = gl2psBeginViewport(viewport_gl2ps);
+			if(state == 5)
+				Journal_Printf( Journal_MyStream( Error_Type, self ), "\nError. Insufficient GL feedback buffer size. \
+										       \nConsider increasing the OutputVECTOR buffersize. \
+										      \nVector image will not be created correctly.\n\n" );
+		#endif
+		
+		/* Clear viewport */
+		self->_clear(self, window, False);
+
+		if (context->rank == MASTER)
+			lucRenderingEngineGL_WriteViewportText( self, window, viewportInfo, context );
+			
+			
+		Journal_DPrintfL( lucDebug, 2, "(%s) Resetting camera...", __func__);
+		
+		switch ( viewport->camera->stereoType ) {
+			case lucMono:
+				lucViewportInfo_SetOpenGLCamera( viewportInfo );
+				lucViewport_Draw( viewport, window, viewportInfo, context );
+				break;
+			case lucStereoToeIn: case lucStereoAsymmetric:
+                glDrawBuffer(self->doubleBuffered ? GL_BACK_RIGHT : GL_FRONT_RIGHT);
+				viewport->camera->buffer = lucRight;
+
+				lucViewportInfo_SetOpenGLCamera( viewportInfo );
+				lucViewport_Draw( viewport, window, viewportInfo, context );
+
+                glDrawBuffer(self->doubleBuffered ? GL_BACK_LEFT : GL_FRONT_LEFT);
+				viewport->camera->buffer = lucLeft;
+				
+				lucViewportInfo_SetOpenGLCamera( viewportInfo );
+				lucViewport_Draw( viewport, window, viewportInfo, context );
+		}
+		
+		viewportInfo->needsToDraw = False;
+
+		Stream_UnIndent( lucDebug );
+		Journal_DPrintfL( lucDebug, 2, "Finished loop.\n" );
+
+		#ifdef HAVE_GL2PS		
+			state = gl2psEndViewport();
+			if(state == 5)
+				Journal_Printf( Journal_MyStream( Error_Type, self ), "\nError. Insufficient GL feedback buffer size. \
+										       \nConsider increasing the OutputVECTOR buffersize. \
+										      \nVector image will not be created correctly.\n\n" );
+		#endif		
+	}
+
+	Stream_UnIndent( lucDebug );
+	Journal_DPrintfL( lucDebug, 2, "Leaving func %s\n", __func__ );
+}
+
+void _lucRenderingEngineGL_GetPixelData( void* renderingEngine, lucWindow* window, lucPixel* buffer ) {
+	lucRenderingEngineGL* self              = (lucRenderingEngineGL*) renderingEngine;
+	GLsizei width  = window->width;
+	GLsizei height = window->height;
+	
+	glPixelStorei(GL_PACK_ALIGNMENT,1);
+	
+	if ( lucWindow_HasStereoCamera( window ) ) {
+		if ( window->currStereoBuffer == lucRight )
+			glReadBuffer( self->doubleBuffered ? GL_BACK_RIGHT : GL_FRONT_RIGHT );
+		else
+			glReadBuffer( self->doubleBuffered ? GL_BACK_LEFT : GL_FRONT_LEFT);
+	}
+	else
+		glReadBuffer( self->doubleBuffered ? GL_BACK : GL_FRONT );
+	
+	/* Actually read the pixels. */
+	glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer); 
+}
+
+void lucRenderingEngineGL_WriteViewportText( void* renderingEngine, lucWindow* window, lucViewportInfo* viewportInfo, AbstractContext* context ) {
+	lucViewport* viewport = viewportInfo->viewport;
+
+	/* Set up 2D Viewer the size of the viewport */
+	lucViewport2d(True, viewportInfo);
+	
+	/* Set the colour so that it'll show up against the background */
+	lucColour_SetComplimentaryOpenGLColour( &window->backgroundColour );
+
+
+	/* Print Time Stamp */
+	if (viewport->drawTime) {
+		char* timeString;
+		Stg_asprintf( &timeString, "%g", context->currentTime );
+		glRasterPos2i( 0, 13 );
+		lucPrintString( timeString );
+		Memory_Free( timeString );
+	}
+
+	/* Restore the viewport */
+	lucViewport2d(False, viewportInfo);	
+}
+
+void _lucRenderingEngineGL_Clear( void* renderingEngineGL, lucWindow* window, Bool clearAll ) {
+	if (clearAll)
+	{
+		glViewport(0, 0, window->width, window->height);
+		glScissor(0, 0, window->width, window->height);
+	}
+    
+    glEnable (GL_SCISSOR_TEST);
+    glClearColor(window->backgroundColour.red, window->backgroundColour.green,
+                 window->backgroundColour.blue, window->backgroundColour.opacity );
+    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+}
+
+Index lucRenderingEngineGL_MapBufferIdToRank( void* renderingEngineGL, Index bufferId, Index mergeCount ) {
+	Index merge_I;
+	Index rank;
+
+	rank = bufferId;
+	for ( merge_I = 0 ; merge_I < mergeCount ; merge_I++ )
+		rank *= 2;
+
+	return rank;
+}
+
+/* This function is quite a bit faster that the _lucRenderingEngineGL_CompositeViewport_Manual one but it will not work if
+ * you don't have the stencil buffer */ 
+void _lucRenderingEngineGL_CompositeViewport_Stencil( 
+		void*                                              renderingEngine, 
+		lucViewportInfo*                                   viewportInfo, 
+		AbstractContext*                                   context, 
+		Bool                                               broadcast ) 
+{
+	lucRenderingEngineGL* self                 = (lucRenderingEngineGL*) renderingEngine;
+	Pixel_Index           width                = viewportInfo->width;
+	Pixel_Index           height               = viewportInfo->height;
+	Pixel_Index           startx               = viewportInfo->startx;
+	Pixel_Index           starty               = viewportInfo->starty;
+	Index                 buffersToMerge;
+	Index                 neighbourRank;
+	Index                 bufferId             = context->rank;
+	Pixel_Index           pixelCount           = width*height;
+	Index                 mergeCount           = 0;
+	float*                depthBuffer;
+	lucPixel*             imageBuffer;
+	MPI_Status            status;
+	MPI_Comm              comm                 = context->communicator;
+	
+	glEnable(GL_STENCIL_TEST);				
+	/* Make sure that we can use the stencil buffer */
+	if ( !glIsEnabled( GL_STENCIL_TEST ) ) {
+		self->_compositeViewport = _lucRenderingEngineGL_CompositeViewport_Manual;
+		_lucRenderingEngineGL_CompositeViewport_Manual( self, viewportInfo, context, broadcast );
+		return;
+	}
+
+	/* Set matrices up so we are in pixel coordinates */
+	glPushMatrix();
+	glMatrixMode(GL_PROJECTION);
+	glLoadIdentity();
+	gluOrtho2D( 0.0, (GLfloat) width, 0.0, (GLfloat) height );
+	glMatrixMode(GL_MODELVIEW);
+	glLoadIdentity();	
+	glRasterPos2i( 0, 0 );
+	glPixelStorei(GL_PACK_ALIGNMENT,1);
+	glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+	glClearStencil(0x0);
+
+	imageBuffer = Memory_Alloc_Array( lucPixel, pixelCount, "Image Buffer" );
+	depthBuffer = Memory_Alloc_Array( float,    pixelCount, "Depth Buffer" );
+
+	/* Merge Buffers */
+	for ( buffersToMerge = context->nproc - 1 ; buffersToMerge > 0 ; buffersToMerge = div( buffersToMerge, 2 ).quot ) {
+		/* If my ID is odd - then send the buffer and get out of loop */
+		if ( bufferId % 2 == 1 ) {
+			/* Send buffer to left */
+			neighbourRank = lucRenderingEngineGL_MapBufferIdToRank( self, bufferId - 1, mergeCount );
+			Journal_DPrintfL( lucDebug, 2, "Sending buffers to processor '%d'\n", neighbourRank );
+
+			glReadPixels( startx, starty, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer);
+			MPI_Send( depthBuffer, pixelCount, MPI_FLOAT, neighbourRank, GL_DEPTH_COMPONENT, comm );
+
+			glReadPixels( startx, starty, width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer);
+			MPI_Send( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, neighbourRank, GL_RGB,             comm );
+			
+			/* Now that I've sent my info - I can quit this loop */
+			break;
+		}
+		else {
+			/* Only merge if you are not the last processor to have a buffer */
+			if ( bufferId < buffersToMerge ) {
+				/* Receive Buffer from Right */
+				neighbourRank = lucRenderingEngineGL_MapBufferIdToRank( self, bufferId + 1, mergeCount );
+				Journal_DPrintfL( lucDebug, 2, "Receiving buffers from processor '%d'\n", neighbourRank );
+
+				/**************** Merge these two buffers ***********************/
+				/* See http://www.opengl.org/resources/tutorials/advanced/advanced97/notes/node200.html */
+
+				/* Clear the stencil buffer */
+				glClear( GL_STENCIL_BUFFER_BIT );
+
+				/* Ensure depth testing is set */
+				glEnable(GL_DEPTH_TEST);
+
+				/* Disable the color buffer for writing */
+				glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
+
+				/* Set stencil values to 1 when the depth test passes */
+				glStencilFunc(GL_ALWAYS, 1, 1);
+				glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+
+				/* Draw the depth values to the frame buffer */
+				glRasterPos2i( 0, 0 );
+				MPI_Recv( depthBuffer, pixelCount, MPI_FLOAT, neighbourRank, GL_DEPTH_COMPONENT, comm, &status );
+				glDrawPixels( width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer );
+
+				/* Set the stencil buffer to test for stencil values of 1 */
+				glStencilFunc(GL_EQUAL, 1, 1);
+				glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+
+				/* Disable the depth testing */
+				glDisable(GL_DEPTH_TEST);
+
+				/* Draw the color values to the frame buffer */
+				glRasterPos2i( 0, 0 );
+				glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
+				MPI_Recv( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, neighbourRank, GL_RGB, comm, &status );
+				glDrawPixels( width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer );
+			}
+
+			/* Change buffer id */
+			bufferId = div( bufferId, 2 ).quot;
+		}
+		mergeCount++;
+	}
+
+	if ( broadcast ) {
+		/* All pixels are composited onto the master's processor - 
+		 * we'll grab these pixels */
+		if ( context->rank == MASTER ) {
+			glReadPixels( startx, starty, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer);
+			glReadPixels( startx, starty, width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer);
+		}
+
+		/* Send composited pixel data to other processors */
+		MPI_Bcast ( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, 0, comm );
+		MPI_Bcast ( depthBuffer, pixelCount,     MPI_FLOAT,         0, comm );
+
+		if ( context->rank != MASTER ) {
+			glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+			glDisable( GL_DEPTH_TEST );
+			
+			/* Apply Master's composited depth buffer to this processor */
+			glRasterPos2i( 0, 0 );
+			glDrawPixels( width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer );
+			
+			/* Apply Master's composited image buffer to this processor */
+			glRasterPos2i( 0, 0 );
+			glDrawPixels( width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer );
+		}
+	}
+	
+	/* Reset some opengl stuff */
+	glDisable( GL_STENCIL_TEST );
+	glEnable(GL_DEPTH_TEST);
+	glPopMatrix();
+	Journal_DPrintfL( lucDebug, 2, "(%s) Resetting camera...", __func__);
+	lucViewportInfo_SetOpenGLCamera( viewportInfo );
+
+	/* Clean up allocated memory */
+	Memory_Free( imageBuffer );
+	Memory_Free( depthBuffer );
+}
+
+void lucRenderingEngineGL_CombineToMaster( 
+		void*                                              renderingEngine,
+		lucViewportInfo*                                   viewportInfo,
+		AbstractContext*                                   context,
+		lucPixel*                                          imageBuffer, 
+		float*                                             depthBuffer )
+{
+	lucRenderingEngineGL* self                 = (lucRenderingEngineGL*) renderingEngine;
+	Pixel_Index           width                = viewportInfo->width;
+	Pixel_Index           height               = viewportInfo->height;
+	Index                 buffersToMerge;
+	Index                 neighbourRank;
+	Index                 bufferId             = context->rank;
+	Pixel_Index           pixel_I;
+	Pixel_Index           pixelCount           = width*height;
+	Index                 mergeCount           = 0;
+	float*                neighbourDepthBuffer;
+	lucPixel*             neighbourImageBuffer;
+	MPI_Status            status;
+	MPI_Comm              comm                 = context->communicator;
+	
+	Journal_DPrintfL( lucDebug, 2, "In func: %s\n", __func__ );
+	
+	neighbourImageBuffer = Memory_Alloc_Array( lucPixel, pixelCount, "Neighbour's Image Buffer" );
+	neighbourDepthBuffer = Memory_Alloc_Array( float,    pixelCount, "Neighbour's Depth Buffer" );
+
+	/* Merge Buffers */
+	for ( buffersToMerge = context->nproc - 1 ; buffersToMerge > 0 ; buffersToMerge = div( buffersToMerge, 2 ).quot ) {
+		/* If my ID is odd - then send the buffer and get out of loop */
+		if ( bufferId % 2 == 1 ) {
+			/* Send buffer to left */
+			neighbourRank = lucRenderingEngineGL_MapBufferIdToRank( self, bufferId - 1, mergeCount );
+			MPI_Send( depthBuffer, pixelCount,     MPI_FLOAT,         neighbourRank, GL_DEPTH_COMPONENT, comm );
+			MPI_Send( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, neighbourRank, GL_RGB,             comm );
+			
+			/* Now that I've sent my info - I can quit this loop */
+			break;
+		}
+		else {
+			/* Only merge if you are not the last processor to have a buffer */
+			if ( bufferId < buffersToMerge ) {
+				/* Receive Buffer from Right */
+				neighbourRank = lucRenderingEngineGL_MapBufferIdToRank( self, bufferId + 1, mergeCount );
+				MPI_Recv( neighbourDepthBuffer, pixelCount, MPI_FLOAT, neighbourRank, GL_DEPTH_COMPONENT, comm, &status );
+				MPI_Recv( neighbourImageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, neighbourRank, GL_RGB, comm, &status );
+
+				/* Merge two buffers */
+				for ( pixel_I = 0 ; pixel_I < pixelCount ; pixel_I++ ) {
+					if ( neighbourDepthBuffer[ pixel_I ] < depthBuffer[ pixel_I ] ) {
+						memcpy( &depthBuffer[ pixel_I ], &neighbourDepthBuffer[ pixel_I ], sizeof( float ) );
+						memcpy( &imageBuffer[ pixel_I ], &neighbourImageBuffer[ pixel_I ], sizeof( lucPixel ) );
+					}
+				}
+			}
+
+			/* Change buffer id */
+			bufferId = div( bufferId, 2 ).quot;
+		}
+		mergeCount++;
+	}
+	
+	Memory_Free( neighbourImageBuffer );
+	Memory_Free( neighbourDepthBuffer );
+	
+	Journal_DPrintfL( lucDebug, 2, "Leaving: %s\n", __func__ );
+}
+
+void _lucRenderingEngineGL_CompositeViewport_Manual( 
+		void*                                              renderingEngine, 
+		lucViewportInfo*                                   viewportInfo, 
+		AbstractContext*                                   context, 
+		Bool                                               broadcast ) 
+{
+	lucRenderingEngineGL* self              = (lucRenderingEngineGL*) renderingEngine;
+	Pixel_Index           width             = viewportInfo->width;
+	Pixel_Index           height            = viewportInfo->height;
+	Pixel_Index           startx            = viewportInfo->startx;
+	Pixel_Index           starty            = viewportInfo->starty;
+	lucViewport*          viewport          = viewportInfo->viewport;
+	Pixel_Index           pixelCount        = width*height;
+	float*                depthBuffer;
+	lucPixel*             imageBuffer;
+	MPI_Comm              comm              = context->communicator;
+
+	Journal_DPrintfL( lucDebug, 2, "In func: %s - Viewport %s\n", __func__, viewport->name );
+
+	/* Allocate Memory */
+	imageBuffer          = Memory_Alloc_Array( lucPixel, pixelCount, "Image Buffer" );
+	depthBuffer          = Memory_Alloc_Array( float,    pixelCount, "Depth Buffer" );
+	
+	/* Read depth buffer */
+	glPixelStorei(GL_PACK_ALIGNMENT,1);
+	glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
+	glReadPixels( startx, starty, width, height, GL_RGB,             GL_UNSIGNED_BYTE, imageBuffer);
+	glReadPixels( startx, starty, width, height, GL_DEPTH_COMPONENT, GL_FLOAT,         depthBuffer);
+
+	lucRenderingEngineGL_CombineToMaster( self, viewportInfo, context, imageBuffer, depthBuffer );
+
+	/* Broadcast master's pixels info */
+	if (broadcast) {
+		MPI_Bcast ( imageBuffer, pixelCount * 3, MPI_UNSIGNED_CHAR, 0, comm );
+		MPI_Bcast ( depthBuffer, pixelCount,     MPI_FLOAT,         0, comm );
+	}
+		
+	/* Reset Pixels */
+	if (context->rank == MASTER || broadcast) {
+		glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
+		glPushMatrix();
+		glMatrixMode(GL_PROJECTION);
+		glLoadIdentity();
+		gluOrtho2D( 0.0, (GLfloat) width, 0.0, (GLfloat) height );
+		glMatrixMode(GL_MODELVIEW);
+		glLoadIdentity();	
+
+		glPixelStorei(GL_UNPACK_ALIGNMENT,1);
+		glRasterPos2i( 0, 0 );
+		glDrawPixels( width, height, GL_DEPTH_COMPONENT, GL_FLOAT, depthBuffer );
+		
+		glRasterPos2i( 0, 0 );
+		glDisable(GL_DEPTH_TEST);
+		glDrawPixels( width, height, GL_RGB, GL_UNSIGNED_BYTE, imageBuffer );
+		glEnable(GL_DEPTH_TEST);
+		
+		glPopMatrix();
+		lucViewportInfo_SetOpenGLCamera( viewportInfo );
+	}
+
+	/* Clean up */
+	Memory_Free( imageBuffer );
+	Memory_Free( depthBuffer );
+	
+	Journal_DPrintfL( lucDebug, 2, "Leaving: %s\n", __func__ );
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/tests/DummyOpenGL/DummyOpenGL.c
--- a/RenderingEngines/tests/DummyOpenGL/DummyOpenGL.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2073 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: DummyOpenGL.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include "gl.h"
-#include "glu.h"
-#include "stdio.h"
-
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-const Type DummyOpenGL_Type = "DummyOpenGL";
-
-void glAccum (GLenum op, GLfloat value){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) op, (double) value );
-}
-
-void glAlphaFunc (GLenum func, GLclampf ref){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) func, (double) ref );
-}
-
-GLboolean glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr, ptr );\n", __func__, (double) n );
-	return 0;
-}
-
-void glArrayElement (GLint i){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) i );
-}
-
-void glBegin (GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) mode );
-	Stream_Indent( stream );
-}
-
-void glBindTexture (GLenum target, GLuint texture){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) target, (double) texture );
-}
-
-void glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) width, (double) height, (double) xorig, (double) yorig, (double) xmove, (double) ymove );
-}
-
-void glBlendFunc (GLenum sfactor, GLenum dfactor){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) sfactor, (int) dfactor );
-}
-
-void glCallList (GLuint list){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) list );
-}
-
-void glCallLists (GLsizei n, GLenum type, const GLvoid *lists){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, ptr );\n", __func__, (int) n, (int) type );
-}
-
-void glClear (GLbitfield mask){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %u );\n", __func__, (unsigned) mask );
-}
-
-void glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glClearDepth (GLclampd depth){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) depth );
-}
-
-void glClearIndex (GLfloat c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
-}
-
-void glClearStencil (GLint s){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) s );
-}
-
-void glClipPlane (GLenum plane, const GLdouble *equation){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, ptr );\n", __func__, (int) plane );
-}
-
-void glColor3b (GLbyte red, GLbyte green, GLbyte blue){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
-}
-
-void glColor3bv (const GLbyte *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor3d (GLdouble red, GLdouble green, GLdouble blue){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
-}
-
-void glColor3dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor3f (GLfloat red, GLfloat green, GLfloat blue){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
-}
-
-void glColor3fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor3i (GLint red, GLint green, GLint blue){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
-}
-
-void glColor3iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor3s (GLshort red, GLshort green, GLshort blue){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
-}
-
-void glColor3sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor3ub (GLubyte red, GLubyte green, GLubyte blue){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
-}
-
-void glColor3ubv (const GLubyte *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor3ui (GLuint red, GLuint green, GLuint blue){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
-}
-
-void glColor3uiv (const GLuint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor3us (GLushort red, GLushort green, GLushort blue){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
-}
-
-void glColor3usv (const GLushort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColor4bv (const GLbyte *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColor4dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColor4fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor4i (GLint red, GLint green, GLint blue, GLint alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColor4iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColor4sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColor4ubv (const GLubyte *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColor4uiv (const GLuint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColor4usv (const GLushort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
-}
-
-void glColorMaterial (GLenum face, GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) face, (int) mode );
-}
-
-void glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) size, (double) type, (double) stride );
-}
-
-void glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) width, (double) height, (double) type );
-}
-
-void glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) level, (double) internalFormat, (double) x, (double) y, (double) width, (double) border );
-}
-
-void glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) level, (double) internalFormat, (double) x, (double) y, (double) width, (double) height, (double) border );
-}
-
-void glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) level, (double) xoffset, (double) x, (double) y, (double) width );
-}
-
-void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) level, (double) xoffset, (double) yoffset, (double) x, (double) y, (double) width, (double) height );
-}
-
-void glCullFace (GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mode );
-}
-
-void glDeleteLists (GLuint list, GLsizei range){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) list, (double) range );
-}
-
-void glDeleteTextures (GLsizei n, const GLuint *textures){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) n );
-}
-
-void glDepthFunc (GLenum func){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) func );
-}
-
-void glDepthMask (GLboolean flag){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) flag );
-}
-
-void glDepthRange (GLclampd zNear, GLclampd zFar){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) zNear, (double) zFar );
-}
-
-void glDisable (GLenum cap){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) cap );
-}
-
-void glDisableClientState (GLenum array){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) array );
-}
-
-void glDrawArrays (GLenum mode, GLint first, GLsizei count){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) mode, (double) first, (double) count );
-}
-
-void glDrawBuffer (GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) mode );
-}
-
-void glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) mode, (double) count, (double) type );
-}
-
-void glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %d, %d, ptr );\n", __func__, (int) width, (int) height, (int) format, (int) type );
-}
-
-void glEdgeFlag (GLboolean flag){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) flag );
-}
-
-void glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) stride );
-}
-
-void glEdgeFlagv (const GLboolean *flag){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glEnable (GLenum cap){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) cap );
-}
-
-void glEnableClientState (GLenum array){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) array );
-}
-
-void glEnd (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type ); 
-	Stream_UnIndent( stream  );
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glEndList (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type ); 
-	Stream_UnIndent( stream  );
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glEvalCoord1d (GLdouble u){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) u );
-}
-
-void glEvalCoord1dv (const GLdouble *u){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glEvalCoord1f (GLfloat u){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) u );
-}
-
-void glEvalCoord1fv (const GLfloat *u){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glEvalCoord2d (GLdouble u, GLdouble v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) u, (double) v );
-}
-
-void glEvalCoord2dv (const GLdouble *u){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glEvalCoord2f (GLfloat u, GLfloat v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) u, (double) v );
-}
-
-void glEvalCoord2fv (const GLfloat *u){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glEvalMesh1 (GLenum mode, GLint i1, GLint i2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) mode, (double) i1, (double) i2 );
-}
-
-void glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) mode, (double) i1, (double) i2, (double) j1, (double) j2 );
-}
-
-void glEvalPoint1 (GLint i){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) i );
-}
-
-void glEvalPoint2 (GLint i, GLint j){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) i, (double) j );
-}
-
-void glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) size, (double) type );
-}
-
-void glFinish (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glFlush (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glFogf (GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
-}
-
-void glFogfv (GLenum pname, const GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-void glFogi (GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
-}
-
-void glFogiv (GLenum pname, const GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-void glFrontFace (GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) mode );
-}
-
-void glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) left, (double) right, (double) bottom, (double) top, (double) zNear, (double) zFar );
-}
-
-GLuint glGenLists (GLsizei range){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) range );
-	return 0;
-}
-
-void glGenTextures (GLsizei n, GLuint *textures){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) n );
-}
-
-void glGetBooleanv (GLenum pname, GLboolean *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-void glGetClipPlane (GLenum plane, GLdouble *equation){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) plane );
-}
-
-void glGetDoublev (GLenum pname, GLdouble *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-GLenum glGetError (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-	return 0;
-}
-
-void glGetFloatv (GLenum pname, GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-void glGetIntegerv (GLenum pname, GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-void glGetLightfv (GLenum light, GLenum pname, GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) light, (double) pname );
-}
-
-void glGetLightiv (GLenum light, GLenum pname, GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) light, (double) pname );
-}
-
-void glGetMapdv (GLenum target, GLenum query, GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) query );
-}
-
-void glGetMapfv (GLenum target, GLenum query, GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) query );
-}
-
-void glGetMapiv (GLenum target, GLenum query, GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) query );
-}
-
-void glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) face, (double) pname );
-}
-
-void glGetMaterialiv (GLenum face, GLenum pname, GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) face, (double) pname );
-}
-
-void glGetPixelMapfv (GLenum map, GLfloat *values){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) map );
-}
-
-void glGetPixelMapuiv (GLenum map, GLuint *values){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) map );
-}
-
-void glGetPixelMapusv (GLenum map, GLushort *values){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) map );
-}
-
-void glGetPointerv (GLenum pname, GLvoid* *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-void glGetPolygonStipple (GLubyte *mask){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-const GLubyte * glGetString (GLenum name){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) name );
-	return 0;
-}
-
-void glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
-}
-
-void glGetTexEnviv (GLenum target, GLenum pname, GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
-}
-
-void glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
-}
-
-void glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
-}
-
-void glGetTexGeniv (GLenum coord, GLenum pname, GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
-}
-
-void glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) format, (double) type );
-}
-
-void glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) pname );
-}
-
-void glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) pname );
-}
-
-void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
-}
-
-void glGetTexParameteriv (GLenum target, GLenum pname, GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
-}
-
-void glHint (GLenum target, GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) target, (double) mode );
-}
-
-void glIndexMask (GLuint mask){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mask );
-}
-
-void glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) type, (double) stride );
-}
-
-void glIndexd (GLdouble c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
-}
-
-void glIndexdv (const GLdouble *c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glIndexf (GLfloat c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
-}
-
-void glIndexfv (const GLfloat *c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glIndexi (GLint c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
-}
-
-void glIndexiv (const GLint *c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glIndexs (GLshort c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
-}
-
-void glIndexsv (const GLshort *c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glIndexub (GLubyte c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
-}
-
-void glIndexubv (const GLubyte *c){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glInitNames (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) format, (double) stride );
-}
-
-GLboolean glIsEnabled (GLenum cap){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) cap );
-	return 0;
-}
-
-GLboolean glIsList (GLuint list){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) list );
-	return 0;
-}
-
-GLboolean glIsTexture (GLuint texture){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) texture );
-	return 0;
-}
-
-void glLightModelf (GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
-}
-
-void glLightModelfv (GLenum pname, const GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-void glLightModeli (GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) pname, (int) param );
-}
-
-void glLightModeliv (GLenum pname, const GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
-}
-
-void glLightf (GLenum light, GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) light, (double) pname, (double) param );
-}
-
-void glLightfv (GLenum light, GLenum pname, const GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) light, (double) pname );
-}
-
-void glLighti (GLenum light, GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) light, (double) pname, (double) param );
-}
-
-void glLightiv (GLenum light, GLenum pname, const GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) light, (double) pname );
-}
-
-void glLineStipple (GLint factor, GLushort pattern){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) factor, (double) pattern );
-}
-
-void glLineWidth (GLfloat width){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) width );
-}
-
-void glListBase (GLuint base){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) base );
-}
-
-void glLoadIdentity (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glLoadMatrixd (const GLdouble *m){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glLoadMatrixf (const GLfloat *m){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glLoadName (GLuint name){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) name );
-}
-
-void glLogicOp (GLenum opcode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) opcode );
-}
-
-void glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) u1, (double) u2, (double) stride, (double) order );
-}
-
-void glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) u1, (double) u2, (double) stride, (double) order );
-}
-
-void glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) u1, (double) u2, (double) ustride, (double) uorder, (double) v1, (double) v2, (double) vstride, (double) vorder );
-}
-
-void glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) u1, (double) u2, (double) ustride, (double) uorder, (double) v1, (double) v2, (double) vstride, (double) vorder );
-}
-
-void glMapGrid1d (GLint un, GLdouble u1, GLdouble u2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) un, (double) u1, (double) u2 );
-}
-
-void glMapGrid1f (GLint un, GLfloat u1, GLfloat u2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) un, (double) u1, (double) u2 );
-}
-
-void glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) un, (double) u1, (double) u2, (double) vn, (double) v1, (double) v2 );
-}
-
-void glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) un, (double) u1, (double) u2, (double) vn, (double) v1, (double) v2 );
-}
-
-void glMaterialf (GLenum face, GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) face, (double) pname, (double) param );
-}
-
-void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) face, (double) pname );
-}
-
-void glMateriali (GLenum face, GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) face, (double) pname, (double) param );
-}
-
-void glMaterialiv (GLenum face, GLenum pname, const GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) face, (double) pname );
-}
-
-void glMatrixMode (GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d );\n", __func__, (int) mode );
-}
-
-void glMultMatrixd (const GLdouble *m){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glMultMatrixf (const GLfloat *m){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glNewList (GLuint list, GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %u, %d );\n", __func__, (unsigned) list, (int) mode );
-	Stream_Indent( stream );
-}
-
-void glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
-}
-
-void glNormal3bv (const GLbyte *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
-}
-
-void glNormal3dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
-}
-
-void glNormal3fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glNormal3i (GLint nx, GLint ny, GLint nz){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
-}
-
-void glNormal3iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glNormal3s (GLshort nx, GLshort ny, GLshort nz){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
-}
-
-void glNormal3sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) type, (double) stride );
-}
-
-void glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) left, (double) right, (double) bottom, (double) top, (double) zNear, (double) zFar );
-}
-
-void glPassThrough (GLfloat token){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) token );
-}
-
-void glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) map, (double) mapsize );
-}
-
-void glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) map, (double) mapsize );
-}
-
-void glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) map, (double) mapsize );
-}
-
-void glPixelStoref (GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
-}
-
-void glPixelStorei (GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) pname, (int) param );
-}
-
-void glPixelTransferf (GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
-}
-
-void glPixelTransferi (GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
-}
-
-void glPixelZoom (GLfloat xfactor, GLfloat yfactor){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) xfactor, (double) yfactor );
-}
-
-void glPointSize (GLfloat size){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) size );
-}
-
-void glPolygonMode (GLenum face, GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) face, (int) mode );
-}
-
-void glPolygonOffset (GLfloat factor, GLfloat units){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) factor, (double) units );
-}
-
-void glPolygonStipple (const GLubyte *mask){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glPopAttrib (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glPopClientAttrib (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glPopMatrix (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glPopName (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, ptr, ptr );\n", __func__, (double) n );
-}
-
-void glPushAttrib (GLbitfield mask){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %u );\n", __func__, (unsigned int) mask );
-}
-
-void glPushClientAttrib (GLbitfield mask){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %u );\n", __func__, (unsigned int) mask );
-}
-
-void glPushMatrix (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-}
-
-void glPushName (GLuint name){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) name );
-}
-
-void glRasterPos2d (GLdouble x, GLdouble y){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
-}
-
-void glRasterPos2dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos2f (GLfloat x, GLfloat y){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
-}
-
-void glRasterPos2fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos2i (GLint x, GLint y){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) x, (int) y );
-}
-
-void glRasterPos2iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos2s (GLshort x, GLshort y){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
-}
-
-void glRasterPos2sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glRasterPos3dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos3f (GLfloat x, GLfloat y, GLfloat z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glRasterPos3fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos3i (GLint x, GLint y, GLint z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glRasterPos3iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos3s (GLshort x, GLshort y, GLshort z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glRasterPos3sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
-}
-
-void glRasterPos4dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
-}
-
-void glRasterPos4fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos4i (GLint x, GLint y, GLint z, GLint w){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
-}
-
-void glRasterPos4iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
-}
-
-void glRasterPos4sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glReadBuffer (GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mode );
-}
-
-void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %d, %d, %d, %d, ptr );\n", __func__, (int) x, (int) y, (int) width, (int) height, (int) format, (int) type );
-}
-
-void glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x1, (double) y1, (double) x2, (double) y2 );
-}
-
-void glRectdv (const GLdouble *v1, const GLdouble *v2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
-}
-
-void glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x1, (double) y1, (double) x2, (double) y2 );
-}
-
-void glRectfv (const GLfloat *v1, const GLfloat *v2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
-}
-
-void glRecti (GLint x1, GLint y1, GLint x2, GLint y2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %d, %d );\n", __func__, (int) x1, (int) y1, (int) x2, (int) y2 );
-}
-
-void glRectiv (const GLint *v1, const GLint *v2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
-}
-
-void glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x1, (double) y1, (double) x2, (double) y2 );
-}
-
-void glRectsv (const GLshort *v1, const GLshort *v2){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
-}
-
-GLint glRenderMode (GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mode );
-	return 0;
-}
-
-void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) angle, (double) x, (double) y, (double) z );
-}
-
-void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) angle, (double) x, (double) y, (double) z );
-}
-
-void glScaled (GLdouble x, GLdouble y, GLdouble z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glScalef (GLfloat x, GLfloat y, GLfloat z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glScissor (GLint x, GLint y, GLsizei width, GLsizei height){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %d, %d );\n", __func__, (int) x, (int) y, (int) width, (int) height );
-}
-
-void glSelectBuffer (GLsizei size, GLuint *buffer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, ptr );\n", __func__, (int) size );
-}
-
-void glShadeModel (GLenum mode){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mode );
-}
-
-void glStencilFunc (GLenum func, GLint ref, GLuint mask){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) func, (double) ref, (double) mask );
-}
-
-void glStencilMask (GLuint mask){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mask );
-}
-
-void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) fail, (double) zfail, (double) zpass );
-}
-
-void glTexCoord1d (GLdouble s){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) s );
-}
-
-void glTexCoord1dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord1f (GLfloat s){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) s );
-}
-
-void glTexCoord1fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord1i (GLint s){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) s );
-}
-
-void glTexCoord1iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord1s (GLshort s){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) s );
-}
-
-void glTexCoord1sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord2d (GLdouble s, GLdouble t){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) s, (double) t );
-}
-
-void glTexCoord2dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord2f (GLfloat s, GLfloat t){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) s, (double) t );
-}
-
-void glTexCoord2fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord2i (GLint s, GLint t){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) s, (double) t );
-}
-
-void glTexCoord2iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord2s (GLshort s, GLshort t){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) s, (double) t );
-}
-
-void glTexCoord2sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord3d (GLdouble s, GLdouble t, GLdouble r){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r );
-}
-
-void glTexCoord3dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord3f (GLfloat s, GLfloat t, GLfloat r){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r );
-}
-
-void glTexCoord3fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord3i (GLint s, GLint t, GLint r){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r );
-}
-
-void glTexCoord3iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord3s (GLshort s, GLshort t, GLshort r){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r );
-}
-
-void glTexCoord3sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r, (double) q );
-}
-
-void glTexCoord4dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r, (double) q );
-}
-
-void glTexCoord4fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord4i (GLint s, GLint t, GLint r, GLint q){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r, (double) q );
-}
-
-void glTexCoord4iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r, (double) q );
-}
-
-void glTexCoord4sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) size, (double) type, (double) stride );
-}
-
-void glTexEnvf (GLenum target, GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) pname, (double) param );
-}
-
-void glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
-}
-
-void glTexEnvi (GLenum target, GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) pname, (double) param );
-}
-
-void glTexEnviv (GLenum target, GLenum pname, const GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
-}
-
-void glTexGend (GLenum coord, GLenum pname, GLdouble param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) coord, (double) pname, (double) param );
-}
-
-void glTexGendv (GLenum coord, GLenum pname, const GLdouble *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
-}
-
-void glTexGenf (GLenum coord, GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) coord, (double) pname, (double) param );
-}
-
-void glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
-}
-
-void glTexGeni (GLenum coord, GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) coord, (double) pname, (double) param );
-}
-
-void glTexGeniv (GLenum coord, GLenum pname, const GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
-}
-
-#ifdef __APPLE__
-void glTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels){
-#else
-void glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels){
-#endif
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %d, %d, %d, %d, %d, ptr );\n", __func__, (int) target, (int) level, (int) internalformat, (int) width, (int) border, (int) format, (int) type );
-}
-
-#ifdef __APPLE__
-void glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels){
-#else
-void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels){
-#endif
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %d, %d, %d, %d, %d, %d, ptr );\n", __func__, (int) target, (int) level, (int) internalformat, (int) width, (int) height, (int) border, (int) format, (int) type );
-}
-
-void glTexParameterf (GLenum target, GLenum pname, GLfloat param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %.6g );\n", __func__, (int) target, (int) pname, (double) param );
-}
-
-void glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, ptr );\n", __func__, (int) target, (int) pname );
-}
-
-void glTexParameteri (GLenum target, GLenum pname, GLint param){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %d );\n", __func__, (int) target, (int) pname, (int) param );
-}
-
-void glTexParameteriv (GLenum target, GLenum pname, const GLint *params){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, ptr );\n", __func__, (int) target, (int) pname );
-}
-
-void glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) xoffset, (double) width, (double) format, (double) type );
-}
-
-void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) xoffset, (double) yoffset, (double) width, (double) height, (double) format, (double) type );
-}
-
-void glTranslated (GLdouble x, GLdouble y, GLdouble z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glTranslatef (GLfloat x, GLfloat y, GLfloat z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glVertex2d (GLdouble x, GLdouble y){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
-}
-
-void glVertex2dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1] );
-}
-
-void glVertex2f (GLfloat x, GLfloat y){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
-}
-
-void glVertex2fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1] );
-}
-
-void glVertex2i (GLint x, GLint y){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
-}
-
-void glVertex2iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1] );
-}
-
-void glVertex2s (GLshort x, GLshort y){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
-}
-
-void glVertex2sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1] );
-}
-
-void glVertex3d (GLdouble x, GLdouble y, GLdouble z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glVertex3dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glVertex3f (GLfloat x, GLfloat y, GLfloat z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glVertex3fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glVertex3i (GLint x, GLint y, GLint z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glVertex3iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glVertex3s (GLshort x, GLshort y, GLshort z){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
-}
-
-void glVertex3sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
-}
-
-void glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
-}
-
-void glVertex4dv (const GLdouble *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2], (double) v[3] );
-}
-
-void glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
-}
-
-void glVertex4fv (const GLfloat *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2], (double) v[3] );
-}
-
-void glVertex4i (GLint x, GLint y, GLint z, GLint w){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
-}
-
-void glVertex4iv (const GLint *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2], (double) v[3] );
-}
-
-void glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
-}
-
-void glVertex4sv (const GLshort *v){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2], (double) v[3] );
-}
-
-void glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) size, (double) type, (double) stride );
-}
-
-void glViewport (GLint x, GLint y, GLsizei width, GLsizei height){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %d, %d, %d, %d );\n", __func__, (int) x, (int) y, (int) width, (int) height );
-}
-
-
-
-
-void gluBeginCurve (GLUnurbs* nurb){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluBeginPolygon (GLUtesselator* tess){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluBeginSurface (GLUnurbs* nurb){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluBeginTrim (GLUnurbs* nurb){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-GLint gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) format, (double) type, (double) level, (double) base, (double) max );
-	return 0;
-}
-
-GLint gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) format, (double) type );
-	return 0;
-}
-
-GLint gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) height, (double) format, (double) type, (double) level, (double) base, (double) max );
-	return 0;
-}
-
-GLint gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) height, (double) format, (double) type );
-	return 0;
-}
-
-GLint gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) height, (double) depth, (double) format, (double) type, (double) level, (double) base, (double) max );
-	return 0;
-}
-
-GLint gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) height, (double) depth, (double) format, (double) type );
-	return 0;
-}
-
-GLboolean gluCheckExtension (const GLubyte *extName, const GLubyte *extString){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
-	return 0;
-}
-
-void gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) base, (double) top, (double) height, (double) slices, (double) stacks );
-}
-
-void gluDeleteNurbsRenderer (GLUnurbs* nurb){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluDeleteQuadric (GLUquadric* quad){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluDeleteTess (GLUtesselator* tess){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) inner, (double) outer, (double) slices, (double) loops );
-}
-
-void gluEndCurve (GLUnurbs* nurb){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluEndPolygon (GLUtesselator* tess){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluEndSurface (GLUnurbs* nurb){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluEndTrim (GLUnurbs* nurb){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-const GLubyte * gluErrorString (GLenum error){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) error );
-	return 0;
-}
-
-void gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, ptr );\n", __func__, (double) property );
-}
-
-const GLubyte * gluGetString (GLenum name){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) name );
-	return 0;
-}
-
-void gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, ptr );\n", __func__, (double) which );
-}
-
-void gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr, ptr, ptr );\n", __func__ );
-}
-
-void gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) eyeX, (double) eyeY, (double) eyeZ, (double) centerX, (double) centerY, (double) centerZ, (double) upX, (double) upY, (double) upZ );
-}
-
-GLUnurbs* gluNewNurbsRenderer (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-	return 0;
-}
-
-GLUquadric* gluNewQuadric (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-	return 0;
-}
-
-GLUtesselator* gluNewTess (){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( );\n", __func__ );
-	return 0;
-}
-
-void gluNextContour (GLUtesselator* tess, GLenum type){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) type );
-}
-
-void gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
-}
-
-void gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
-}
-
-void gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, ptr, %.6g, ptr, %.6g, %.6g );\n", __func__, (double) knotCount, (double) stride, (double) order, (double) type );
-}
-
-void gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, %.6g );\n", __func__, (double) property, (double) value );
-}
-
-void gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, ptr, %.6g, ptr, %.6g, %.6g, ptr, %.6g, %.6g, %.6g );\n", __func__, (double) sKnotCount, (double) tKnotCount, (double) sStride, (double) tStride, (double) sOrder, (double) tOrder, (double) type );
-}
-
-void gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) left, (double) right, (double) bottom, (double) top );
-}
-
-void gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) inner, (double) outer, (double) slices, (double) loops, (double) start, (double) sweep );
-}
-
-void gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) fovy, (double) aspect, (double) zNear, (double) zFar );
-}
-
-void gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) x, (double) y, (double) delX, (double) delY );
-}
-
-GLint gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr, ptr, ptr, ptr, ptr, ptr );\n", __func__, (double) objX, (double) objY, (double) objZ );
-	return 0;
-}
-
-void gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, ptr, %.6g, %.6g );\n", __func__, (double) count, (double) stride, (double) type );
-}
-
-void gluQuadricDrawStyle (GLUquadric* quad, GLenum draw){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) draw );
-}
-
-void gluQuadricNormals (GLUquadric* quad, GLenum normal){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) normal );
-}
-
-void gluQuadricOrientation (GLUquadric* quad, GLenum orientation){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) orientation );
-}
-
-void gluQuadricTexture (GLUquadric* quad, GLboolean texture){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) texture );
-}
-
-GLint gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, ptr, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) format, (double) wIn, (double) hIn, (double) typeIn, (double) wOut, (double) hOut, (double) typeOut );
-	return 0;
-}
-
-void gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g );\n", __func__, (double) radius, (double) slices, (double) stacks );
-}
-
-void gluTessBeginContour (GLUtesselator* tess){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
-}
-
-void gluTessEndContour (GLUtesselator* tess){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluTessEndPolygon (GLUtesselator* tess){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr );\n", __func__ );
-}
-
-void gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g );\n", __func__, (double) valueX, (double) valueY, (double) valueZ );
-}
-
-void gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, %.6g, %.6g );\n", __func__, (double) which, (double) data );
-}
-
-void gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr, ptr, ptr );\n", __func__ );
-}
-
-GLint gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr, ptr, ptr, ptr, ptr, ptr );\n", __func__, (double) winX, (double) winY, (double) winZ );
-	return 0;
-}
-
-GLint gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble near, GLdouble far, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, ptr, ptr, ptr, %.6g, %.6g, ptr, ptr, ptr, ptr );\n", __func__, (double) winX, (double) winY, (double) winZ, (double) clipW, (double) near, (double) far );
-	return 0;
-}
-
-
-#if 0
-/* These lines are commented out because it wont compile on the mac otherwise */
-void gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr %.6g );\n", __func__, (double) which );
-}
-
-void gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr %.6g );\n", __func__, (double) which );
-}
-
-void gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc){
-	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
-	Journal_Printf( stream, "%s( ptr %.6g );\n", __func__, (double) which );
-}
-#endif
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/tests/DummyOpenGL/DummyOpenGL.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RenderingEngines/tests/DummyOpenGL/DummyOpenGL.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,2073 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: DummyOpenGL.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include "gl.h"
+#include "glu.h"
+#include "stdio.h"
+
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+const Type DummyOpenGL_Type = "DummyOpenGL";
+
+void glAccum (GLenum op, GLfloat value){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) op, (double) value );
+}
+
+void glAlphaFunc (GLenum func, GLclampf ref){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) func, (double) ref );
+}
+
+GLboolean glAreTexturesResident (GLsizei n, const GLuint *textures, GLboolean *residences){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr, ptr );\n", __func__, (double) n );
+	return 0;
+}
+
+void glArrayElement (GLint i){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) i );
+}
+
+void glBegin (GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) mode );
+	Stream_Indent( stream );
+}
+
+void glBindTexture (GLenum target, GLuint texture){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) target, (double) texture );
+}
+
+void glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) width, (double) height, (double) xorig, (double) yorig, (double) xmove, (double) ymove );
+}
+
+void glBlendFunc (GLenum sfactor, GLenum dfactor){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) sfactor, (int) dfactor );
+}
+
+void glCallList (GLuint list){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) list );
+}
+
+void glCallLists (GLsizei n, GLenum type, const GLvoid *lists){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, ptr );\n", __func__, (int) n, (int) type );
+}
+
+void glClear (GLbitfield mask){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %u );\n", __func__, (unsigned) mask );
+}
+
+void glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glClearDepth (GLclampd depth){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) depth );
+}
+
+void glClearIndex (GLfloat c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
+}
+
+void glClearStencil (GLint s){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) s );
+}
+
+void glClipPlane (GLenum plane, const GLdouble *equation){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, ptr );\n", __func__, (int) plane );
+}
+
+void glColor3b (GLbyte red, GLbyte green, GLbyte blue){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
+}
+
+void glColor3bv (const GLbyte *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor3d (GLdouble red, GLdouble green, GLdouble blue){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
+}
+
+void glColor3dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor3f (GLfloat red, GLfloat green, GLfloat blue){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
+}
+
+void glColor3fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor3i (GLint red, GLint green, GLint blue){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
+}
+
+void glColor3iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor3s (GLshort red, GLshort green, GLshort blue){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
+}
+
+void glColor3sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor3ub (GLubyte red, GLubyte green, GLubyte blue){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
+}
+
+void glColor3ubv (const GLubyte *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor3ui (GLuint red, GLuint green, GLuint blue){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
+}
+
+void glColor3uiv (const GLuint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor3us (GLushort red, GLushort green, GLushort blue){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue );
+}
+
+void glColor3usv (const GLushort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColor4bv (const GLbyte *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColor4dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColor4fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor4i (GLint red, GLint green, GLint blue, GLint alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColor4iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColor4sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColor4ubv (const GLubyte *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColor4uiv (const GLuint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColor4usv (const GLushort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) red, (double) green, (double) blue, (double) alpha );
+}
+
+void glColorMaterial (GLenum face, GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) face, (int) mode );
+}
+
+void glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) size, (double) type, (double) stride );
+}
+
+void glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) width, (double) height, (double) type );
+}
+
+void glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) level, (double) internalFormat, (double) x, (double) y, (double) width, (double) border );
+}
+
+void glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) level, (double) internalFormat, (double) x, (double) y, (double) width, (double) height, (double) border );
+}
+
+void glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) level, (double) xoffset, (double) x, (double) y, (double) width );
+}
+
+void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) level, (double) xoffset, (double) yoffset, (double) x, (double) y, (double) width, (double) height );
+}
+
+void glCullFace (GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mode );
+}
+
+void glDeleteLists (GLuint list, GLsizei range){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) list, (double) range );
+}
+
+void glDeleteTextures (GLsizei n, const GLuint *textures){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) n );
+}
+
+void glDepthFunc (GLenum func){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) func );
+}
+
+void glDepthMask (GLboolean flag){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) flag );
+}
+
+void glDepthRange (GLclampd zNear, GLclampd zFar){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) zNear, (double) zFar );
+}
+
+void glDisable (GLenum cap){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) cap );
+}
+
+void glDisableClientState (GLenum array){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) array );
+}
+
+void glDrawArrays (GLenum mode, GLint first, GLsizei count){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) mode, (double) first, (double) count );
+}
+
+void glDrawBuffer (GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) mode );
+}
+
+void glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) mode, (double) count, (double) type );
+}
+
+void glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %d, %d, ptr );\n", __func__, (int) width, (int) height, (int) format, (int) type );
+}
+
+void glEdgeFlag (GLboolean flag){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) flag );
+}
+
+void glEdgeFlagPointer (GLsizei stride, const GLvoid *pointer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) stride );
+}
+
+void glEdgeFlagv (const GLboolean *flag){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glEnable (GLenum cap){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) cap );
+}
+
+void glEnableClientState (GLenum array){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) array );
+}
+
+void glEnd (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type ); 
+	Stream_UnIndent( stream  );
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glEndList (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type ); 
+	Stream_UnIndent( stream  );
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glEvalCoord1d (GLdouble u){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) u );
+}
+
+void glEvalCoord1dv (const GLdouble *u){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glEvalCoord1f (GLfloat u){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) u );
+}
+
+void glEvalCoord1fv (const GLfloat *u){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glEvalCoord2d (GLdouble u, GLdouble v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) u, (double) v );
+}
+
+void glEvalCoord2dv (const GLdouble *u){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glEvalCoord2f (GLfloat u, GLfloat v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) u, (double) v );
+}
+
+void glEvalCoord2fv (const GLfloat *u){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glEvalMesh1 (GLenum mode, GLint i1, GLint i2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) mode, (double) i1, (double) i2 );
+}
+
+void glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) mode, (double) i1, (double) i2, (double) j1, (double) j2 );
+}
+
+void glEvalPoint1 (GLint i){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) i );
+}
+
+void glEvalPoint2 (GLint i, GLint j){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) i, (double) j );
+}
+
+void glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) size, (double) type );
+}
+
+void glFinish (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glFlush (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glFogf (GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
+}
+
+void glFogfv (GLenum pname, const GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+void glFogi (GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
+}
+
+void glFogiv (GLenum pname, const GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+void glFrontFace (GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) mode );
+}
+
+void glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) left, (double) right, (double) bottom, (double) top, (double) zNear, (double) zFar );
+}
+
+GLuint glGenLists (GLsizei range){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) range );
+	return 0;
+}
+
+void glGenTextures (GLsizei n, GLuint *textures){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) n );
+}
+
+void glGetBooleanv (GLenum pname, GLboolean *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+void glGetClipPlane (GLenum plane, GLdouble *equation){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) plane );
+}
+
+void glGetDoublev (GLenum pname, GLdouble *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+GLenum glGetError (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+	return 0;
+}
+
+void glGetFloatv (GLenum pname, GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+void glGetIntegerv (GLenum pname, GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+void glGetLightfv (GLenum light, GLenum pname, GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) light, (double) pname );
+}
+
+void glGetLightiv (GLenum light, GLenum pname, GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) light, (double) pname );
+}
+
+void glGetMapdv (GLenum target, GLenum query, GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) query );
+}
+
+void glGetMapfv (GLenum target, GLenum query, GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) query );
+}
+
+void glGetMapiv (GLenum target, GLenum query, GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) query );
+}
+
+void glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) face, (double) pname );
+}
+
+void glGetMaterialiv (GLenum face, GLenum pname, GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) face, (double) pname );
+}
+
+void glGetPixelMapfv (GLenum map, GLfloat *values){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) map );
+}
+
+void glGetPixelMapuiv (GLenum map, GLuint *values){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) map );
+}
+
+void glGetPixelMapusv (GLenum map, GLushort *values){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) map );
+}
+
+void glGetPointerv (GLenum pname, GLvoid* *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+void glGetPolygonStipple (GLubyte *mask){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+const GLubyte * glGetString (GLenum name){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) name );
+	return 0;
+}
+
+void glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
+}
+
+void glGetTexEnviv (GLenum target, GLenum pname, GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
+}
+
+void glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
+}
+
+void glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
+}
+
+void glGetTexGeniv (GLenum coord, GLenum pname, GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
+}
+
+void glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) format, (double) type );
+}
+
+void glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) pname );
+}
+
+void glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) pname );
+}
+
+void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
+}
+
+void glGetTexParameteriv (GLenum target, GLenum pname, GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
+}
+
+void glHint (GLenum target, GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) target, (double) mode );
+}
+
+void glIndexMask (GLuint mask){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mask );
+}
+
+void glIndexPointer (GLenum type, GLsizei stride, const GLvoid *pointer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) type, (double) stride );
+}
+
+void glIndexd (GLdouble c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
+}
+
+void glIndexdv (const GLdouble *c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glIndexf (GLfloat c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
+}
+
+void glIndexfv (const GLfloat *c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glIndexi (GLint c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
+}
+
+void glIndexiv (const GLint *c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glIndexs (GLshort c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
+}
+
+void glIndexsv (const GLshort *c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glIndexub (GLubyte c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) c );
+}
+
+void glIndexubv (const GLubyte *c){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glInitNames (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glInterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) format, (double) stride );
+}
+
+GLboolean glIsEnabled (GLenum cap){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) cap );
+	return 0;
+}
+
+GLboolean glIsList (GLuint list){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) list );
+	return 0;
+}
+
+GLboolean glIsTexture (GLuint texture){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) texture );
+	return 0;
+}
+
+void glLightModelf (GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
+}
+
+void glLightModelfv (GLenum pname, const GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+void glLightModeli (GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) pname, (int) param );
+}
+
+void glLightModeliv (GLenum pname, const GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr );\n", __func__, (double) pname );
+}
+
+void glLightf (GLenum light, GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) light, (double) pname, (double) param );
+}
+
+void glLightfv (GLenum light, GLenum pname, const GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) light, (double) pname );
+}
+
+void glLighti (GLenum light, GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) light, (double) pname, (double) param );
+}
+
+void glLightiv (GLenum light, GLenum pname, const GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) light, (double) pname );
+}
+
+void glLineStipple (GLint factor, GLushort pattern){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) factor, (double) pattern );
+}
+
+void glLineWidth (GLfloat width){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) width );
+}
+
+void glListBase (GLuint base){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) base );
+}
+
+void glLoadIdentity (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glLoadMatrixd (const GLdouble *m){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glLoadMatrixf (const GLfloat *m){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glLoadName (GLuint name){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) name );
+}
+
+void glLogicOp (GLenum opcode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) opcode );
+}
+
+void glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) u1, (double) u2, (double) stride, (double) order );
+}
+
+void glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) u1, (double) u2, (double) stride, (double) order );
+}
+
+void glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) u1, (double) u2, (double) ustride, (double) uorder, (double) v1, (double) v2, (double) vstride, (double) vorder );
+}
+
+void glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) u1, (double) u2, (double) ustride, (double) uorder, (double) v1, (double) v2, (double) vstride, (double) vorder );
+}
+
+void glMapGrid1d (GLint un, GLdouble u1, GLdouble u2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) un, (double) u1, (double) u2 );
+}
+
+void glMapGrid1f (GLint un, GLfloat u1, GLfloat u2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) un, (double) u1, (double) u2 );
+}
+
+void glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) un, (double) u1, (double) u2, (double) vn, (double) v1, (double) v2 );
+}
+
+void glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) un, (double) u1, (double) u2, (double) vn, (double) v1, (double) v2 );
+}
+
+void glMaterialf (GLenum face, GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) face, (double) pname, (double) param );
+}
+
+void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) face, (double) pname );
+}
+
+void glMateriali (GLenum face, GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) face, (double) pname, (double) param );
+}
+
+void glMaterialiv (GLenum face, GLenum pname, const GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) face, (double) pname );
+}
+
+void glMatrixMode (GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d );\n", __func__, (int) mode );
+}
+
+void glMultMatrixd (const GLdouble *m){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glMultMatrixf (const GLfloat *m){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glNewList (GLuint list, GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %u, %d );\n", __func__, (unsigned) list, (int) mode );
+	Stream_Indent( stream );
+}
+
+void glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
+}
+
+void glNormal3bv (const GLbyte *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
+}
+
+void glNormal3dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
+}
+
+void glNormal3fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glNormal3i (GLint nx, GLint ny, GLint nz){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
+}
+
+void glNormal3iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glNormal3s (GLshort nx, GLshort ny, GLshort nz){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) nx, (double) ny, (double) nz );
+}
+
+void glNormal3sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) type, (double) stride );
+}
+
+void glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) left, (double) right, (double) bottom, (double) top, (double) zNear, (double) zFar );
+}
+
+void glPassThrough (GLfloat token){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) token );
+}
+
+void glPixelMapfv (GLenum map, GLsizei mapsize, const GLfloat *values){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) map, (double) mapsize );
+}
+
+void glPixelMapuiv (GLenum map, GLsizei mapsize, const GLuint *values){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) map, (double) mapsize );
+}
+
+void glPixelMapusv (GLenum map, GLsizei mapsize, const GLushort *values){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) map, (double) mapsize );
+}
+
+void glPixelStoref (GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
+}
+
+void glPixelStorei (GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) pname, (int) param );
+}
+
+void glPixelTransferf (GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
+}
+
+void glPixelTransferi (GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) pname, (double) param );
+}
+
+void glPixelZoom (GLfloat xfactor, GLfloat yfactor){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) xfactor, (double) yfactor );
+}
+
+void glPointSize (GLfloat size){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) size );
+}
+
+void glPolygonMode (GLenum face, GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) face, (int) mode );
+}
+
+void glPolygonOffset (GLfloat factor, GLfloat units){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) factor, (double) units );
+}
+
+void glPolygonStipple (const GLubyte *mask){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glPopAttrib (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glPopClientAttrib (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glPopMatrix (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glPopName (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glPrioritizeTextures (GLsizei n, const GLuint *textures, const GLclampf *priorities){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, ptr, ptr );\n", __func__, (double) n );
+}
+
+void glPushAttrib (GLbitfield mask){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %u );\n", __func__, (unsigned int) mask );
+}
+
+void glPushClientAttrib (GLbitfield mask){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %u );\n", __func__, (unsigned int) mask );
+}
+
+void glPushMatrix (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+}
+
+void glPushName (GLuint name){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) name );
+}
+
+void glRasterPos2d (GLdouble x, GLdouble y){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
+}
+
+void glRasterPos2dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos2f (GLfloat x, GLfloat y){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
+}
+
+void glRasterPos2fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos2i (GLint x, GLint y){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d );\n", __func__, (int) x, (int) y );
+}
+
+void glRasterPos2iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos2s (GLshort x, GLshort y){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
+}
+
+void glRasterPos2sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glRasterPos3dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos3f (GLfloat x, GLfloat y, GLfloat z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glRasterPos3fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos3i (GLint x, GLint y, GLint z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glRasterPos3iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos3s (GLshort x, GLshort y, GLshort z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glRasterPos3sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
+}
+
+void glRasterPos4dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
+}
+
+void glRasterPos4fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos4i (GLint x, GLint y, GLint z, GLint w){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
+}
+
+void glRasterPos4iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
+}
+
+void glRasterPos4sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glReadBuffer (GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mode );
+}
+
+void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %d, %d, %d, %d, ptr );\n", __func__, (int) x, (int) y, (int) width, (int) height, (int) format, (int) type );
+}
+
+void glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x1, (double) y1, (double) x2, (double) y2 );
+}
+
+void glRectdv (const GLdouble *v1, const GLdouble *v2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
+}
+
+void glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x1, (double) y1, (double) x2, (double) y2 );
+}
+
+void glRectfv (const GLfloat *v1, const GLfloat *v2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
+}
+
+void glRecti (GLint x1, GLint y1, GLint x2, GLint y2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %d, %d );\n", __func__, (int) x1, (int) y1, (int) x2, (int) y2 );
+}
+
+void glRectiv (const GLint *v1, const GLint *v2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
+}
+
+void glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x1, (double) y1, (double) x2, (double) y2 );
+}
+
+void glRectsv (const GLshort *v1, const GLshort *v2){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
+}
+
+GLint glRenderMode (GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mode );
+	return 0;
+}
+
+void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) angle, (double) x, (double) y, (double) z );
+}
+
+void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) angle, (double) x, (double) y, (double) z );
+}
+
+void glScaled (GLdouble x, GLdouble y, GLdouble z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glScalef (GLfloat x, GLfloat y, GLfloat z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glScissor (GLint x, GLint y, GLsizei width, GLsizei height){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %d, %d );\n", __func__, (int) x, (int) y, (int) width, (int) height );
+}
+
+void glSelectBuffer (GLsizei size, GLuint *buffer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, ptr );\n", __func__, (int) size );
+}
+
+void glShadeModel (GLenum mode){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mode );
+}
+
+void glStencilFunc (GLenum func, GLint ref, GLuint mask){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) func, (double) ref, (double) mask );
+}
+
+void glStencilMask (GLuint mask){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) mask );
+}
+
+void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) fail, (double) zfail, (double) zpass );
+}
+
+void glTexCoord1d (GLdouble s){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) s );
+}
+
+void glTexCoord1dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord1f (GLfloat s){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) s );
+}
+
+void glTexCoord1fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord1i (GLint s){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) s );
+}
+
+void glTexCoord1iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord1s (GLshort s){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) s );
+}
+
+void glTexCoord1sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord2d (GLdouble s, GLdouble t){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) s, (double) t );
+}
+
+void glTexCoord2dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord2f (GLfloat s, GLfloat t){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) s, (double) t );
+}
+
+void glTexCoord2fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord2i (GLint s, GLint t){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) s, (double) t );
+}
+
+void glTexCoord2iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord2s (GLshort s, GLshort t){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) s, (double) t );
+}
+
+void glTexCoord2sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord3d (GLdouble s, GLdouble t, GLdouble r){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r );
+}
+
+void glTexCoord3dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord3f (GLfloat s, GLfloat t, GLfloat r){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r );
+}
+
+void glTexCoord3fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord3i (GLint s, GLint t, GLint r){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r );
+}
+
+void glTexCoord3iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord3s (GLshort s, GLshort t, GLshort r){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r );
+}
+
+void glTexCoord3sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r, (double) q );
+}
+
+void glTexCoord4dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r, (double) q );
+}
+
+void glTexCoord4fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord4i (GLint s, GLint t, GLint r, GLint q){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r, (double) q );
+}
+
+void glTexCoord4iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) s, (double) t, (double) r, (double) q );
+}
+
+void glTexCoord4sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) size, (double) type, (double) stride );
+}
+
+void glTexEnvf (GLenum target, GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) pname, (double) param );
+}
+
+void glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
+}
+
+void glTexEnvi (GLenum target, GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) target, (double) pname, (double) param );
+}
+
+void glTexEnviv (GLenum target, GLenum pname, const GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) target, (double) pname );
+}
+
+void glTexGend (GLenum coord, GLenum pname, GLdouble param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) coord, (double) pname, (double) param );
+}
+
+void glTexGendv (GLenum coord, GLenum pname, const GLdouble *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
+}
+
+void glTexGenf (GLenum coord, GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) coord, (double) pname, (double) param );
+}
+
+void glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
+}
+
+void glTexGeni (GLenum coord, GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) coord, (double) pname, (double) param );
+}
+
+void glTexGeniv (GLenum coord, GLenum pname, const GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, ptr );\n", __func__, (double) coord, (double) pname );
+}
+
+#ifdef __APPLE__
+void glTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels){
+#else
+void glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels){
+#endif
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %d, %d, %d, %d, %d, ptr );\n", __func__, (int) target, (int) level, (int) internalformat, (int) width, (int) border, (int) format, (int) type );
+}
+
+#ifdef __APPLE__
+void glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels){
+#else
+void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels){
+#endif
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %d, %d, %d, %d, %d, %d, ptr );\n", __func__, (int) target, (int) level, (int) internalformat, (int) width, (int) height, (int) border, (int) format, (int) type );
+}
+
+void glTexParameterf (GLenum target, GLenum pname, GLfloat param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %.6g );\n", __func__, (int) target, (int) pname, (double) param );
+}
+
+void glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, ptr );\n", __func__, (int) target, (int) pname );
+}
+
+void glTexParameteri (GLenum target, GLenum pname, GLint param){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %d );\n", __func__, (int) target, (int) pname, (int) param );
+}
+
+void glTexParameteriv (GLenum target, GLenum pname, const GLint *params){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, ptr );\n", __func__, (int) target, (int) pname );
+}
+
+void glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) xoffset, (double) width, (double) format, (double) type );
+}
+
+void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) level, (double) xoffset, (double) yoffset, (double) width, (double) height, (double) format, (double) type );
+}
+
+void glTranslated (GLdouble x, GLdouble y, GLdouble z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glTranslatef (GLfloat x, GLfloat y, GLfloat z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glVertex2d (GLdouble x, GLdouble y){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
+}
+
+void glVertex2dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1] );
+}
+
+void glVertex2f (GLfloat x, GLfloat y){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
+}
+
+void glVertex2fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1] );
+}
+
+void glVertex2i (GLint x, GLint y){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
+}
+
+void glVertex2iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1] );
+}
+
+void glVertex2s (GLshort x, GLshort y){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g );\n", __func__, (double) x, (double) y );
+}
+
+void glVertex2sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1] );
+}
+
+void glVertex3d (GLdouble x, GLdouble y, GLdouble z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glVertex3dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glVertex3f (GLfloat x, GLfloat y, GLfloat z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glVertex3fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glVertex3i (GLint x, GLint y, GLint z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glVertex3iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glVertex3s (GLshort x, GLshort y, GLshort z){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z );
+}
+
+void glVertex3sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2] );
+}
+
+void glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
+}
+
+void glVertex4dv (const GLdouble *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2], (double) v[3] );
+}
+
+void glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
+}
+
+void glVertex4fv (const GLfloat *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2], (double) v[3] );
+}
+
+void glVertex4i (GLint x, GLint y, GLint z, GLint w){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
+}
+
+void glVertex4iv (const GLint *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2], (double) v[3] );
+}
+
+void glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) x, (double) y, (double) z, (double) w );
+}
+
+void glVertex4sv (const GLshort *v){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( (pointer argument - %.6g, %.6g, %.6g, %.6g) );\n", __func__, (double) v[0], (double) v[1], (double) v[2], (double) v[3] );
+}
+
+void glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr );\n", __func__, (double) size, (double) type, (double) stride );
+}
+
+void glViewport (GLint x, GLint y, GLsizei width, GLsizei height){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %d, %d, %d, %d );\n", __func__, (int) x, (int) y, (int) width, (int) height );
+}
+
+
+
+
+void gluBeginCurve (GLUnurbs* nurb){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluBeginPolygon (GLUtesselator* tess){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluBeginSurface (GLUnurbs* nurb){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluBeginTrim (GLUnurbs* nurb){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+GLint gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) format, (double) type, (double) level, (double) base, (double) max );
+	return 0;
+}
+
+GLint gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) format, (double) type );
+	return 0;
+}
+
+GLint gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) height, (double) format, (double) type, (double) level, (double) base, (double) max );
+	return 0;
+}
+
+GLint gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) height, (double) format, (double) type );
+	return 0;
+}
+
+GLint gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) height, (double) depth, (double) format, (double) type, (double) level, (double) base, (double) max );
+	return 0;
+}
+
+GLint gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) target, (double) internalFormat, (double) width, (double) height, (double) depth, (double) format, (double) type );
+	return 0;
+}
+
+GLboolean gluCheckExtension (const GLubyte *extName, const GLubyte *extString){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
+	return 0;
+}
+
+void gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) base, (double) top, (double) height, (double) slices, (double) stacks );
+}
+
+void gluDeleteNurbsRenderer (GLUnurbs* nurb){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluDeleteQuadric (GLUquadric* quad){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluDeleteTess (GLUtesselator* tess){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) inner, (double) outer, (double) slices, (double) loops );
+}
+
+void gluEndCurve (GLUnurbs* nurb){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluEndPolygon (GLUtesselator* tess){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluEndSurface (GLUnurbs* nurb){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluEndTrim (GLUnurbs* nurb){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+const GLubyte * gluErrorString (GLenum error){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) error );
+	return 0;
+}
+
+void gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, ptr );\n", __func__, (double) property );
+}
+
+const GLubyte * gluGetString (GLenum name){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g );\n", __func__, (double) name );
+	return 0;
+}
+
+void gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, ptr );\n", __func__, (double) which );
+}
+
+void gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr, ptr, ptr );\n", __func__ );
+}
+
+void gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) eyeX, (double) eyeY, (double) eyeZ, (double) centerX, (double) centerY, (double) centerZ, (double) upX, (double) upY, (double) upZ );
+}
+
+GLUnurbs* gluNewNurbsRenderer (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+	return 0;
+}
+
+GLUquadric* gluNewQuadric (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+	return 0;
+}
+
+GLUtesselator* gluNewTess (){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( );\n", __func__ );
+	return 0;
+}
+
+void gluNextContour (GLUtesselator* tess, GLenum type){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) type );
+}
+
+void gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
+}
+
+void gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
+}
+
+void gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, ptr, %.6g, ptr, %.6g, %.6g );\n", __func__, (double) knotCount, (double) stride, (double) order, (double) type );
+}
+
+void gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, %.6g );\n", __func__, (double) property, (double) value );
+}
+
+void gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, ptr, %.6g, ptr, %.6g, %.6g, ptr, %.6g, %.6g, %.6g );\n", __func__, (double) sKnotCount, (double) tKnotCount, (double) sStride, (double) tStride, (double) sOrder, (double) tOrder, (double) type );
+}
+
+void gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) left, (double) right, (double) bottom, (double) top );
+}
+
+void gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) inner, (double) outer, (double) slices, (double) loops, (double) start, (double) sweep );
+}
+
+void gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g );\n", __func__, (double) fovy, (double) aspect, (double) zNear, (double) zFar );
+}
+
+void gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) x, (double) y, (double) delX, (double) delY );
+}
+
+GLint gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr, ptr, ptr, ptr, ptr, ptr );\n", __func__, (double) objX, (double) objY, (double) objZ );
+	return 0;
+}
+
+void gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, ptr, %.6g, %.6g );\n", __func__, (double) count, (double) stride, (double) type );
+}
+
+void gluQuadricDrawStyle (GLUquadric* quad, GLenum draw){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) draw );
+}
+
+void gluQuadricNormals (GLUquadric* quad, GLenum normal){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) normal );
+}
+
+void gluQuadricOrientation (GLUquadric* quad, GLenum orientation){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) orientation );
+}
+
+void gluQuadricTexture (GLUquadric* quad, GLboolean texture){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g );\n", __func__, (double) texture );
+}
+
+GLint gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, ptr, %.6g, %.6g, %.6g, ptr );\n", __func__, (double) format, (double) wIn, (double) hIn, (double) typeIn, (double) wOut, (double) hOut, (double) typeOut );
+	return 0;
+}
+
+void gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g );\n", __func__, (double) radius, (double) slices, (double) stacks );
+}
+
+void gluTessBeginContour (GLUtesselator* tess){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr );\n", __func__ );
+}
+
+void gluTessEndContour (GLUtesselator* tess){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluTessEndPolygon (GLUtesselator* tess){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr );\n", __func__ );
+}
+
+void gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, %.6g, %.6g );\n", __func__, (double) valueX, (double) valueY, (double) valueZ );
+}
+
+void gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, %.6g, %.6g );\n", __func__, (double) which, (double) data );
+}
+
+void gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr, ptr, ptr );\n", __func__ );
+}
+
+GLint gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, ptr, ptr, ptr, ptr, ptr, ptr );\n", __func__, (double) winX, (double) winY, (double) winZ );
+	return 0;
+}
+
+GLint gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble near, GLdouble far, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( %.6g, %.6g, %.6g, %.6g, ptr, ptr, ptr, %.6g, %.6g, ptr, ptr, ptr, ptr );\n", __func__, (double) winX, (double) winY, (double) winZ, (double) clipW, (double) near, (double) far );
+	return 0;
+}
+
+
+#if 0
+/* These lines are commented out because it wont compile on the mac otherwise */
+void gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr %.6g );\n", __func__, (double) which );
+}
+
+void gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr %.6g );\n", __func__, (double) which );
+}
+
+void gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc){
+	Stream* stream = Journal_Register( Info_Type, (Name)DummyOpenGL_Type  ); 
+	Journal_Printf( stream, "%s( ptr %.6g );\n", __func__, (double) which );
+}
+#endif
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/tests/testRenderingEngineGL.c
--- a/RenderingEngines/tests/testRenderingEngineGL.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: testRenderingEngineGL.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#ifdef HAVE_PYTHON
-#include <Python.h>
-#endif
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-int main( int argc, char* argv[] ) {
-	MPI_Comm               CommWorld;
-	int                    rank;
-	int                    numProcessors;
-	Dictionary*            dictionary;
-	XML_IO_Handler*        ioHandler;
-	DomainContext* context         = NULL;
-	Stream*                dummyOpenGLStream;
-	
-	/* Initialise PETSc, get world info */
-	MPI_Init( &argc, &argv );
-	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-	MPI_Comm_size( CommWorld, &numProcessors );
-	MPI_Comm_rank( CommWorld, &rank );
-	
-	StGermain_Init( &argc, &argv );
-	StgDomain_Init( &argc, &argv );
-	lucBase_Init();
-	lucRenderingEngines_Init();
-	#ifdef HAVE_PYTHON
-	Py_Initialize();
-	#endif
-
-	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
-	
-	/* Create the application's dictionary */
-	dictionary = Dictionary_New();
-
-	/* Read input */
-	ioHandler = XML_IO_Handler_New();
-	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
-	Journal_ReadFromDictionary( dictionary );
-
-	/* Construction phase -----------------------------------------------------------------------------------------------*/
-	context = DomainContext_New( "context", 0, 0, CommWorld, dictionary );
-
-	#if 0
-	componentDict = Dictionary_GetDictionary( dictionary, "components" );
-	assert( componentDict );
-
-	context->CF = Stg_ComponentFactory_New( dictionary, componentDict, context->register_Register );
-
-	LiveComponentRegister_Add( context->CF->LCRegister, (Stg_Component*) context );
-	PluginsManager_Load( context->plugins, context, dictionary );
-	
-	Stg_ComponentFactory_CreateComponents( context->CF );
-	Stg_ComponentFactory_ConstructComponents( context->CF );
-	PluginsManager_ConstructPlugins( context->plugins, context->CF );
-	KeyCall( context, context->constructExtensionsK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(context,context->constructExtensionsK), context );
-	#endif
-
-	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, True );
-	if( rank == 0 ) 
-		Context_PrintConcise( context, context->verbose );
-
-	/* Redirect OpenGL stream */
-	dummyOpenGLStream = Journal_Register( Info_Type, (Name)"DummyOpenGL"  );
-	Stream_RedirectFile_WithPrependedPath( dummyOpenGLStream, context->outputPath, "OpenGL.txt" );
-
-	/* Building phase ---------------------------------------------------------------------------------------------------*/
-	Stg_Component_Build( context, 0 /* dummy */, False );
-	
-	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
-	Stg_Component_Initialise( context, 0 /* dummy */, False );
-	
-	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
-	AbstractContext_Dump( context );
-	
-	/* Destruct phase ---------------------------------------------------------------------------------------------------*/
-	Stg_Component_Destroy( context, 0 /* dummy */, False );
-	Stg_Class_Delete( context );
-	Stg_Class_Delete( dictionary );
-
-	#ifdef HAVE_PYTHON
-	Py_Finalize();
-	#endif
-
-	lucRenderingEngines_Finalise();
-	lucBase_Finalise();
-	StgDomain_Finalise();
-	StGermain_Finalise();
-		
-	/* Close off MPI */
-	MPI_Finalize();
-	
-	return 0; /* success */
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef RenderingEngines/tests/testRenderingEngineGL.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RenderingEngines/tests/testRenderingEngineGL.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,150 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: testRenderingEngineGL.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#ifdef HAVE_PYTHON
+#include <Python.h>
+#endif
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+int main( int argc, char* argv[] ) {
+	MPI_Comm               CommWorld;
+	int                    rank;
+	int                    numProcessors;
+	Dictionary*            dictionary;
+	XML_IO_Handler*        ioHandler;
+	DomainContext* context         = NULL;
+	Stream*                dummyOpenGLStream;
+	
+	/* Initialise PETSc, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+	
+	StGermain_Init( &argc, &argv );
+	StgDomain_Init( &argc, &argv );
+	lucBase_Init();
+	lucRenderingEngines_Init();
+	#ifdef HAVE_PYTHON
+	Py_Initialize();
+	#endif
+
+	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+	
+	/* Create the application's dictionary */
+	dictionary = Dictionary_New();
+
+	/* Read input */
+	ioHandler = XML_IO_Handler_New();
+	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
+	Journal_ReadFromDictionary( dictionary );
+
+	/* Construction phase -----------------------------------------------------------------------------------------------*/
+	context = DomainContext_New( "context", 0, 0, CommWorld, dictionary );
+
+	#if 0
+	componentDict = Dictionary_GetDictionary( dictionary, "components" );
+	assert( componentDict );
+
+	context->CF = Stg_ComponentFactory_New( dictionary, componentDict, context->register_Register );
+
+	LiveComponentRegister_Add( context->CF->LCRegister, (Stg_Component*) context );
+	PluginsManager_Load( context->plugins, context, dictionary );
+	
+	Stg_ComponentFactory_CreateComponents( context->CF );
+	Stg_ComponentFactory_ConstructComponents( context->CF );
+	PluginsManager_ConstructPlugins( context->plugins, context->CF );
+	KeyCall( context, context->constructExtensionsK, EntryPoint_VoidPtr_CallCast* )( KeyHandle(context,context->constructExtensionsK), context );
+	#endif
+
+	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, True );
+	if( rank == 0 ) 
+		Context_PrintConcise( context, context->verbose );
+
+	/* Redirect OpenGL stream */
+	dummyOpenGLStream = Journal_Register( Info_Type, (Name)"DummyOpenGL"  );
+	Stream_RedirectFile_WithPrependedPath( dummyOpenGLStream, context->outputPath, "OpenGL.txt" );
+
+	/* Building phase ---------------------------------------------------------------------------------------------------*/
+	Stg_Component_Build( context, 0 /* dummy */, False );
+	
+	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
+	Stg_Component_Initialise( context, 0 /* dummy */, False );
+	
+	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
+	AbstractContext_Dump( context );
+	
+	/* Destruct phase ---------------------------------------------------------------------------------------------------*/
+	Stg_Component_Destroy( context, 0 /* dummy */, False );
+	Stg_Class_Delete( context );
+	Stg_Class_Delete( dictionary );
+
+	#ifdef HAVE_PYTHON
+	Py_Finalize();
+	#endif
+
+	lucRenderingEngines_Finalise();
+	lucBase_Finalise();
+	StgDomain_Finalise();
+	StGermain_Finalise();
+		
+	/* Close off MPI */
+	MPI_Finalize();
+	
+	return 0; /* success */
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef SConscript
--- a/SConscript	Fri Nov 12 16:02:26 2010 -0800
+++ b/SConscript	Thu May 12 11:23:36 2011 -0700
@@ -58,8 +58,8 @@ for d in dirs:
     defs = env.Install(inc_dir, Glob(src_dir + '/*.def'))
 
     # Build our source files.
-    srcs = Glob(src_dir + '/*.c')
-    srcs = [s for s in srcs if s.path.find('-meta.c') == -1]
+    srcs = Glob(src_dir + '/*.cxx')
+    srcs = [s for s in srcs if s.path.find('-meta.cxx') == -1]
     objs += env.SharedObject(srcs, CPPDEFINES=cpp_defs)
 
     # Build any meta files.
@@ -71,7 +71,7 @@ for d in dirs:
         env.Depends(hdrs + objs, defs)
 
     # Build any test suites we might find.
-    suites += env.Object(Glob(tst_dir + '/*Suite.c'))
+    suites += env.Object(Glob(tst_dir + '/*Suite.cxx'))
 
     # Install any test expected and input files
     tst_exp += env.Install(tst_install_dir + '/expected', Glob(tst_exp_dir + '/*'))
@@ -100,8 +100,8 @@ for d in dirs:
 
     env.Install('include/glucifer/' + d.split('/')[-1], Glob(d + '/*.h'))
 
-    srcs = Glob(d + '/*.c')
-    srcs = [s for s in srcs if s.path.find('-meta.c') == -1]
+    srcs = Glob(d + '/*.cxx')
+    srcs = [s for s in srcs if s.path.find('-meta.cxx') == -1]
     cur_objs = env.SharedObject(srcs, CPPDEFINES=cpp_defs)
     cur_objs += env.stgSharedMeta(Glob(d + '/*.meta'), CPPDEFINES=cpp_defs)
 
@@ -202,7 +202,7 @@ if env['static_libs']:
     reg_c += '\n   stg_num_modules += %d;\n'%len(pl_regs)
     reg_c += '}\n'
 
-    reg_filename = os.path.join(env['build_dir'], 'gLucifer', 'glucifer_static_modules.c')
+    reg_filename = os.path.join(env['build_dir'], 'gLucifer', 'glucifer_static_modules.cxx')
     if not os.path.exists(os.path.dirname(reg_filename)):
         os.makedirs(os.path.dirname(reg_filename))
     reg_file = open(reg_filename, 'w')
@@ -211,12 +211,12 @@ if env['static_libs']:
     reg_obj = env.Object(reg_filename)
 
     # Add our register function to the StGermain module file.
-    f = open(File(env['build_dir'] + '/StGermain/stg_static_modules.c').abspath, 'r')
+    f = open(File(env['build_dir'] + '/StGermain/stg_static_modules.cxx').abspath, 'r')
     txt = f.readlines()
     f.close()
     txt.insert(-2, '   glucifer_register_static_modules();\n')
     txt.insert(0, 'void glucifer_register_static_modules();\n')
-    f = open(File(env['build_dir'] + '/StGermain/stg_static_modules.c').abspath, 'w')
+    f = open(File(env['build_dir'] + '/StGermain/stg_static_modules.cxx').abspath, 'w')
     f.writelines(txt)
     f.close()
 
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/ColourBarInteraction.c
--- a/WindowInteractions/src/ColourBarInteraction.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: ColourBarInteraction.c 510 2006-02-17 04:33:32Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/Windowing/Windowing.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/DrawingObjects/DrawingObjects.h>
-
-#include "types.h"
-#include "ColourBarInteraction.h"
-
-#include <assert.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucColourBarInteraction_Type = "lucColourBarInteraction";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucColourBarInteraction* _lucColourBarInteraction_New(  LUCCOLOURBARINTERACTION_DEFARGS  ) 
-{
-	lucColourBarInteraction*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucColourBarInteraction) );
-	self = (lucColourBarInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucColourBarInteraction_Init( 
-		lucColourBarInteraction*                                      self  ) 
-{
-}
-
-void _lucColourBarInteraction_Delete( void* ColourBarInteraction ) {
-	lucColourBarInteraction*  self = (lucColourBarInteraction*)ColourBarInteraction;
-
-	_lucWindowInteraction_Delete( self );
-}
-
-void _lucColourBarInteraction_Print( void* ColourBarInteraction, Stream* stream ) {
-	lucColourBarInteraction*  self = (lucColourBarInteraction*)ColourBarInteraction;
-
-	_lucWindowInteraction_Print( self, stream );
-}
-
-void* _lucColourBarInteraction_Copy( void* ColourBarInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucColourBarInteraction*  self = (lucColourBarInteraction*)ColourBarInteraction;
-	lucColourBarInteraction* newColourBarInteraction;
-
-	newColourBarInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newColourBarInteraction;
-}
-
-
-void* _lucColourBarInteraction_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                  _sizeOfSelf = sizeof(lucColourBarInteraction);
-	Type                                                          type = lucColourBarInteraction_Type;
-	Stg_Class_DeleteFunction*                                  _delete = _lucColourBarInteraction_Delete;
-	Stg_Class_PrintFunction*                                    _print = _lucColourBarInteraction_Print;
-	Stg_Class_CopyFunction*                                      _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucColourBarInteraction_DefaultNew;
-	Stg_Component_ConstructFunction*                        _construct = _lucColourBarInteraction_AssignFromXML;
-	Stg_Component_BuildFunction*                                _build = _lucColourBarInteraction_Build;
-	Stg_Component_InitialiseFunction*                      _initialise = _lucColourBarInteraction_Initialise;
-	Stg_Component_ExecuteFunction*                            _execute = _lucColourBarInteraction_Execute;
-	Stg_Component_DestroyFunction*                            _destroy = _lucColourBarInteraction_Destroy;
-	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucColourBarInteraction_MouseMotion;
-	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucColourBarInteraction_MouseClick;
-	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucColourBarInteraction_MouseMessage;
-	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucColourBarInteraction_KeyboardEvent;
-	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucColourBarInteraction_KeyboardMessage;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucColourBarInteraction_New(  LUCCOLOURBARINTERACTION_PASSARGS  );
-}
-
-void _lucColourBarInteraction_AssignFromXML( void* ColourBarInteraction, Stg_ComponentFactory* cf, void* data ){
-	lucColourBarInteraction*  self = (lucColourBarInteraction*)ColourBarInteraction;
-
-	/* Construct Parent */
-	_lucWindowInteraction_AssignFromXML( self, cf, data );
-	
-	_lucColourBarInteraction_Init( self );
-}
-
-void _lucColourBarInteraction_Build( void* renderingEngine, void* data ) {}
-void _lucColourBarInteraction_Initialise( void* renderingEngine, void* data ) {}
-void _lucColourBarInteraction_Execute( void* renderingEngine, void* data ) {}
-void _lucColourBarInteraction_Destroy( void* renderingEngine, void* data ) {}
-
-/* This component doesn't use any mouse interaction */
-void _lucColourBarInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
-void _lucColourBarInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
-void _lucColourBarInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
-
-
-void _lucColourBarInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
-	lucColourBarInteraction*   self = (lucColourBarInteraction*) windowInteraction;
-	lucViewportInfo*            viewportInfo;
-	lucViewport*                viewport;
-	Coord                       coord;
-	lucDrawingObject*           object;
-	Stream*                     stream = Journal_MyStream( Info_Type, self );
-	DrawingObject_Index         object_I;
-	DrawingObject_Index         objectCount;
-	double                      value;
-	lucColourBar*               colourBar;
-	Pixel_Index                 length;
-	Pixel_Index                 height;
-	Pixel_Index                 pixel_I;
-	int                         startPos[2];
-
-
-	/* This function works when the key pressed is 'c' */
-	if ( key != 'c' )
-		return;
-	
-	/* Find which viewport the user clicked on */
-	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
-	if ( viewportInfo == NULL )
-		return; /* If the user hasn't clicked on a viewport at all, then return */
-
-	viewport = viewportInfo->viewport;
-
-	/* Get spatial coordinate that the user clicked on */
-	lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
-
-	/* Loop through lucScalarFields that are registered on the viewport */
-	objectCount   = lucDrawingObject_Register_GetCount( viewport->drawingObject_Register );
-	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
-		object = lucDrawingObject_Register_GetByIndex( viewport->drawingObject_Register, object_I );
-
-		/* Check if this drawing object is a colourBar type */
-		if ( Stg_Class_IsInstance( object, lucColourBar_Type ) ) {
-			colourBar = (lucColourBar*) object;
-			length        = (Pixel_Index) ((double) viewportInfo->width * colourBar->lengthFactor);
-			height         = colourBar->height;
-
-			/* Finds if the position is in the colourBar */		
-			startPos[0] = (viewportInfo->width - length)/2 + viewportInfo->startx;
-			startPos[1] = colourBar->margin + viewportInfo->starty;
-
-			if ( (xpos >= startPos[0]) && ( xpos <= startPos[0] + length) && (ypos >= startPos[1]) && (ypos <= startPos[1]+height)){
-				/* finds the value of the pixel */
-				pixel_I =  xpos - startPos[0];
-				value = colourBar->colourMap->minimum + (double) pixel_I * (colourBar->colourMap->maximum - colourBar->colourMap->minimum) / (double) length;
-			
-		    	Journal_Printf( stream, "Value for this colour is  '%.4E' \n ",value );
-			}
-			else Journal_Printf( stream, "The mouse should be positionned on the colourBar \n " );
-		}
-	}
-}
-
-void _lucColourBarInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
-	Journal_Printf( stream,
-			"c:                            The value of ColourBar's colour under the cursor will be printed to screen.\n" );
-}
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/ColourBarInteraction.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WindowInteractions/src/ColourBarInteraction.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,216 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: ColourBarInteraction.c 510 2006-02-17 04:33:32Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/Windowing/Windowing.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/DrawingObjects/DrawingObjects.h>
+
+#include "types.h"
+#include "ColourBarInteraction.h"
+
+#include <assert.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucColourBarInteraction_Type = "lucColourBarInteraction";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucColourBarInteraction* _lucColourBarInteraction_New(  LUCCOLOURBARINTERACTION_DEFARGS  ) 
+{
+	lucColourBarInteraction*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucColourBarInteraction) );
+	self = (lucColourBarInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucColourBarInteraction_Init( 
+		lucColourBarInteraction*                                      self  ) 
+{
+}
+
+void _lucColourBarInteraction_Delete( void* ColourBarInteraction ) {
+	lucColourBarInteraction*  self = (lucColourBarInteraction*)ColourBarInteraction;
+
+	_lucWindowInteraction_Delete( self );
+}
+
+void _lucColourBarInteraction_Print( void* ColourBarInteraction, Stream* stream ) {
+	lucColourBarInteraction*  self = (lucColourBarInteraction*)ColourBarInteraction;
+
+	_lucWindowInteraction_Print( self, stream );
+}
+
+void* _lucColourBarInteraction_Copy( void* ColourBarInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucColourBarInteraction*  self = (lucColourBarInteraction*)ColourBarInteraction;
+	lucColourBarInteraction* newColourBarInteraction;
+
+	newColourBarInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newColourBarInteraction;
+}
+
+
+void* _lucColourBarInteraction_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                  _sizeOfSelf = sizeof(lucColourBarInteraction);
+	Type                                                          type = lucColourBarInteraction_Type;
+	Stg_Class_DeleteFunction*                                  _delete = _lucColourBarInteraction_Delete;
+	Stg_Class_PrintFunction*                                    _print = _lucColourBarInteraction_Print;
+	Stg_Class_CopyFunction*                                      _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucColourBarInteraction_DefaultNew;
+	Stg_Component_ConstructFunction*                        _construct = _lucColourBarInteraction_AssignFromXML;
+	Stg_Component_BuildFunction*                                _build = _lucColourBarInteraction_Build;
+	Stg_Component_InitialiseFunction*                      _initialise = _lucColourBarInteraction_Initialise;
+	Stg_Component_ExecuteFunction*                            _execute = _lucColourBarInteraction_Execute;
+	Stg_Component_DestroyFunction*                            _destroy = _lucColourBarInteraction_Destroy;
+	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucColourBarInteraction_MouseMotion;
+	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucColourBarInteraction_MouseClick;
+	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucColourBarInteraction_MouseMessage;
+	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucColourBarInteraction_KeyboardEvent;
+	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucColourBarInteraction_KeyboardMessage;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucColourBarInteraction_New(  LUCCOLOURBARINTERACTION_PASSARGS  );
+}
+
+void _lucColourBarInteraction_AssignFromXML( void* ColourBarInteraction, Stg_ComponentFactory* cf, void* data ){
+	lucColourBarInteraction*  self = (lucColourBarInteraction*)ColourBarInteraction;
+
+	/* Construct Parent */
+	_lucWindowInteraction_AssignFromXML( self, cf, data );
+	
+	_lucColourBarInteraction_Init( self );
+}
+
+void _lucColourBarInteraction_Build( void* renderingEngine, void* data ) {}
+void _lucColourBarInteraction_Initialise( void* renderingEngine, void* data ) {}
+void _lucColourBarInteraction_Execute( void* renderingEngine, void* data ) {}
+void _lucColourBarInteraction_Destroy( void* renderingEngine, void* data ) {}
+
+/* This component doesn't use any mouse interaction */
+void _lucColourBarInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
+void _lucColourBarInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
+void _lucColourBarInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
+
+
+void _lucColourBarInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
+	lucColourBarInteraction*   self = (lucColourBarInteraction*) windowInteraction;
+	lucViewportInfo*            viewportInfo;
+	lucViewport*                viewport;
+	Coord                       coord;
+	lucDrawingObject*           object;
+	Stream*                     stream = Journal_MyStream( Info_Type, self );
+	DrawingObject_Index         object_I;
+	DrawingObject_Index         objectCount;
+	double                      value;
+	lucColourBar*               colourBar;
+	Pixel_Index                 length;
+	Pixel_Index                 height;
+	Pixel_Index                 pixel_I;
+	int                         startPos[2];
+
+
+	/* This function works when the key pressed is 'c' */
+	if ( key != 'c' )
+		return;
+	
+	/* Find which viewport the user clicked on */
+	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
+	if ( viewportInfo == NULL )
+		return; /* If the user hasn't clicked on a viewport at all, then return */
+
+	viewport = viewportInfo->viewport;
+
+	/* Get spatial coordinate that the user clicked on */
+	lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
+
+	/* Loop through lucScalarFields that are registered on the viewport */
+	objectCount   = lucDrawingObject_Register_GetCount( viewport->drawingObject_Register );
+	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
+		object = lucDrawingObject_Register_GetByIndex( viewport->drawingObject_Register, object_I );
+
+		/* Check if this drawing object is a colourBar type */
+		if ( Stg_Class_IsInstance( object, lucColourBar_Type ) ) {
+			colourBar = (lucColourBar*) object;
+			length        = (Pixel_Index) ((double) viewportInfo->width * colourBar->lengthFactor);
+			height         = colourBar->height;
+
+			/* Finds if the position is in the colourBar */		
+			startPos[0] = (viewportInfo->width - length)/2 + viewportInfo->startx;
+			startPos[1] = colourBar->margin + viewportInfo->starty;
+
+			if ( (xpos >= startPos[0]) && ( xpos <= startPos[0] + length) && (ypos >= startPos[1]) && (ypos <= startPos[1]+height)){
+				/* finds the value of the pixel */
+				pixel_I =  xpos - startPos[0];
+				value = colourBar->colourMap->minimum + (double) pixel_I * (colourBar->colourMap->maximum - colourBar->colourMap->minimum) / (double) length;
+			
+		    	Journal_Printf( stream, "Value for this colour is  '%.4E' \n ",value );
+			}
+			else Journal_Printf( stream, "The mouse should be positionned on the colourBar \n " );
+		}
+	}
+}
+
+void _lucColourBarInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
+	Journal_Printf( stream,
+			"c:                            The value of ColourBar's colour under the cursor will be printed to screen.\n" );
+}
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/FieldValueInteraction.c
--- a/WindowInteractions/src/FieldValueInteraction.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: FieldValueInteraction.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/Windowing/Windowing.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/DrawingObjects/DrawingObjects.h>
-
-#include "types.h"
-#include "FieldValueInteraction.h"
-
-#include <assert.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucFieldValueInteraction_Type = "lucFieldValueInteraction";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucFieldValueInteraction* _lucFieldValueInteraction_New(  LUCFIELDVALUEINTERACTION_DEFARGS  ) 
-{
-	lucFieldValueInteraction*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucFieldValueInteraction) );
-	self = (lucFieldValueInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucFieldValueInteraction_Init( 
-		lucFieldValueInteraction*                                      self  ) 
-{
-}
-
-void _lucFieldValueInteraction_Delete( void* FieldValueInteraction ) {
-	lucFieldValueInteraction*  self = (lucFieldValueInteraction*)FieldValueInteraction;
-
-	_lucWindowInteraction_Delete( self );
-}
-
-void _lucFieldValueInteraction_Print( void* FieldValueInteraction, Stream* stream ) {
-	lucFieldValueInteraction*  self = (lucFieldValueInteraction*)FieldValueInteraction;
-
-	_lucWindowInteraction_Print( self, stream );
-}
-
-void* _lucFieldValueInteraction_Copy( void* FieldValueInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucFieldValueInteraction*  self = (lucFieldValueInteraction*)FieldValueInteraction;
-	lucFieldValueInteraction* newFieldValueInteraction;
-
-	newFieldValueInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newFieldValueInteraction;
-}
-
-
-void* _lucFieldValueInteraction_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                  _sizeOfSelf = sizeof(lucFieldValueInteraction);
-	Type                                                          type = lucFieldValueInteraction_Type;
-	Stg_Class_DeleteFunction*                                  _delete = _lucFieldValueInteraction_Delete;
-	Stg_Class_PrintFunction*                                    _print = _lucFieldValueInteraction_Print;
-	Stg_Class_CopyFunction*                                      _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucFieldValueInteraction_DefaultNew;
-	Stg_Component_ConstructFunction*                        _construct = _lucFieldValueInteraction_AssignFromXML;
-	Stg_Component_BuildFunction*                                _build = _lucFieldValueInteraction_Build;
-	Stg_Component_InitialiseFunction*                      _initialise = _lucFieldValueInteraction_Initialise;
-	Stg_Component_ExecuteFunction*                            _execute = _lucFieldValueInteraction_Execute;
-	Stg_Component_DestroyFunction*                            _destroy = _lucFieldValueInteraction_Destroy;
-	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucFieldValueInteraction_MouseMotion;
-	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucFieldValueInteraction_MouseClick;
-	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucFieldValueInteraction_MouseMessage;
-	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucFieldValueInteraction_KeyboardEvent;
-	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucFieldValueInteraction_KeyboardMessage;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucFieldValueInteraction_New(  LUCFIELDVALUEINTERACTION_PASSARGS  );
-}
-
-void _lucFieldValueInteraction_AssignFromXML( void* FieldValueInteraction, Stg_ComponentFactory* cf, void* data ){
-	lucFieldValueInteraction*  self = (lucFieldValueInteraction*)FieldValueInteraction;
-
-	/* Construct Parent */
-	_lucWindowInteraction_AssignFromXML( self, cf, data );
-	
-	_lucFieldValueInteraction_Init( self );
-}
-
-void _lucFieldValueInteraction_Build( void* renderingEngine, void* data ) {}
-void _lucFieldValueInteraction_Initialise( void* renderingEngine, void* data ) {}
-void _lucFieldValueInteraction_Execute( void* renderingEngine, void* data ) {}
-void _lucFieldValueInteraction_Destroy( void* renderingEngine, void* data ) {}
-
-/* This component doesn't use any mouse interaction */
-void _lucFieldValueInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
-void _lucFieldValueInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
-void _lucFieldValueInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
-
-
-void _lucFieldValueInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
-	lucFieldValueInteraction*   self = (lucFieldValueInteraction*) windowInteraction;
-	lucViewportInfo*            viewportInfo;
-	lucViewport*                viewport;
-	Coord                       coord;
-	lucDrawingObject*           object;
-	lucScalarFieldCrossSection* scalarField;
-	Stream*                     stream = Journal_MyStream( Info_Type, self );
-	DrawingObject_Index         object_I;
-	DrawingObject_Index         objectCount;
-	double                      value;
-	FieldVariable*              fieldVariable;
-
-	/* This function works when the key pressed is 'f' */
-	if ( key != 'f' )
-		return;
-	
-	/* Find which viewport the user clicked on */
-	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
-	if ( viewportInfo == NULL )
-		return; /* If the user hasn't clicked on a viewport at all, then return */
-
-	viewport = viewportInfo->viewport;
-
-	/* Get spatial coordinate that the user clicked on */
-	lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
-
-	/* Loop through lucScalarFields that are registered on the viewport */
-	objectCount   = lucDrawingObject_Register_GetCount( viewport->drawingObject_Register );
-	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
-		object = lucDrawingObject_Register_GetByIndex( viewport->drawingObject_Register, object_I );
-
-		/* Check if this drawing object is a scalar field */
-		if ( Stg_Class_IsInstance( object, lucScalarFieldCrossSection_Type ) ) {
-			scalarField = (lucScalarFieldCrossSection*) object;
-			fieldVariable = scalarField->fieldVariable;
-
-			/* Get Value of the field, and store which processor it is on */
-			if ( FieldVariable_InterpolateValueAt( fieldVariable, coord, &value ) == LOCAL ) {
-				Journal_Printf( stream, "Field '%s' (type %s) at coord (%g, %g, %g) is %g\n", 
-						fieldVariable->name, fieldVariable->type, 
-						coord[ I_AXIS ], coord[ J_AXIS ], coord[ K_AXIS ], value );
-			}
-		}
-	}
-
-	/* Loop through other FieldVariables that are registered on this object */
-}
-
-void _lucFieldValueInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
-	Journal_Printf( stream,
-			"f:                            The value of fields under the cursor with be printed to screen.\n" );
-}
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/FieldValueInteraction.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WindowInteractions/src/FieldValueInteraction.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,207 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: FieldValueInteraction.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/Windowing/Windowing.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/DrawingObjects/DrawingObjects.h>
+
+#include "types.h"
+#include "FieldValueInteraction.h"
+
+#include <assert.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucFieldValueInteraction_Type = "lucFieldValueInteraction";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucFieldValueInteraction* _lucFieldValueInteraction_New(  LUCFIELDVALUEINTERACTION_DEFARGS  ) 
+{
+	lucFieldValueInteraction*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucFieldValueInteraction) );
+	self = (lucFieldValueInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucFieldValueInteraction_Init( 
+		lucFieldValueInteraction*                                      self  ) 
+{
+}
+
+void _lucFieldValueInteraction_Delete( void* FieldValueInteraction ) {
+	lucFieldValueInteraction*  self = (lucFieldValueInteraction*)FieldValueInteraction;
+
+	_lucWindowInteraction_Delete( self );
+}
+
+void _lucFieldValueInteraction_Print( void* FieldValueInteraction, Stream* stream ) {
+	lucFieldValueInteraction*  self = (lucFieldValueInteraction*)FieldValueInteraction;
+
+	_lucWindowInteraction_Print( self, stream );
+}
+
+void* _lucFieldValueInteraction_Copy( void* FieldValueInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucFieldValueInteraction*  self = (lucFieldValueInteraction*)FieldValueInteraction;
+	lucFieldValueInteraction* newFieldValueInteraction;
+
+	newFieldValueInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newFieldValueInteraction;
+}
+
+
+void* _lucFieldValueInteraction_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                  _sizeOfSelf = sizeof(lucFieldValueInteraction);
+	Type                                                          type = lucFieldValueInteraction_Type;
+	Stg_Class_DeleteFunction*                                  _delete = _lucFieldValueInteraction_Delete;
+	Stg_Class_PrintFunction*                                    _print = _lucFieldValueInteraction_Print;
+	Stg_Class_CopyFunction*                                      _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucFieldValueInteraction_DefaultNew;
+	Stg_Component_ConstructFunction*                        _construct = _lucFieldValueInteraction_AssignFromXML;
+	Stg_Component_BuildFunction*                                _build = _lucFieldValueInteraction_Build;
+	Stg_Component_InitialiseFunction*                      _initialise = _lucFieldValueInteraction_Initialise;
+	Stg_Component_ExecuteFunction*                            _execute = _lucFieldValueInteraction_Execute;
+	Stg_Component_DestroyFunction*                            _destroy = _lucFieldValueInteraction_Destroy;
+	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucFieldValueInteraction_MouseMotion;
+	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucFieldValueInteraction_MouseClick;
+	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucFieldValueInteraction_MouseMessage;
+	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucFieldValueInteraction_KeyboardEvent;
+	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucFieldValueInteraction_KeyboardMessage;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucFieldValueInteraction_New(  LUCFIELDVALUEINTERACTION_PASSARGS  );
+}
+
+void _lucFieldValueInteraction_AssignFromXML( void* FieldValueInteraction, Stg_ComponentFactory* cf, void* data ){
+	lucFieldValueInteraction*  self = (lucFieldValueInteraction*)FieldValueInteraction;
+
+	/* Construct Parent */
+	_lucWindowInteraction_AssignFromXML( self, cf, data );
+	
+	_lucFieldValueInteraction_Init( self );
+}
+
+void _lucFieldValueInteraction_Build( void* renderingEngine, void* data ) {}
+void _lucFieldValueInteraction_Initialise( void* renderingEngine, void* data ) {}
+void _lucFieldValueInteraction_Execute( void* renderingEngine, void* data ) {}
+void _lucFieldValueInteraction_Destroy( void* renderingEngine, void* data ) {}
+
+/* This component doesn't use any mouse interaction */
+void _lucFieldValueInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
+void _lucFieldValueInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
+void _lucFieldValueInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
+
+
+void _lucFieldValueInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
+	lucFieldValueInteraction*   self = (lucFieldValueInteraction*) windowInteraction;
+	lucViewportInfo*            viewportInfo;
+	lucViewport*                viewport;
+	Coord                       coord;
+	lucDrawingObject*           object;
+	lucScalarFieldCrossSection* scalarField;
+	Stream*                     stream = Journal_MyStream( Info_Type, self );
+	DrawingObject_Index         object_I;
+	DrawingObject_Index         objectCount;
+	double                      value;
+	FieldVariable*              fieldVariable;
+
+	/* This function works when the key pressed is 'f' */
+	if ( key != 'f' )
+		return;
+	
+	/* Find which viewport the user clicked on */
+	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
+	if ( viewportInfo == NULL )
+		return; /* If the user hasn't clicked on a viewport at all, then return */
+
+	viewport = viewportInfo->viewport;
+
+	/* Get spatial coordinate that the user clicked on */
+	lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
+
+	/* Loop through lucScalarFields that are registered on the viewport */
+	objectCount   = lucDrawingObject_Register_GetCount( viewport->drawingObject_Register );
+	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
+		object = lucDrawingObject_Register_GetByIndex( viewport->drawingObject_Register, object_I );
+
+		/* Check if this drawing object is a scalar field */
+		if ( Stg_Class_IsInstance( object, lucScalarFieldCrossSection_Type ) ) {
+			scalarField = (lucScalarFieldCrossSection*) object;
+			fieldVariable = scalarField->fieldVariable;
+
+			/* Get Value of the field, and store which processor it is on */
+			if ( FieldVariable_InterpolateValueAt( fieldVariable, coord, &value ) == LOCAL ) {
+				Journal_Printf( stream, "Field '%s' (type %s) at coord (%g, %g, %g) is %g\n", 
+						fieldVariable->name, fieldVariable->type, 
+						coord[ I_AXIS ], coord[ J_AXIS ], coord[ K_AXIS ], value );
+			}
+		}
+	}
+
+	/* Loop through other FieldVariables that are registered on this object */
+}
+
+void _lucFieldValueInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
+	Journal_Printf( stream,
+			"f:                            The value of fields under the cursor with be printed to screen.\n" );
+}
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/Finalise.c
--- a/WindowInteractions/src/Finalise.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool lucWindowInteractions_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WindowInteractions/src/Finalise.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,60 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool lucWindowInteractions_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/Init.c
--- a/WindowInteractions/src/Init.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-
-#include "WindowInteractions.h"
-
-Bool lucWindowInteractions_Init() {
-	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	Stg_ComponentRegister_Add( componentRegister, lucFieldValueInteraction_Type, (Name)"0", _lucFieldValueInteraction_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucMeshViewerInteraction_Type, (Name)"0", _lucMeshViewerInteraction_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucSwarmViewerInteraction_Type, (Name)"0", _lucSwarmViewerInteraction_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucColourBarInteraction_Type, (Name)"0", _lucColourBarInteraction_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, lucLightInteraction_Type, (Name)"0", _lucLightInteraction_DefaultNew  );
-
-
-
-	/* Register Parents for type checking */
-	RegisterParent( lucFieldValueInteraction_Type,   lucWindowInteraction_Type );
-	RegisterParent( lucMeshViewerInteraction_Type,   lucWindowInteraction_Type );
-	RegisterParent( lucSwarmViewerInteraction_Type,  lucWindowInteraction_Type );
-	RegisterParent( lucColourBarInteraction_Type,   lucWindowInteraction_Type );
-	RegisterParent( lucLightInteraction_Type,        lucWindowInteraction_Type );
-
-	
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WindowInteractions/src/Init.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,77 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+
+#include "WindowInteractions.h"
+
+Bool lucWindowInteractions_Init() {
+	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	Stg_ComponentRegister_Add( componentRegister, lucFieldValueInteraction_Type, (Name)"0", _lucFieldValueInteraction_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucMeshViewerInteraction_Type, (Name)"0", _lucMeshViewerInteraction_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucSwarmViewerInteraction_Type, (Name)"0", _lucSwarmViewerInteraction_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucColourBarInteraction_Type, (Name)"0", _lucColourBarInteraction_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, lucLightInteraction_Type, (Name)"0", _lucLightInteraction_DefaultNew  );
+
+
+
+	/* Register Parents for type checking */
+	RegisterParent( lucFieldValueInteraction_Type,   lucWindowInteraction_Type );
+	RegisterParent( lucMeshViewerInteraction_Type,   lucWindowInteraction_Type );
+	RegisterParent( lucSwarmViewerInteraction_Type,  lucWindowInteraction_Type );
+	RegisterParent( lucColourBarInteraction_Type,   lucWindowInteraction_Type );
+	RegisterParent( lucLightInteraction_Type,        lucWindowInteraction_Type );
+
+	
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/LightInteraction.c
--- a/WindowInteractions/src/LightInteraction.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: LightInteraction.c 628 2006-10-12 08:23:07Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/Windowing/Windowing.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/DrawingObjects/DrawingObjects.h>
-
-#include "types.h"
-#include "LightInteraction.h"
-
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucLightInteraction_Type = "lucLightInteraction";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucLightInteraction* _lucLightInteraction_New(  LUCLIGHTINTERACTION_DEFARGS  ) 
-{
-	lucLightInteraction*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucLightInteraction) );
-	self = (lucLightInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucLightInteraction_Init( 
-		lucLightInteraction*                                      self  ) 
-{
-}
-
-void _lucLightInteraction_Delete( void* LightInteraction ) {
-	lucLightInteraction*  self = (lucLightInteraction*)LightInteraction;
-
-	_lucWindowInteraction_Delete( self );
-}
-
-void _lucLightInteraction_Print( void* LightInteraction, Stream* stream ) {
-	lucLightInteraction*  self = (lucLightInteraction*)LightInteraction;
-
-	_lucWindowInteraction_Print( self, stream );
-}
-
-void* _lucLightInteraction_Copy( void* LightInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucLightInteraction*  self = (lucLightInteraction*) LightInteraction;
-	lucLightInteraction* newLightInteraction;
-
-	newLightInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newLightInteraction;
-}
-
-
-void* _lucLightInteraction_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                  _sizeOfSelf = sizeof(lucLightInteraction);
-	Type                                                          type = lucLightInteraction_Type;
-	Stg_Class_DeleteFunction*                                  _delete = _lucLightInteraction_Delete;
-	Stg_Class_PrintFunction*                                    _print = _lucLightInteraction_Print;
-	Stg_Class_CopyFunction*                                      _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucLightInteraction_DefaultNew;
-	Stg_Component_ConstructFunction*                        _construct = _lucLightInteraction_AssignFromXML;
-	Stg_Component_BuildFunction*                                _build = _lucLightInteraction_Build;
-	Stg_Component_InitialiseFunction*                      _initialise = _lucLightInteraction_Initialise;
-	Stg_Component_ExecuteFunction*                            _execute = _lucLightInteraction_Execute;
-	Stg_Component_DestroyFunction*                            _destroy = _lucLightInteraction_Destroy;
-	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucLightInteraction_MouseMotion;
-	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucLightInteraction_MouseClick;
-	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucLightInteraction_MouseMessage;
-	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucLightInteraction_KeyboardEvent;
-	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucLightInteraction_KeyboardMessage;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucLightInteraction_New(  LUCLIGHTINTERACTION_PASSARGS  );
-}
-
-void _lucLightInteraction_AssignFromXML( void* LightInteraction, Stg_ComponentFactory* cf, void* data ){
-	lucLightInteraction*  self = LightInteraction;
-
-	/* Construct Parent */
-	_lucWindowInteraction_AssignFromXML(self, cf, data );
-	
-	_lucLightInteraction_Init( self );
-}
-
-void _lucLightInteraction_Build( void* renderingEngine, void* data ) {}
-void _lucLightInteraction_Initialise( void* renderingEngine, void* data ) {}
-void _lucLightInteraction_Execute( void* renderingEngine, void* data ) {}
-void _lucLightInteraction_Destroy( void* renderingEngine, void* data ) {}
-
-/* This component doesn't use any mouse interaction */
-void _lucLightInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
-void _lucLightInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
-void _lucLightInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
-
-
-void _lucLightInteraction_KeyboardEvent( void* WindowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
-	lucLightInteraction*   self;
-	lucViewportInfo*            viewportInfo;
-	lucViewport*                viewport;
-	Coord                       coord;
-	lucLight*                   light;
-	Light_Index                 light_I;
-	Light_Index                 lightCount;
-	float                       posX = 0;
-	float                       posY = 0;
-	float                       posZ = 0;
-	float                       initialPosition[4];
-	int                         i;
-	Light_Index                  currentLight_I=0;
-
-	self = (lucLightInteraction*) WindowInteraction;
-
-	/* This function works when the key pressed is one of  'x', 'y, 'z', 'l', 'm', 'n'*/
-	if ( ( key != 'x' )&&( key != 'y' ) && ( key != 'z' ) && ( key != 'k' ) && ( key != 'l' ) &&( key != 'm') &&( key != 'p')&&( key !='w') )
-		return;
-	
-	/* Find which viewport the user clicked on */
-	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
-	if ( viewportInfo == NULL )
-		return; /* If the user hasn't clicked on a viewport at all, then return */
-
-	viewport = viewportInfo->viewport;
-
-	
-	
-	/* Get the light */
-	/* Loop through lights that are registered on the window */
-	lightCount   = lucLight_Register_GetCount( viewport->light_Register );
-	
-	for ( light_I = 0 ; light_I < lightCount ; light_I++ ) {
-		light = lucLight_Register_GetByIndex( viewport->light_Register, light_I );
-		//printf(" Initial position SELF is %.2f, %.2f, %.2f, %.2f \n", light->position[0], light->position[1], light->position[2], light->position[3]);
-
-		for(i =0; i<4; i++) initialPosition[i] = 0;
-		
-	
-	       // lucLight_GetGLIndex(light->index, glIndex);
-		//glGetLightfv(GL_LIGHT0, GL_POSITION, initialPosition);
-	
-		//printf(" Initial position is %.2f, %.2f, %.2f, %.2f \n", initialPosition[0], initialPosition[1], initialPosition[2], initialPosition[3]);
-
-	}
-
-	
-	/* Implements the light position changes */
-
-	if(key == 'w'){
-		/* retrieve the currentLightIndex and increases it if suitable */
-		lucLight_Register_ChangeCurrentLightIndex(viewport->light_Register);
-		currentLight_I = lucLight_Register_GetCurrentLightIndex( viewport->light_Register );
-
-		printf("\n\n\n Selected light is index %d \n\n\n\n\n", currentLight_I);
-	}
-
-	if ( key == 'x' ){
-	       // printf(" Increasing light x position by 0.5 \n ");
-		posX = 0.5;
-	}
-	
-
-	if (key == 'y' ){
-	       // printf(" Increasing light y position by 0.5 \n ");
-		posY = 0.5;
-	}
-
-	if (key == 'z' ){
-	        //printf(" Increasing light z position by 0.5 \n ");
-		posZ = 0.5;
-	}
-	
-	if ( key == 'k' ){
-	        //printf(" Decreasing light x position by 0.5 \n ");
-		posX = -0.5;
-	}
-	
-
-	if (key == 'l' ){
-	        //printf(" Decreasing light y position by 0.5 \n ");
-		posY = -0.5;
-	}
-
-	if (key == 'm' ){
-	        //printf(" Decreasing light z position by 0.5 \n ");
-		posZ = -0.5;
-	}
-	
-	if (key == 'p' ){
-		/* prints the light position */
-		glGetLightfv(GL_LIGHT0 + currentLight_I, GL_POSITION, initialPosition);
-		printf(" position by glGET is %.2f, %.2f, %.2f, %.2f \n", initialPosition[0], initialPosition[1], initialPosition[2], initialPosition[3]);
-	}
-	/* Retrieves the light corresponding to the currentLightIndex */
-	currentLight_I = lucLight_Register_GetCurrentLightIndex( viewport->light_Register );
-	light = lucLight_Register_GetByIndex( viewport->light_Register, currentLight_I );
-	lucLight_Position(light, currentLight_I, posX, posY, posZ, 0);
-
-	/*float position[4];
-	glGetLightfv(GL_LIGHT0, GL_POSITION, position); */
-	
-	printf(" Position for light index %d is %.2f, %.2f, %.2f, %.2f \n", currentLight_I, light->position[0],  light->position[1],  light->position[2],  light->position[3]);
-	printf(" SpotCutOff is %.2f \n", light->spotCutOff);
-
-	/* Get spatial coordinate that the user clicked on */
-	lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
-}
-
-void _lucLightInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
-	Journal_Printf( stream,
-			"x:                            Increases the X position of the light by 0.5.\n" );
-	Journal_Printf( stream,
-			"y:                            Increases the Y position of the light by 0.5.\n" );	
-	Journal_Printf( stream,
-			"z:                            Increases the Z position of the light by 0.5.\n" );
-	Journal_Printf( stream,
-			"l:                            Decreases the X position of the light by 0.5.\n" );
-	Journal_Printf( stream,
-			"m:                            Decreases the Y position of the light by 0.5.\n" );
-	Journal_Printf( stream,
-			"n:                            Decreases the Z position of the light by 0.5.\n" );
-}
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/LightInteraction.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WindowInteractions/src/LightInteraction.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,281 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: LightInteraction.c 628 2006-10-12 08:23:07Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/Windowing/Windowing.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/DrawingObjects/DrawingObjects.h>
+
+#include "types.h"
+#include "LightInteraction.h"
+
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucLightInteraction_Type = "lucLightInteraction";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucLightInteraction* _lucLightInteraction_New(  LUCLIGHTINTERACTION_DEFARGS  ) 
+{
+	lucLightInteraction*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucLightInteraction) );
+	self = (lucLightInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucLightInteraction_Init( 
+		lucLightInteraction*                                      self  ) 
+{
+}
+
+void _lucLightInteraction_Delete( void* LightInteraction ) {
+	lucLightInteraction*  self = (lucLightInteraction*)LightInteraction;
+
+	_lucWindowInteraction_Delete( self );
+}
+
+void _lucLightInteraction_Print( void* LightInteraction, Stream* stream ) {
+	lucLightInteraction*  self = (lucLightInteraction*)LightInteraction;
+
+	_lucWindowInteraction_Print( self, stream );
+}
+
+void* _lucLightInteraction_Copy( void* LightInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucLightInteraction*  self = (lucLightInteraction*) LightInteraction;
+	lucLightInteraction* newLightInteraction;
+
+	newLightInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newLightInteraction;
+}
+
+
+void* _lucLightInteraction_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                  _sizeOfSelf = sizeof(lucLightInteraction);
+	Type                                                          type = lucLightInteraction_Type;
+	Stg_Class_DeleteFunction*                                  _delete = _lucLightInteraction_Delete;
+	Stg_Class_PrintFunction*                                    _print = _lucLightInteraction_Print;
+	Stg_Class_CopyFunction*                                      _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucLightInteraction_DefaultNew;
+	Stg_Component_ConstructFunction*                        _construct = _lucLightInteraction_AssignFromXML;
+	Stg_Component_BuildFunction*                                _build = _lucLightInteraction_Build;
+	Stg_Component_InitialiseFunction*                      _initialise = _lucLightInteraction_Initialise;
+	Stg_Component_ExecuteFunction*                            _execute = _lucLightInteraction_Execute;
+	Stg_Component_DestroyFunction*                            _destroy = _lucLightInteraction_Destroy;
+	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucLightInteraction_MouseMotion;
+	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucLightInteraction_MouseClick;
+	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucLightInteraction_MouseMessage;
+	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucLightInteraction_KeyboardEvent;
+	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucLightInteraction_KeyboardMessage;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucLightInteraction_New(  LUCLIGHTINTERACTION_PASSARGS  );
+}
+
+void _lucLightInteraction_AssignFromXML( void* LightInteraction, Stg_ComponentFactory* cf, void* data ){
+	lucLightInteraction*  self = LightInteraction;
+
+	/* Construct Parent */
+	_lucWindowInteraction_AssignFromXML(self, cf, data );
+	
+	_lucLightInteraction_Init( self );
+}
+
+void _lucLightInteraction_Build( void* renderingEngine, void* data ) {}
+void _lucLightInteraction_Initialise( void* renderingEngine, void* data ) {}
+void _lucLightInteraction_Execute( void* renderingEngine, void* data ) {}
+void _lucLightInteraction_Destroy( void* renderingEngine, void* data ) {}
+
+/* This component doesn't use any mouse interaction */
+void _lucLightInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
+void _lucLightInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
+void _lucLightInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
+
+
+void _lucLightInteraction_KeyboardEvent( void* WindowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
+	lucLightInteraction*   self;
+	lucViewportInfo*            viewportInfo;
+	lucViewport*                viewport;
+	Coord                       coord;
+	lucLight*                   light;
+	Light_Index                 light_I;
+	Light_Index                 lightCount;
+	float                       posX = 0;
+	float                       posY = 0;
+	float                       posZ = 0;
+	float                       initialPosition[4];
+	int                         i;
+	Light_Index                  currentLight_I=0;
+
+	self = (lucLightInteraction*) WindowInteraction;
+
+	/* This function works when the key pressed is one of  'x', 'y, 'z', 'l', 'm', 'n'*/
+	if ( ( key != 'x' )&&( key != 'y' ) && ( key != 'z' ) && ( key != 'k' ) && ( key != 'l' ) &&( key != 'm') &&( key != 'p')&&( key !='w') )
+		return;
+	
+	/* Find which viewport the user clicked on */
+	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
+	if ( viewportInfo == NULL )
+		return; /* If the user hasn't clicked on a viewport at all, then return */
+
+	viewport = viewportInfo->viewport;
+
+	
+	
+	/* Get the light */
+	/* Loop through lights that are registered on the window */
+	lightCount   = lucLight_Register_GetCount( viewport->light_Register );
+	
+	for ( light_I = 0 ; light_I < lightCount ; light_I++ ) {
+		light = lucLight_Register_GetByIndex( viewport->light_Register, light_I );
+		//printf(" Initial position SELF is %.2f, %.2f, %.2f, %.2f \n", light->position[0], light->position[1], light->position[2], light->position[3]);
+
+		for(i =0; i<4; i++) initialPosition[i] = 0;
+		
+	
+	       // lucLight_GetGLIndex(light->index, glIndex);
+		//glGetLightfv(GL_LIGHT0, GL_POSITION, initialPosition);
+	
+		//printf(" Initial position is %.2f, %.2f, %.2f, %.2f \n", initialPosition[0], initialPosition[1], initialPosition[2], initialPosition[3]);
+
+	}
+
+	
+	/* Implements the light position changes */
+
+	if(key == 'w'){
+		/* retrieve the currentLightIndex and increases it if suitable */
+		lucLight_Register_ChangeCurrentLightIndex(viewport->light_Register);
+		currentLight_I = lucLight_Register_GetCurrentLightIndex( viewport->light_Register );
+
+		printf("\n\n\n Selected light is index %d \n\n\n\n\n", currentLight_I);
+	}
+
+	if ( key == 'x' ){
+	       // printf(" Increasing light x position by 0.5 \n ");
+		posX = 0.5;
+	}
+	
+
+	if (key == 'y' ){
+	       // printf(" Increasing light y position by 0.5 \n ");
+		posY = 0.5;
+	}
+
+	if (key == 'z' ){
+	        //printf(" Increasing light z position by 0.5 \n ");
+		posZ = 0.5;
+	}
+	
+	if ( key == 'k' ){
+	        //printf(" Decreasing light x position by 0.5 \n ");
+		posX = -0.5;
+	}
+	
+
+	if (key == 'l' ){
+	        //printf(" Decreasing light y position by 0.5 \n ");
+		posY = -0.5;
+	}
+
+	if (key == 'm' ){
+	        //printf(" Decreasing light z position by 0.5 \n ");
+		posZ = -0.5;
+	}
+	
+	if (key == 'p' ){
+		/* prints the light position */
+		glGetLightfv(GL_LIGHT0 + currentLight_I, GL_POSITION, initialPosition);
+		printf(" position by glGET is %.2f, %.2f, %.2f, %.2f \n", initialPosition[0], initialPosition[1], initialPosition[2], initialPosition[3]);
+	}
+	/* Retrieves the light corresponding to the currentLightIndex */
+	currentLight_I = lucLight_Register_GetCurrentLightIndex( viewport->light_Register );
+	light = lucLight_Register_GetByIndex( viewport->light_Register, currentLight_I );
+	lucLight_Position(light, currentLight_I, posX, posY, posZ, 0);
+
+	/*float position[4];
+	glGetLightfv(GL_LIGHT0, GL_POSITION, position); */
+	
+	printf(" Position for light index %d is %.2f, %.2f, %.2f, %.2f \n", currentLight_I, light->position[0],  light->position[1],  light->position[2],  light->position[3]);
+	printf(" SpotCutOff is %.2f \n", light->spotCutOff);
+
+	/* Get spatial coordinate that the user clicked on */
+	lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
+}
+
+void _lucLightInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
+	Journal_Printf( stream,
+			"x:                            Increases the X position of the light by 0.5.\n" );
+	Journal_Printf( stream,
+			"y:                            Increases the Y position of the light by 0.5.\n" );	
+	Journal_Printf( stream,
+			"z:                            Increases the Z position of the light by 0.5.\n" );
+	Journal_Printf( stream,
+			"l:                            Decreases the X position of the light by 0.5.\n" );
+	Journal_Printf( stream,
+			"m:                            Decreases the Y position of the light by 0.5.\n" );
+	Journal_Printf( stream,
+			"n:                            Decreases the Z position of the light by 0.5.\n" );
+}
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/MeshViewerInteraction.c
--- a/WindowInteractions/src/MeshViewerInteraction.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,252 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: MeshViewerInteraction.c 510 2006-02-17 04:33:32Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/Windowing/Windowing.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/DrawingObjects/DrawingObjects.h>
-
-#include "types.h"
-#include "MeshViewerInteraction.h"
-
-#include <assert.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucMeshViewerInteraction_Type = "lucMeshViewerInteraction";
-
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucMeshViewerInteraction* _lucMeshViewerInteraction_New(  LUCMESHVIEWERINTERACTION_DEFARGS  ) 
-{
-	lucMeshViewerInteraction*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucMeshViewerInteraction) );
-	self = (lucMeshViewerInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucMeshViewerInteraction_Init( 
-		lucMeshViewerInteraction*                                      self  ) 
-{
-}
-
-void _lucMeshViewerInteraction_Delete( void* MeshViewerInteraction ) {
-	lucMeshViewerInteraction*  self = (lucMeshViewerInteraction*)MeshViewerInteraction;
-
-	_lucWindowInteraction_Delete( self );
-}
-
-void _lucMeshViewerInteraction_Print( void* MeshViewerInteraction, Stream* stream ) {
-	lucMeshViewerInteraction*  self = (lucMeshViewerInteraction*)MeshViewerInteraction;
-
-	_lucWindowInteraction_Print( self, stream );
-}
-
-void* _lucMeshViewerInteraction_Copy( void* MeshViewerInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucMeshViewerInteraction*  self = (lucMeshViewerInteraction*)MeshViewerInteraction;
-	lucMeshViewerInteraction* newMeshViewerInteraction;
-
-	newMeshViewerInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newMeshViewerInteraction;
-}
-
-
-void* _lucMeshViewerInteraction_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                  _sizeOfSelf = sizeof(lucMeshViewerInteraction);
-	Type                                                          type = lucMeshViewerInteraction_Type;
-	Stg_Class_DeleteFunction*                                  _delete = _lucMeshViewerInteraction_Delete;
-	Stg_Class_PrintFunction*                                    _print = _lucMeshViewerInteraction_Print;
-	Stg_Class_CopyFunction*                                      _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucMeshViewerInteraction_DefaultNew;
-	Stg_Component_ConstructFunction*                        _construct = _lucMeshViewerInteraction_AssignFromXML;
-	Stg_Component_BuildFunction*                                _build = _lucMeshViewerInteraction_Build;
-	Stg_Component_InitialiseFunction*                      _initialise = _lucMeshViewerInteraction_Initialise;
-	Stg_Component_ExecuteFunction*                            _execute = _lucMeshViewerInteraction_Execute;
-	Stg_Component_DestroyFunction*                            _destroy = _lucMeshViewerInteraction_Destroy;
-	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucMeshViewerInteraction_MouseMotion;
-	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucMeshViewerInteraction_MouseClick;
-	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucMeshViewerInteraction_MouseMessage;
-	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucMeshViewerInteraction_KeyboardEvent;
-	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucMeshViewerInteraction_KeyboardMessage;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucMeshViewerInteraction_New(  LUCMESHVIEWERINTERACTION_PASSARGS  );
-}
-
-void _lucMeshViewerInteraction_AssignFromXML( void* MeshViewerInteraction, Stg_ComponentFactory* cf, void* data ){
-	lucMeshViewerInteraction*  self = (lucMeshViewerInteraction*)MeshViewerInteraction;
-
-	/* Construct Parent */
-	_lucWindowInteraction_AssignFromXML( self, cf, data );
-	
-	_lucMeshViewerInteraction_Init( self );
-}
-
-void _lucMeshViewerInteraction_Build( void* renderingEngine, void* data ) {}
-void _lucMeshViewerInteraction_Initialise( void* renderingEngine, void* data ) {}
-void _lucMeshViewerInteraction_Execute( void* renderingEngine, void* data ) {}
-void _lucMeshViewerInteraction_Destroy( void* renderingEngine, void* data ) {}
-
-/* This component doesn't use any mouse interaction */
-void _lucMeshViewerInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
-void _lucMeshViewerInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
-void _lucMeshViewerInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
-
-
-void _lucMeshViewerInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
-	lucMeshViewerInteraction*   self;
-	lucViewportInfo*            viewportInfo;
-	lucViewport*                viewport;
-	lucDrawingObject*           object;
-	lucMeshViewer*	            meshViewer;
-	DrawingObject_Index         object_I;
-	DrawingObject_Index         objectCount;
-
-	self = (lucMeshViewerInteraction*) windowInteraction;
- 
-	/*
-	Coord		coord;
-	Stream* 	stream = Journal_MyStream( Info_Type, self );
-	unsigned nodeNumber;
-	unsigned elementNumber;
-	*/
-	
-	/* Declare a rank index */
-	/* TODO Disabled for now 
-	static Partition_Index  rank_I = 0;
-	*/
-
-	
-	/* Stuff to construct the layout */
-	/* Partition_Index		maxRank = 0; */
-
-	/* This function works when the key pressed is 'r' */
-	/* TODO Will re instore the 'p' key later */
-	/*
-	if ( ( key != 'p' ) && ( key != 'n' ) && (key != 'e') )
-	*/
-
-	/* This function works when the key pressed is 'n' or 'e'*/
-        if ( ( key != 'n' ) && (key != 'e') )
-		return;
-	
-	/* Find which viewport the user clicked on */
-	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
-	if ( viewportInfo == NULL )
-		return; /* If the user hasn't clicked on a viewport at all, then return */
-
-	viewport = viewportInfo->viewport;
-
-	
-	/* Loop through lucMeshViewer that are registered on the viewport */
-	objectCount   = lucDrawingObject_Register_GetCount( viewport->drawingObject_Register );
-	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
-		object = lucDrawingObject_Register_GetByIndex( viewport->drawingObject_Register, object_I );
-
-		/* Check if this drawing object is a scalar field */
-		if ( Stg_Class_IsInstance( object, lucMeshViewer_Type ) ) {
-			meshViewer = (lucMeshViewer*) object;
-			/*maxRank = decomp->procsInUse;*/
-
-		
-		        /* TODO  Window interaction do not work well in parallel... As the rank switching feature does not
-			make sense in serial , it is disabled for now */
-		        /*
-			if ( key == 'p' ){
-				rank_I++;
-				if(rank_I >= meshViewer->rankCnt){
-					rank_I = 0;
-				}
-				lucMeshViewer_RenderRank( object, rank_I);
-				Journal_Printf( stream, "Drawing mesh for rank number %d \n", rank_I );
-			}
-			*/
-			if ( key == 'n' ){
-			        /* Prints out the node number */
-				/* Get spatial coordinate that the user clicked on */
-/*
-				lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
-				lucMeshViewer_ClosestNode( meshViewer, coord, (int*)&nodeNumber);
-				Journal_Printf( stream, "Closest node is %d \n", nodeNumber );
-*/
-			}
-			if ( key == 'e' ){
-			        /* Prints out the element number */
-				/* Get spatial coordinate that the user clicked on */
-/*
-				lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
-				lucMeshViewer_FindElementNumber( meshViewer, coord, (int*)&elementNumber);
-				Journal_Printf( stream, "Closest element is %d \n", elementNumber );
-*/
-			}
-
-		}
-	}
-	return;
-}
-void _lucMeshViewerInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
-        /* TODO Disabled until the 'p' keys works properly */
-	/*
-	Journal_Printf( stream, "p:                            Draw the next processor.\n");
-	*/
-	Journal_Printf( stream, "n:                            Print the closest node number.\n");
-	Journal_Printf( stream, "e:                            Print the closest element number.\n");
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/MeshViewerInteraction.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WindowInteractions/src/MeshViewerInteraction.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,252 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: MeshViewerInteraction.c 510 2006-02-17 04:33:32Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/Windowing/Windowing.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/DrawingObjects/DrawingObjects.h>
+
+#include "types.h"
+#include "MeshViewerInteraction.h"
+
+#include <assert.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucMeshViewerInteraction_Type = "lucMeshViewerInteraction";
+
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucMeshViewerInteraction* _lucMeshViewerInteraction_New(  LUCMESHVIEWERINTERACTION_DEFARGS  ) 
+{
+	lucMeshViewerInteraction*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucMeshViewerInteraction) );
+	self = (lucMeshViewerInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucMeshViewerInteraction_Init( 
+		lucMeshViewerInteraction*                                      self  ) 
+{
+}
+
+void _lucMeshViewerInteraction_Delete( void* MeshViewerInteraction ) {
+	lucMeshViewerInteraction*  self = (lucMeshViewerInteraction*)MeshViewerInteraction;
+
+	_lucWindowInteraction_Delete( self );
+}
+
+void _lucMeshViewerInteraction_Print( void* MeshViewerInteraction, Stream* stream ) {
+	lucMeshViewerInteraction*  self = (lucMeshViewerInteraction*)MeshViewerInteraction;
+
+	_lucWindowInteraction_Print( self, stream );
+}
+
+void* _lucMeshViewerInteraction_Copy( void* MeshViewerInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucMeshViewerInteraction*  self = (lucMeshViewerInteraction*)MeshViewerInteraction;
+	lucMeshViewerInteraction* newMeshViewerInteraction;
+
+	newMeshViewerInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newMeshViewerInteraction;
+}
+
+
+void* _lucMeshViewerInteraction_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                  _sizeOfSelf = sizeof(lucMeshViewerInteraction);
+	Type                                                          type = lucMeshViewerInteraction_Type;
+	Stg_Class_DeleteFunction*                                  _delete = _lucMeshViewerInteraction_Delete;
+	Stg_Class_PrintFunction*                                    _print = _lucMeshViewerInteraction_Print;
+	Stg_Class_CopyFunction*                                      _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucMeshViewerInteraction_DefaultNew;
+	Stg_Component_ConstructFunction*                        _construct = _lucMeshViewerInteraction_AssignFromXML;
+	Stg_Component_BuildFunction*                                _build = _lucMeshViewerInteraction_Build;
+	Stg_Component_InitialiseFunction*                      _initialise = _lucMeshViewerInteraction_Initialise;
+	Stg_Component_ExecuteFunction*                            _execute = _lucMeshViewerInteraction_Execute;
+	Stg_Component_DestroyFunction*                            _destroy = _lucMeshViewerInteraction_Destroy;
+	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucMeshViewerInteraction_MouseMotion;
+	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucMeshViewerInteraction_MouseClick;
+	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucMeshViewerInteraction_MouseMessage;
+	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucMeshViewerInteraction_KeyboardEvent;
+	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucMeshViewerInteraction_KeyboardMessage;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucMeshViewerInteraction_New(  LUCMESHVIEWERINTERACTION_PASSARGS  );
+}
+
+void _lucMeshViewerInteraction_AssignFromXML( void* MeshViewerInteraction, Stg_ComponentFactory* cf, void* data ){
+	lucMeshViewerInteraction*  self = (lucMeshViewerInteraction*)MeshViewerInteraction;
+
+	/* Construct Parent */
+	_lucWindowInteraction_AssignFromXML( self, cf, data );
+	
+	_lucMeshViewerInteraction_Init( self );
+}
+
+void _lucMeshViewerInteraction_Build( void* renderingEngine, void* data ) {}
+void _lucMeshViewerInteraction_Initialise( void* renderingEngine, void* data ) {}
+void _lucMeshViewerInteraction_Execute( void* renderingEngine, void* data ) {}
+void _lucMeshViewerInteraction_Destroy( void* renderingEngine, void* data ) {}
+
+/* This component doesn't use any mouse interaction */
+void _lucMeshViewerInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
+void _lucMeshViewerInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
+void _lucMeshViewerInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
+
+
+void _lucMeshViewerInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
+	lucMeshViewerInteraction*   self;
+	lucViewportInfo*            viewportInfo;
+	lucViewport*                viewport;
+	lucDrawingObject*           object;
+	lucMeshViewer*	            meshViewer;
+	DrawingObject_Index         object_I;
+	DrawingObject_Index         objectCount;
+
+	self = (lucMeshViewerInteraction*) windowInteraction;
+ 
+	/*
+	Coord		coord;
+	Stream* 	stream = Journal_MyStream( Info_Type, self );
+	unsigned nodeNumber;
+	unsigned elementNumber;
+	*/
+	
+	/* Declare a rank index */
+	/* TODO Disabled for now 
+	static Partition_Index  rank_I = 0;
+	*/
+
+	
+	/* Stuff to construct the layout */
+	/* Partition_Index		maxRank = 0; */
+
+	/* This function works when the key pressed is 'r' */
+	/* TODO Will re instore the 'p' key later */
+	/*
+	if ( ( key != 'p' ) && ( key != 'n' ) && (key != 'e') )
+	*/
+
+	/* This function works when the key pressed is 'n' or 'e'*/
+        if ( ( key != 'n' ) && (key != 'e') )
+		return;
+	
+	/* Find which viewport the user clicked on */
+	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
+	if ( viewportInfo == NULL )
+		return; /* If the user hasn't clicked on a viewport at all, then return */
+
+	viewport = viewportInfo->viewport;
+
+	
+	/* Loop through lucMeshViewer that are registered on the viewport */
+	objectCount   = lucDrawingObject_Register_GetCount( viewport->drawingObject_Register );
+	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
+		object = lucDrawingObject_Register_GetByIndex( viewport->drawingObject_Register, object_I );
+
+		/* Check if this drawing object is a scalar field */
+		if ( Stg_Class_IsInstance( object, lucMeshViewer_Type ) ) {
+			meshViewer = (lucMeshViewer*) object;
+			/*maxRank = decomp->procsInUse;*/
+
+		
+		        /* TODO  Window interaction do not work well in parallel... As the rank switching feature does not
+			make sense in serial , it is disabled for now */
+		        /*
+			if ( key == 'p' ){
+				rank_I++;
+				if(rank_I >= meshViewer->rankCnt){
+					rank_I = 0;
+				}
+				lucMeshViewer_RenderRank( object, rank_I);
+				Journal_Printf( stream, "Drawing mesh for rank number %d \n", rank_I );
+			}
+			*/
+			if ( key == 'n' ){
+			        /* Prints out the node number */
+				/* Get spatial coordinate that the user clicked on */
+/*
+				lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
+				lucMeshViewer_ClosestNode( meshViewer, coord, (int*)&nodeNumber);
+				Journal_Printf( stream, "Closest node is %d \n", nodeNumber );
+*/
+			}
+			if ( key == 'e' ){
+			        /* Prints out the element number */
+				/* Get spatial coordinate that the user clicked on */
+/*
+				lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
+				lucMeshViewer_FindElementNumber( meshViewer, coord, (int*)&elementNumber);
+				Journal_Printf( stream, "Closest element is %d \n", elementNumber );
+*/
+			}
+
+		}
+	}
+	return;
+}
+void _lucMeshViewerInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
+        /* TODO Disabled until the 'p' keys works properly */
+	/*
+	Journal_Printf( stream, "p:                            Draw the next processor.\n");
+	*/
+	Journal_Printf( stream, "n:                            Print the closest node number.\n");
+	Journal_Printf( stream, "e:                            Print the closest element number.\n");
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/SwarmViewerInteraction.c
--- a/WindowInteractions/src/SwarmViewerInteraction.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: SwarmViewerInteraction.c 510 2006-02-17 04:33:32Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-#include <glucifer/Windowing/Windowing.h>
-#include <glucifer/RenderingEngines/RenderingEngines.h>
-#include <glucifer/DrawingObjects/DrawingObjects.h>
-
-#include "types.h"
-#include "SwarmViewerInteraction.h"
-
-#include <assert.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucSwarmViewerInteraction_Type = "lucSwarmViewerInteraction";
-
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucSwarmViewerInteraction* _lucSwarmViewerInteraction_New(  LUCSWARMVIEWERINTERACTION_DEFARGS  ) 
-{
-	lucSwarmViewerInteraction*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucSwarmViewerInteraction) );
-	self = (lucSwarmViewerInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
-	
-	return self;
-}
-
-void _lucSwarmViewerInteraction_Init( 
-		lucSwarmViewerInteraction*                                      self  ) 
-{
-}
-
-void _lucSwarmViewerInteraction_Delete( void* SwarmViewerInteraction ) {
-	lucSwarmViewerInteraction*  self = (lucSwarmViewerInteraction*)SwarmViewerInteraction;
-
-	_lucWindowInteraction_Delete( self );
-}
-
-void _lucSwarmViewerInteraction_Print( void* SwarmViewerInteraction, Stream* stream ) {
-	lucSwarmViewerInteraction*  self = (lucSwarmViewerInteraction*)SwarmViewerInteraction;
-
-	_lucWindowInteraction_Print( self, stream );
-}
-
-void* _lucSwarmViewerInteraction_Copy( void* SwarmViewerInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucSwarmViewerInteraction*  self = (lucSwarmViewerInteraction*)SwarmViewerInteraction;
-	lucSwarmViewerInteraction* newSwarmViewerInteraction;
-
-	newSwarmViewerInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newSwarmViewerInteraction;
-}
-
-
-void* _lucSwarmViewerInteraction_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                                  _sizeOfSelf = sizeof(lucSwarmViewerInteraction);
-	Type                                                          type = lucSwarmViewerInteraction_Type;
-	Stg_Class_DeleteFunction*                                  _delete = _lucSwarmViewerInteraction_Delete;
-	Stg_Class_PrintFunction*                                    _print = _lucSwarmViewerInteraction_Print;
-	Stg_Class_CopyFunction*                                      _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucSwarmViewerInteraction_DefaultNew;
-	Stg_Component_ConstructFunction*                        _construct = _lucSwarmViewerInteraction_AssignFromXML;
-	Stg_Component_BuildFunction*                                _build = _lucSwarmViewerInteraction_Build;
-	Stg_Component_InitialiseFunction*                      _initialise = _lucSwarmViewerInteraction_Initialise;
-	Stg_Component_ExecuteFunction*                            _execute = _lucSwarmViewerInteraction_Execute;
-	Stg_Component_DestroyFunction*                            _destroy = _lucSwarmViewerInteraction_Destroy;
-	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucSwarmViewerInteraction_MouseMotion;
-	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucSwarmViewerInteraction_MouseClick;
-	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucSwarmViewerInteraction_MouseMessage;
-	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucSwarmViewerInteraction_KeyboardEvent;
-	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucSwarmViewerInteraction_KeyboardMessage;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucSwarmViewerInteraction_New(  LUCSWARMVIEWERINTERACTION_PASSARGS  );
-}
-
-void _lucSwarmViewerInteraction_AssignFromXML( void* SwarmViewerInteraction, Stg_ComponentFactory* cf, void* data ){
-	lucSwarmViewerInteraction*  self = (lucSwarmViewerInteraction*)SwarmViewerInteraction;
-
-	/* Construct Parent */
-	_lucWindowInteraction_AssignFromXML( self, cf, data );
-	
-	_lucSwarmViewerInteraction_Init( self );
-}
-
-void _lucSwarmViewerInteraction_Build( void* renderingEngine, void* data ) {}
-void _lucSwarmViewerInteraction_Initialise( void* renderingEngine, void* data ) {}
-void _lucSwarmViewerInteraction_Execute( void* renderingEngine, void* data ) {}
-void _lucSwarmViewerInteraction_Destroy( void* renderingEngine, void* data ) {}
-
-/* This component doesn't use any mouse interaction */
-void _lucSwarmViewerInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
-void _lucSwarmViewerInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
-void _lucSwarmViewerInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
-void _lucSwarmViewerInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
-	lucSwarmViewerInteraction*   self = (lucSwarmViewerInteraction*) windowInteraction;
-	lucViewportInfo*            viewportInfo;
-	lucViewport*                viewport;
-	Coord                       coord;
-	lucDrawingObject*           object;
-	lucSwarmViewer*	            swarmViewer;
-	Stream*                     stream = Journal_MyStream( Info_Type, self );
-	DrawingObject_Index         object_I;
-	DrawingObject_Index         objectCount;
-
-//	unsigned nodeNumber;
-//	unsigned elementNumber;
-	
-	/* Declare a rank index */
-	/* TODO Disabled for now 
-	static Partition_Index  rank_I = 0;
-	*/
-
-	
-	/* Stuff to construct the layout */
-	/*MeshDecomp*		decomp;
-	MeshLayout*		meshLayout;
-	Partition_Index		maxRank = 0;*/
-	
-	Particle_Index lParticle_I;
-
-	/* This function works when the key pressed is 'n' or 'e'*/
-        if ( ( key != 'b' ) )
-		return;
-	
-	/* Find which viewport the user clicked on */
-	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
-	if ( viewportInfo == NULL )
-		return; /* If the user hasn't clicked on a viewport at all, then return */
-
-	viewport = viewportInfo->viewport;
-
-	
-	/* Loop through lucSwarmViewer that are registered on the viewport */
-	objectCount   = lucDrawingObject_Register_GetCount( viewport->drawingObject_Register );
-	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
-		object = lucDrawingObject_Register_GetByIndex( viewport->drawingObject_Register, object_I );
-
-		/* Check if this drawing object is a scalar field */
-		if ( Stg_Class_IsInstance( object, lucSwarmViewer_Type ) ) {
-			swarmViewer = (lucSwarmViewer*) object;
-			/*meshLayout =  swarmViewer->mesh->layout;
-			decomp = meshLayout->decomp;
-			maxRank = decomp->procsInUse;	*/
-
-		
-		        /* TODO  Window interaction do not work well in parallel... As the rank switching feature does not
-			make sense in serial , it is disabled for now 
-		        */
-			if ( key == 'b' ){
-			        /* Prints out the particle number */
-				/* Get spatial coordinate that the user clicked on */
-				lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
-				lucSwarmViewerBase_FindParticleLocalIndex(swarmViewer, coord, &lParticle_I);
-			//	lucSwarmViewer_ClosestNode( swarmViewer, coord, &nodeNumber);
-				Journal_Printf( stream, "Particle number is %d \n", lParticle_I );
-			}
-		}
-	}
-	return;
-}
-void _lucSwarmViewerInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
-	Journal_Printf( stream, "b:                            Print the particle number .\n");
-}
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef WindowInteractions/src/SwarmViewerInteraction.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WindowInteractions/src/SwarmViewerInteraction.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,223 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: SwarmViewerInteraction.c 510 2006-02-17 04:33:32Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+#include <glucifer/Windowing/Windowing.h>
+#include <glucifer/RenderingEngines/RenderingEngines.h>
+#include <glucifer/DrawingObjects/DrawingObjects.h>
+
+#include "types.h"
+#include "SwarmViewerInteraction.h"
+
+#include <assert.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucSwarmViewerInteraction_Type = "lucSwarmViewerInteraction";
+
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucSwarmViewerInteraction* _lucSwarmViewerInteraction_New(  LUCSWARMVIEWERINTERACTION_DEFARGS  ) 
+{
+	lucSwarmViewerInteraction*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucSwarmViewerInteraction) );
+	self = (lucSwarmViewerInteraction*) _lucWindowInteraction_New(  LUCWINDOWINTERACTION_PASSARGS  );
+	
+	return self;
+}
+
+void _lucSwarmViewerInteraction_Init( 
+		lucSwarmViewerInteraction*                                      self  ) 
+{
+}
+
+void _lucSwarmViewerInteraction_Delete( void* SwarmViewerInteraction ) {
+	lucSwarmViewerInteraction*  self = (lucSwarmViewerInteraction*)SwarmViewerInteraction;
+
+	_lucWindowInteraction_Delete( self );
+}
+
+void _lucSwarmViewerInteraction_Print( void* SwarmViewerInteraction, Stream* stream ) {
+	lucSwarmViewerInteraction*  self = (lucSwarmViewerInteraction*)SwarmViewerInteraction;
+
+	_lucWindowInteraction_Print( self, stream );
+}
+
+void* _lucSwarmViewerInteraction_Copy( void* SwarmViewerInteraction, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucSwarmViewerInteraction*  self = (lucSwarmViewerInteraction*)SwarmViewerInteraction;
+	lucSwarmViewerInteraction* newSwarmViewerInteraction;
+
+	newSwarmViewerInteraction = _lucWindowInteraction_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newSwarmViewerInteraction;
+}
+
+
+void* _lucSwarmViewerInteraction_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                                  _sizeOfSelf = sizeof(lucSwarmViewerInteraction);
+	Type                                                          type = lucSwarmViewerInteraction_Type;
+	Stg_Class_DeleteFunction*                                  _delete = _lucSwarmViewerInteraction_Delete;
+	Stg_Class_PrintFunction*                                    _print = _lucSwarmViewerInteraction_Print;
+	Stg_Class_CopyFunction*                                      _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*      _defaultConstructor = _lucSwarmViewerInteraction_DefaultNew;
+	Stg_Component_ConstructFunction*                        _construct = _lucSwarmViewerInteraction_AssignFromXML;
+	Stg_Component_BuildFunction*                                _build = _lucSwarmViewerInteraction_Build;
+	Stg_Component_InitialiseFunction*                      _initialise = _lucSwarmViewerInteraction_Initialise;
+	Stg_Component_ExecuteFunction*                            _execute = _lucSwarmViewerInteraction_Execute;
+	Stg_Component_DestroyFunction*                            _destroy = _lucSwarmViewerInteraction_Destroy;
+	lucWindowInteraction_MouseMotionFunction*             _mouseMotion = _lucSwarmViewerInteraction_MouseMotion;
+	lucWindowInteraction_MouseClickFunction*               _mouseClick = _lucSwarmViewerInteraction_MouseClick;
+	lucWindowInteraction_MouseMessageFunction*           _mouseMessage = _lucSwarmViewerInteraction_MouseMessage;
+	lucWindowInteraction_KeyboardEventFunction*         _keyboardEvent = _lucSwarmViewerInteraction_KeyboardEvent;
+	lucWindowInteraction_KeyboardMessageFunction*     _keyboardMessage = _lucSwarmViewerInteraction_KeyboardMessage;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucSwarmViewerInteraction_New(  LUCSWARMVIEWERINTERACTION_PASSARGS  );
+}
+
+void _lucSwarmViewerInteraction_AssignFromXML( void* SwarmViewerInteraction, Stg_ComponentFactory* cf, void* data ){
+	lucSwarmViewerInteraction*  self = (lucSwarmViewerInteraction*)SwarmViewerInteraction;
+
+	/* Construct Parent */
+	_lucWindowInteraction_AssignFromXML( self, cf, data );
+	
+	_lucSwarmViewerInteraction_Init( self );
+}
+
+void _lucSwarmViewerInteraction_Build( void* renderingEngine, void* data ) {}
+void _lucSwarmViewerInteraction_Initialise( void* renderingEngine, void* data ) {}
+void _lucSwarmViewerInteraction_Execute( void* renderingEngine, void* data ) {}
+void _lucSwarmViewerInteraction_Destroy( void* renderingEngine, void* data ) {}
+
+/* This component doesn't use any mouse interaction */
+void _lucSwarmViewerInteraction_MouseMotion( void* windowInteraction, lucWindow* window, lucMouseButton button, Pixel_Index xpos, Pixel_Index ypos, Pixel_Index startx, Pixel_Index starty) {}
+void _lucSwarmViewerInteraction_MouseClick( void* windowInteraction, lucWindow* window, lucMouseButton button, lucMouseState state, Pixel_Index xpos, Pixel_Index ypos) { } 
+void _lucSwarmViewerInteraction_MouseMessage( void* windowInteraction, Stream* stream ) { }
+void _lucSwarmViewerInteraction_KeyboardEvent( void* windowInteraction, lucWindow* window, char key, Pixel_Index xpos, Pixel_Index ypos) {
+	lucSwarmViewerInteraction*   self = (lucSwarmViewerInteraction*) windowInteraction;
+	lucViewportInfo*            viewportInfo;
+	lucViewport*                viewport;
+	Coord                       coord;
+	lucDrawingObject*           object;
+	lucSwarmViewer*	            swarmViewer;
+	Stream*                     stream = Journal_MyStream( Info_Type, self );
+	DrawingObject_Index         object_I;
+	DrawingObject_Index         objectCount;
+
+//	unsigned nodeNumber;
+//	unsigned elementNumber;
+	
+	/* Declare a rank index */
+	/* TODO Disabled for now 
+	static Partition_Index  rank_I = 0;
+	*/
+
+	
+	/* Stuff to construct the layout */
+	/*MeshDecomp*		decomp;
+	MeshLayout*		meshLayout;
+	Partition_Index		maxRank = 0;*/
+	
+	Particle_Index lParticle_I;
+
+	/* This function works when the key pressed is 'n' or 'e'*/
+        if ( ( key != 'b' ) )
+		return;
+	
+	/* Find which viewport the user clicked on */
+	viewportInfo = lucWindow_GetViewportInfoByPixel( window, xpos, ypos );
+	if ( viewportInfo == NULL )
+		return; /* If the user hasn't clicked on a viewport at all, then return */
+
+	viewport = viewportInfo->viewport;
+
+	
+	/* Loop through lucSwarmViewer that are registered on the viewport */
+	objectCount   = lucDrawingObject_Register_GetCount( viewport->drawingObject_Register );
+	for ( object_I = 0 ; object_I < objectCount ; object_I++ ) {
+		object = lucDrawingObject_Register_GetByIndex( viewport->drawingObject_Register, object_I );
+
+		/* Check if this drawing object is a scalar field */
+		if ( Stg_Class_IsInstance( object, lucSwarmViewer_Type ) ) {
+			swarmViewer = (lucSwarmViewer*) object;
+			/*meshLayout =  swarmViewer->mesh->layout;
+			decomp = meshLayout->decomp;
+			maxRank = decomp->procsInUse;	*/
+
+		
+		        /* TODO  Window interaction do not work well in parallel... As the rank switching feature does not
+			make sense in serial , it is disabled for now 
+		        */
+			if ( key == 'b' ){
+			        /* Prints out the particle number */
+				/* Get spatial coordinate that the user clicked on */
+				lucViewportInfo_GetCoordFromPixel( viewportInfo, xpos, ypos, coord );
+				lucSwarmViewerBase_FindParticleLocalIndex(swarmViewer, coord, &lParticle_I);
+			//	lucSwarmViewer_ClosestNode( swarmViewer, coord, &nodeNumber);
+				Journal_Printf( stream, "Particle number is %d \n", lParticle_I );
+			}
+		}
+	}
+	return;
+}
+void _lucSwarmViewerInteraction_KeyboardMessage( void* windowInteraction, Stream* stream ) {
+	Journal_Printf( stream, "b:                            Print the particle number .\n");
+}
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/CarbonWindow.c
--- a/Windowing/src/CarbonWindow.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,500 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-#ifdef HAVE_CARBON
-
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <AGL/agl.h>
-#include <OpenGL/OpenGL.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "CarbonWindow.h"
-
-#include <assert.h>
-
-static pascal OSStatus lucCarbonWindow_EventHandler(EventHandlerCallRef nextHandler, EventRef event, void *data) ;
-Bool lucCarbonWindow_IsPointOutsideWindow( lucCarbonWindow* self, Point* point ) ;
-void lucCarbonWindow_GetPixelIndicies( lucCarbonWindow* self, Point* point, Pixel_Index *xPos, Pixel_Index *yPos ) ;
-
-/* this is a secret undocumented Mac function that allows code that isn't part of a bundle to be a foreground operation 
- * we need to give the prototype here because the function isn't in the header files. */
-void CPSEnableForegroundOperation( void* psn ); 
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucCarbonWindow_Type = "lucCarbonWindow";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucCarbonWindow* _lucCarbonWindow_New(  LUCCARBONWINDOW_DEFARGS  ) 
-{
-	lucCarbonWindow*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucCarbonWindow) );
-	self = (lucCarbonWindow*) _lucWindow_New(  LUCWINDOW_PASSARGS  );
-	
-	return self;
-}
-
-void _lucCarbonWindow_Init( 
-		lucCarbonWindow*                                   self,
-		Pixel_Index                                        offsetX,
-		Pixel_Index                                        offsetY,
-		double                                             maxIdleTime ) 
-{
-	self->offsetX = offsetX;
-	self->offsetY = offsetY;
-}
-
-void _lucCarbonWindow_Delete( void* window ) {
-	_lucWindow_Delete( window );
-}
-
-void _lucCarbonWindow_Print( void* window, Stream* stream ) {
-	lucCarbonWindow*  self = (lucCarbonWindow*)window;
-
-	_lucWindow_Print( self, stream );
-}
-
-void* _lucCarbonWindow_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucCarbonWindow*  self = (lucCarbonWindow*)window;
-	lucCarbonWindow* newWindow;
-
-	newWindow = _lucWindow_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newWindow;
-}
-
-
-void* _lucCarbonWindow_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucCarbonWindow);
-	Type                                                      type = lucCarbonWindow_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucCarbonWindow_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucCarbonWindow_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucCarbonWindow_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucCarbonWindow_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucCarbonWindow_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucCarbonWindow_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucCarbonWindow_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucCarbonWindow_Destroy;
-	lucWindow_DisplayFunction*                      _displayWindow = _lucCarbonWindow_Display;
-	lucWindow_EventsWaitingFunction*                _eventsWaiting = _lucCarbonWindow_EventsWaiting;
-	lucWindow_EventProcessorFunction*              _eventProcessor = _lucCarbonWindow_EventProcessor;
-	lucWindow_ResizeFunction*                        _resizeWindow = _lucCarbonWindow_Resize;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucCarbonWindow_New(  LUCCARBONWINDOW_PASSARGS  );
-}
-
-void _lucCarbonWindow_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ){
-	lucCarbonWindow*  self = (lucCarbonWindow*)window;
-
-	/* Construct Parent */
-	_lucWindow_AssignFromXML( self, cf , data);
-	
-	_lucCarbonWindow_Init( 
-			self,
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"offsetX", 50  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"offsetY", 50  ),
-			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxIdleTime", 600.0 )  );
-}
-
-void _lucCarbonWindow_Build( void* window, void* data ) {
-	/* Run the parent function to build window... */
-	_lucWindow_Build(window, data);	
-}
-
-void _lucCarbonWindow_Initialise( void* window, void* data ) {
-	/* OK: Moved from ExecuteInteractive/Offscreen */
-	lucCarbonWindow*     self      = (lucCarbonWindow*)window;
-		
-	/* Create the window...  */
-	lucCarbonWindow_CreateWindow( self );
-
-	/* Run the parent function to init window... */
-	_lucWindow_Initialise(window, data);	
-	
-	/* Run the parent function to display window... */
-	lucWindow_Display(window);	
-}
-
-
-void _lucCarbonWindow_Execute( void* window, void* data ) {
-	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
-	
-	/* Set the current window's context as active */
-	aglSetCurrentContext (self->graphicsContext);
-	aglUpdateContext (self->graphicsContext);
-	
-	/* Post a dummy event, hack to ensure waiting events are processed in continuous mode */
-	if (_lucCarbonWindow_EventsWaiting(window) == 0)
-	{
-		EventRef dummyEvent;
-		OSStatus        err;
-		err = CreateEvent(NULL, kEventClassWindow, kEventWindowDrawContent, GetCurrentEventTime(), kEventAttributeNone, &dummyEvent);
-		if (err == noErr) err = PostEventToQueue(GetMainEventQueue(), dummyEvent, kEventPriorityHigh);
-	}
-	
-	/* Run the parent function to execute window... */
-	_lucWindow_Execute(window, data);	
-}
-
-void _lucCarbonWindow_Destroy( void* window, void* data ) {
-	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
-
-	/* Run the parent function to destroy window... */
-	_lucWindow_Destroy(window, data);	
-	
-	/* Destroy the window...  */
-	lucCarbonWindow_DestroyWindow( self );
-}
-
-/* Window Virtuals */
-void _lucCarbonWindow_Display( void* window ) {
-	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
-	
-	/* Run the parent function to display window... */
-	lucWindow_Display(window);	
-
-	/* Swap buffers */
-	aglSwapBuffers(self->graphicsContext);
-}
-
-int _lucCarbonWindow_EventsWaiting( void* window ) {
-	EventQueueRef evq = GetMainEventQueue();
-	return GetNumEventsInQueue(evq);
-}
-
-Bool _lucCarbonWindow_EventProcessor( void* window ) {
-
-	RunApplicationEventLoop();
-	/* Returns true when redisplay required */
-	return True;
-}
-
-void _lucCarbonWindow_Resize( void* window ) {
-	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
-
-    if (self->interactive) 
-	{
-		if (self->isMaster)
-		{
-			/* Reset context after resize */
-			aglSetCurrentContext (self->graphicsContext);
-			aglUpdateContext (self->graphicsContext);
-		}
-		else
-		{
-			/* Master window resized? Create new background window of required size */
-			lucCarbonWindow_DestroyBackgroundWindow( self );
-			lucCarbonWindow_CreateBackgroundWindow( self );
-		}
-	}
-	
-	/* Run the parent function to resize window... */
-	lucWindow_Resize(window);	
-}
-
-void lucCarbonWindow_CreateWindow( void* window ) {
-	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
-	AGLPixelFormat          format;		/* OpenGL pixel format */
-	int                     winattrs;	/* Window attributes */
-	Rect                    rect;		/* Rectangle definition */
-	ProcessSerialNumber     psn;		/* Process serial number */
-	static EventTypeSpec    events[] =	/* Events we are interested in... */
-			{
-			  { kEventClassMouse, kEventMouseDown },
-			  { kEventClassMouse, kEventMouseUp },
-			  { kEventClassMouse, kEventMouseDragged },
-			  { kEventClassMouse, kEventMouseWheelMoved },
-			  { kEventClassKeyboard, kEventRawKeyDown },
-			  { kEventClassWindow, kEventWindowDrawContent },
-			  { kEventClassWindow, kEventWindowClose },
-			  { kEventClassWindow, kEventWindowBoundsChanged },
-			  { kEventClassWindow, kEventWindowResizeCompleted},
-			};
-	static GLint 		attributes[] =	/* OpenGL attributes */
-			{
-			  AGL_RGBA,
-			  AGL_GREEN_SIZE, 1,
-			  AGL_DOUBLEBUFFER,
-			  AGL_DEPTH_SIZE, 16,
-              AGL_STENCIL_SIZE, 1,
-			  AGL_NONE
-			};
-
-	lucDebug_PrintFunctionBegin( self, 1 );
-
-	/* Create the window...  */
-	if ( self->isMaster && self->interactive )
-	{	
-		SetRect(&rect, (int)self->offsetX, (int) self->offsetY, (int) (self->width + self->offsetX), (int) (self->height + self->offsetY) );
-		
-		winattrs = kWindowStandardHandlerAttribute | kWindowCloseBoxAttribute |
-		kWindowCollapseBoxAttribute | kWindowFullZoomAttribute |
-		kWindowResizableAttribute | kWindowLiveResizeAttribute;
-		winattrs &= GetAvailableWindowAttributes(kDocumentWindowClass);
-		
-		CreateNewWindow(kDocumentWindowClass, winattrs, &rect, &self->window);
-		SetWTitle(self->window, (unsigned char*)self->title);
-		//	SetWindowTitleWithCFString(self->window, CFSTR(self->title));
-		
-		self->handler = NewEventHandlerUPP(lucCarbonWindow_EventHandler);
-		InstallWindowEventHandler(self->window, self->handler, sizeof(events) / sizeof(events[0]), events, self, 0L);
-		
-		self->timerHandler = NewEventLoopIdleTimerUPP(lucCarbonWindow_IdleTimer);
-		InstallEventLoopIdleTimer(GetMainEventLoop(), kEventDurationSecond * 2, kEventDurationSecond * 1, self->timerHandler, self, &self->timer);
-		
-		GetCurrentProcess(&psn);
-		/* this is a secret undocumented Mac function that allows code that isn't part of a bundle to be a foreground operation */
-		CPSEnableForegroundOperation( &psn ); 
-		SetFrontProcess( &psn );
-		
-		/* Show Window */
-		ShowWindow(self->window);
-		SelectWindow(self->window);
-	}
-	
-	/* Create the OpenGL context and bind it to the window or pixelbuffer.  */
-	format = aglChoosePixelFormat(NULL, 0, attributes);
-	self->graphicsContext = NULL;
-	self->graphicsContext = aglCreateContext(format, NULL);
-	assert( self->graphicsContext );
-	aglDestroyPixelFormat(format);
-
-	if ( self->isMaster && self->interactive )
-	{
-		aglSetDrawable(self->graphicsContext, GetWindowPort(self->window));
-	}
-	else
-	{
-		aglCreatePBuffer(self->width, self->height, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, 0, &self->PixelBuffer);
-		aglSetPBuffer(self->graphicsContext, self->PixelBuffer, 0, 0, 0);
-	}
-	
-	aglSetCurrentContext(self->graphicsContext);
-}
-
-
-void lucCarbonWindow_DestroyWindow( void* window ) {
-	lucCarbonWindow*        self      = (lucCarbonWindow*) window; 
-
-	if ( self->window )
-	{
-		DisposeEventHandlerUPP( self->handler ); 
-		if (self->timer != NULL) RemoveEventLoopTimer( self->timer );
-		DisposeEventLoopIdleTimerUPP( self->timerHandler ); 
-		DisposeWindow( self->window );
-	}
-	else
-		aglDestroyPBuffer(self->PixelBuffer);
-	
-	aglSetDrawable( self->graphicsContext, 0 );
-	aglSetCurrentContext( 0 );
-	aglDestroyContext( self->graphicsContext );
-	self->graphicsContext = NULL;
-}
-
-static pascal OSStatus lucCarbonWindow_EventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData) {
-	lucCarbonWindow*        self = (lucCarbonWindow*) userData;
-	UInt32                  kind;			/* Kind of event */
-	Rect                    rect;			/* New window size */
-	EventMouseButton        button;			/* Mouse button */
-	static Point            point;			/* Mouse position */
-	static lucMouseButton   whichButton = 0;
-	static lucMouseState    mouseState  = 0;
-	static Pixel_Index      width, height;
-	EventClass              eventClass;
-	Pixel_Index             xPos, yPos;
-	SInt32					delta;
-
-	assert( self );
-	
-	kind = GetEventKind(event);
-	eventClass = GetEventClass( event );
-
-	if (eventClass == kEventClassWindow) {
-		switch (kind) {
-			case kEventWindowDrawContent:
-				break; 
-			case kEventWindowResizeCompleted:
-				lucWindow_SetSize( self, width, height );
-				break;
-			case kEventWindowBoundsChanged:
-			{
-				GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &rect); 
-				width =  (Pixel_Index) (rect.right - rect.left);
-				height = (Pixel_Index) (rect.bottom - rect.top);
-				self->offsetX = (Pixel_Index) rect.left;
-				self->offsetY = (Pixel_Index) rect.top; 
-				break; 
-			}
-			case kEventWindowClose: 
-				lucWindow_ToggleApplicationQuit(self);
-				self->quitEventLoop = true;
-			    break; 
-		} 
-	} 
-	else if ( eventClass == kEventClassKeyboard ) {
-		if ( kind == kEventRawKeyDown ) {
-			char key;
-			GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key); 
-			lucCarbonWindow_GetPixelIndicies( self, &point, &xPos, &yPos );
-
-			lucWindow_KeyboardEvent( self, key, xPos, yPos );
-
-			if ( !self->interactive )
-			{
-				/* Hide Window */
-				HideWindow(self->window);
-				self->quitEventLoop = true;
-			}
-		}
-	}
-	else if ( eventClass == kEventClassMouse ) { 
-		switch (kind) { 
-			case kEventMouseDown:  case kEventMouseUp:
-				GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button); 
-				GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); 
-				
-				/* Make sure that mouse click was within window */
-				if ( lucCarbonWindow_IsPointOutsideWindow( self, &point )) 
-					return (CallNextEventHandler(nextHandler, event)); 
-					
-				lucCarbonWindow_GetPixelIndicies( self, &point, &xPos, &yPos );
-
-				whichButton = ( button == kEventMouseButtonTertiary ? lucMiddleButton :
-						button == kEventMouseButtonSecondary ? lucRightButton : lucLeftButton );
-
-				mouseState = (kind == kEventMouseDown ? lucButtonPress : lucButtonRelease );
-
-				lucWindow_MouseClick( self, whichButton, mouseState, xPos, yPos);
-				break; 
-			case kEventMouseDragged : 
-				GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); 
-				
-				/* Make sure that mouse click was within window */
-				if ( lucCarbonWindow_IsPointOutsideWindow( self, &point )) 
-					return (CallNextEventHandler(nextHandler, event)); 
-				
-				lucCarbonWindow_GetPixelIndicies( self, &point, &xPos, &yPos );
-				lucWindow_MouseMotion(self, whichButton, xPos, yPos); 
-				break; 
-			case kEventMouseWheelMoved:
-				GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); 
-				GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta );
-				
-				/* Make sure that mouse click was within window */
-				if ( lucCarbonWindow_IsPointOutsideWindow( self, &point )) 
-					return (CallNextEventHandler(nextHandler, event)); 
-
-				lucCarbonWindow_GetPixelIndicies( self, &point, &xPos, &yPos );
-
-				whichButton = ( delta > 0 ? lucWheelUp : lucWheelDown );
-
-				lucWindow_MouseClick( self, whichButton, lucButtonPress, xPos, yPos);
-				break;
-			default : 
-				return (CallNextEventHandler(nextHandler, event)); 
-		} 
-	} 
-	else {
-		Journal_Firewall( False, Journal_MyStream( Error_Type, self ), 
-				"In func '%s' - Cannot understand event class type '%d'\n", __func__, eventClass );
-	}
-
-	/* Break out of event processing if no more events */
-	if (self->quitEventLoop || _lucCarbonWindow_EventsWaiting(self) == 0)
-		QuitApplicationEventLoop();
-
-	return  noErr;
-}
-
-pascal void lucCarbonWindow_IdleTimer(EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void * inUserData) {
-		
-	lucCarbonWindow*        self = (lucCarbonWindow*) inUserData;
-
-	/* idle timeout check */
-	if (inState == kEventLoopIdleTimerIdling)
-	{
-		if (self->interactive)
-			lucWindow_IdleCheck(inUserData);
-		else
-		{
-			RemoveEventLoopTimer( self->timer );
-			self->timer = NULL;
-		}
-
-		/* Drop out of event loop if in continuous mode */
-		if (self->continuous) QuitApplicationEventLoop();
-	}
-	else
-	{
-		/* Reset idle timer */
-		lucWindow_IdleReset(inUserData);
-	}
-}
-
-Bool lucCarbonWindow_IsPointOutsideWindow( lucCarbonWindow* self, Point* point ) {
-	return point->v < self->offsetY || (point->v > (self->offsetY + self->height - 8) && point->h > (self->offsetX + self->width - 8));
-}
-
-void lucCarbonWindow_GetPixelIndicies( lucCarbonWindow* self, Point* point, Pixel_Index *xPos, Pixel_Index *yPos ) {
-	*xPos = (Pixel_Index) point->h - self->offsetX;
-	*yPos = self->height - ((Pixel_Index) point->v - self->offsetY);
-}
-
-#endif
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/CarbonWindow.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Windowing/src/CarbonWindow.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,500 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Arrhenius.c 78 2005-11-29 11:58:21Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+#ifdef HAVE_CARBON
+
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <AGL/agl.h>
+#include <OpenGL/OpenGL.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "CarbonWindow.h"
+
+#include <assert.h>
+
+static pascal OSStatus lucCarbonWindow_EventHandler(EventHandlerCallRef nextHandler, EventRef event, void *data) ;
+Bool lucCarbonWindow_IsPointOutsideWindow( lucCarbonWindow* self, Point* point ) ;
+void lucCarbonWindow_GetPixelIndicies( lucCarbonWindow* self, Point* point, Pixel_Index *xPos, Pixel_Index *yPos ) ;
+
+/* this is a secret undocumented Mac function that allows code that isn't part of a bundle to be a foreground operation 
+ * we need to give the prototype here because the function isn't in the header files. */
+void CPSEnableForegroundOperation( void* psn ); 
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucCarbonWindow_Type = "lucCarbonWindow";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucCarbonWindow* _lucCarbonWindow_New(  LUCCARBONWINDOW_DEFARGS  ) 
+{
+	lucCarbonWindow*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucCarbonWindow) );
+	self = (lucCarbonWindow*) _lucWindow_New(  LUCWINDOW_PASSARGS  );
+	
+	return self;
+}
+
+void _lucCarbonWindow_Init( 
+		lucCarbonWindow*                                   self,
+		Pixel_Index                                        offsetX,
+		Pixel_Index                                        offsetY,
+		double                                             maxIdleTime ) 
+{
+	self->offsetX = offsetX;
+	self->offsetY = offsetY;
+}
+
+void _lucCarbonWindow_Delete( void* window ) {
+	_lucWindow_Delete( window );
+}
+
+void _lucCarbonWindow_Print( void* window, Stream* stream ) {
+	lucCarbonWindow*  self = (lucCarbonWindow*)window;
+
+	_lucWindow_Print( self, stream );
+}
+
+void* _lucCarbonWindow_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucCarbonWindow*  self = (lucCarbonWindow*)window;
+	lucCarbonWindow* newWindow;
+
+	newWindow = _lucWindow_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newWindow;
+}
+
+
+void* _lucCarbonWindow_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucCarbonWindow);
+	Type                                                      type = lucCarbonWindow_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucCarbonWindow_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucCarbonWindow_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucCarbonWindow_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucCarbonWindow_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucCarbonWindow_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucCarbonWindow_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucCarbonWindow_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucCarbonWindow_Destroy;
+	lucWindow_DisplayFunction*                      _displayWindow = _lucCarbonWindow_Display;
+	lucWindow_EventsWaitingFunction*                _eventsWaiting = _lucCarbonWindow_EventsWaiting;
+	lucWindow_EventProcessorFunction*              _eventProcessor = _lucCarbonWindow_EventProcessor;
+	lucWindow_ResizeFunction*                        _resizeWindow = _lucCarbonWindow_Resize;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucCarbonWindow_New(  LUCCARBONWINDOW_PASSARGS  );
+}
+
+void _lucCarbonWindow_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ){
+	lucCarbonWindow*  self = (lucCarbonWindow*)window;
+
+	/* Construct Parent */
+	_lucWindow_AssignFromXML( self, cf , data);
+	
+	_lucCarbonWindow_Init( 
+			self,
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"offsetX", 50  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"offsetY", 50  ),
+			Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"maxIdleTime", 600.0 )  );
+}
+
+void _lucCarbonWindow_Build( void* window, void* data ) {
+	/* Run the parent function to build window... */
+	_lucWindow_Build(window, data);	
+}
+
+void _lucCarbonWindow_Initialise( void* window, void* data ) {
+	/* OK: Moved from ExecuteInteractive/Offscreen */
+	lucCarbonWindow*     self      = (lucCarbonWindow*)window;
+		
+	/* Create the window...  */
+	lucCarbonWindow_CreateWindow( self );
+
+	/* Run the parent function to init window... */
+	_lucWindow_Initialise(window, data);	
+	
+	/* Run the parent function to display window... */
+	lucWindow_Display(window);	
+}
+
+
+void _lucCarbonWindow_Execute( void* window, void* data ) {
+	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
+	
+	/* Set the current window's context as active */
+	aglSetCurrentContext (self->graphicsContext);
+	aglUpdateContext (self->graphicsContext);
+	
+	/* Post a dummy event, hack to ensure waiting events are processed in continuous mode */
+	if (_lucCarbonWindow_EventsWaiting(window) == 0)
+	{
+		EventRef dummyEvent;
+		OSStatus        err;
+		err = CreateEvent(NULL, kEventClassWindow, kEventWindowDrawContent, GetCurrentEventTime(), kEventAttributeNone, &dummyEvent);
+		if (err == noErr) err = PostEventToQueue(GetMainEventQueue(), dummyEvent, kEventPriorityHigh);
+	}
+	
+	/* Run the parent function to execute window... */
+	_lucWindow_Execute(window, data);	
+}
+
+void _lucCarbonWindow_Destroy( void* window, void* data ) {
+	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
+
+	/* Run the parent function to destroy window... */
+	_lucWindow_Destroy(window, data);	
+	
+	/* Destroy the window...  */
+	lucCarbonWindow_DestroyWindow( self );
+}
+
+/* Window Virtuals */
+void _lucCarbonWindow_Display( void* window ) {
+	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
+	
+	/* Run the parent function to display window... */
+	lucWindow_Display(window);	
+
+	/* Swap buffers */
+	aglSwapBuffers(self->graphicsContext);
+}
+
+int _lucCarbonWindow_EventsWaiting( void* window ) {
+	EventQueueRef evq = GetMainEventQueue();
+	return GetNumEventsInQueue(evq);
+}
+
+Bool _lucCarbonWindow_EventProcessor( void* window ) {
+
+	RunApplicationEventLoop();
+	/* Returns true when redisplay required */
+	return True;
+}
+
+void _lucCarbonWindow_Resize( void* window ) {
+	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
+
+    if (self->interactive) 
+	{
+		if (self->isMaster)
+		{
+			/* Reset context after resize */
+			aglSetCurrentContext (self->graphicsContext);
+			aglUpdateContext (self->graphicsContext);
+		}
+		else
+		{
+			/* Master window resized? Create new background window of required size */
+			lucCarbonWindow_DestroyBackgroundWindow( self );
+			lucCarbonWindow_CreateBackgroundWindow( self );
+		}
+	}
+	
+	/* Run the parent function to resize window... */
+	lucWindow_Resize(window);	
+}
+
+void lucCarbonWindow_CreateWindow( void* window ) {
+	lucCarbonWindow*        self = (lucCarbonWindow*) window; 
+	AGLPixelFormat          format;		/* OpenGL pixel format */
+	int                     winattrs;	/* Window attributes */
+	Rect                    rect;		/* Rectangle definition */
+	ProcessSerialNumber     psn;		/* Process serial number */
+	static EventTypeSpec    events[] =	/* Events we are interested in... */
+			{
+			  { kEventClassMouse, kEventMouseDown },
+			  { kEventClassMouse, kEventMouseUp },
+			  { kEventClassMouse, kEventMouseDragged },
+			  { kEventClassMouse, kEventMouseWheelMoved },
+			  { kEventClassKeyboard, kEventRawKeyDown },
+			  { kEventClassWindow, kEventWindowDrawContent },
+			  { kEventClassWindow, kEventWindowClose },
+			  { kEventClassWindow, kEventWindowBoundsChanged },
+			  { kEventClassWindow, kEventWindowResizeCompleted},
+			};
+	static GLint 		attributes[] =	/* OpenGL attributes */
+			{
+			  AGL_RGBA,
+			  AGL_GREEN_SIZE, 1,
+			  AGL_DOUBLEBUFFER,
+			  AGL_DEPTH_SIZE, 16,
+              AGL_STENCIL_SIZE, 1,
+			  AGL_NONE
+			};
+
+	lucDebug_PrintFunctionBegin( self, 1 );
+
+	/* Create the window...  */
+	if ( self->isMaster && self->interactive )
+	{	
+		SetRect(&rect, (int)self->offsetX, (int) self->offsetY, (int) (self->width + self->offsetX), (int) (self->height + self->offsetY) );
+		
+		winattrs = kWindowStandardHandlerAttribute | kWindowCloseBoxAttribute |
+		kWindowCollapseBoxAttribute | kWindowFullZoomAttribute |
+		kWindowResizableAttribute | kWindowLiveResizeAttribute;
+		winattrs &= GetAvailableWindowAttributes(kDocumentWindowClass);
+		
+		CreateNewWindow(kDocumentWindowClass, winattrs, &rect, &self->window);
+		SetWTitle(self->window, (unsigned char*)self->title);
+		//	SetWindowTitleWithCFString(self->window, CFSTR(self->title));
+		
+		self->handler = NewEventHandlerUPP(lucCarbonWindow_EventHandler);
+		InstallWindowEventHandler(self->window, self->handler, sizeof(events) / sizeof(events[0]), events, self, 0L);
+		
+		self->timerHandler = NewEventLoopIdleTimerUPP(lucCarbonWindow_IdleTimer);
+		InstallEventLoopIdleTimer(GetMainEventLoop(), kEventDurationSecond * 2, kEventDurationSecond * 1, self->timerHandler, self, &self->timer);
+		
+		GetCurrentProcess(&psn);
+		/* this is a secret undocumented Mac function that allows code that isn't part of a bundle to be a foreground operation */
+		CPSEnableForegroundOperation( &psn ); 
+		SetFrontProcess( &psn );
+		
+		/* Show Window */
+		ShowWindow(self->window);
+		SelectWindow(self->window);
+	}
+	
+	/* Create the OpenGL context and bind it to the window or pixelbuffer.  */
+	format = aglChoosePixelFormat(NULL, 0, attributes);
+	self->graphicsContext = NULL;
+	self->graphicsContext = aglCreateContext(format, NULL);
+	assert( self->graphicsContext );
+	aglDestroyPixelFormat(format);
+
+	if ( self->isMaster && self->interactive )
+	{
+		aglSetDrawable(self->graphicsContext, GetWindowPort(self->window));
+	}
+	else
+	{
+		aglCreatePBuffer(self->width, self->height, GL_TEXTURE_RECTANGLE_EXT, GL_RGBA, 0, &self->PixelBuffer);
+		aglSetPBuffer(self->graphicsContext, self->PixelBuffer, 0, 0, 0);
+	}
+	
+	aglSetCurrentContext(self->graphicsContext);
+}
+
+
+void lucCarbonWindow_DestroyWindow( void* window ) {
+	lucCarbonWindow*        self      = (lucCarbonWindow*) window; 
+
+	if ( self->window )
+	{
+		DisposeEventHandlerUPP( self->handler ); 
+		if (self->timer != NULL) RemoveEventLoopTimer( self->timer );
+		DisposeEventLoopIdleTimerUPP( self->timerHandler ); 
+		DisposeWindow( self->window );
+	}
+	else
+		aglDestroyPBuffer(self->PixelBuffer);
+	
+	aglSetDrawable( self->graphicsContext, 0 );
+	aglSetCurrentContext( 0 );
+	aglDestroyContext( self->graphicsContext );
+	self->graphicsContext = NULL;
+}
+
+static pascal OSStatus lucCarbonWindow_EventHandler(EventHandlerCallRef nextHandler, EventRef event, void* userData) {
+	lucCarbonWindow*        self = (lucCarbonWindow*) userData;
+	UInt32                  kind;			/* Kind of event */
+	Rect                    rect;			/* New window size */
+	EventMouseButton        button;			/* Mouse button */
+	static Point            point;			/* Mouse position */
+	static lucMouseButton   whichButton = 0;
+	static lucMouseState    mouseState  = 0;
+	static Pixel_Index      width, height;
+	EventClass              eventClass;
+	Pixel_Index             xPos, yPos;
+	SInt32					delta;
+
+	assert( self );
+	
+	kind = GetEventKind(event);
+	eventClass = GetEventClass( event );
+
+	if (eventClass == kEventClassWindow) {
+		switch (kind) {
+			case kEventWindowDrawContent:
+				break; 
+			case kEventWindowResizeCompleted:
+				lucWindow_SetSize( self, width, height );
+				break;
+			case kEventWindowBoundsChanged:
+			{
+				GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &rect); 
+				width =  (Pixel_Index) (rect.right - rect.left);
+				height = (Pixel_Index) (rect.bottom - rect.top);
+				self->offsetX = (Pixel_Index) rect.left;
+				self->offsetY = (Pixel_Index) rect.top; 
+				break; 
+			}
+			case kEventWindowClose: 
+				lucWindow_ToggleApplicationQuit(self);
+				self->quitEventLoop = true;
+			    break; 
+		} 
+	} 
+	else if ( eventClass == kEventClassKeyboard ) {
+		if ( kind == kEventRawKeyDown ) {
+			char key;
+			GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &key); 
+			lucCarbonWindow_GetPixelIndicies( self, &point, &xPos, &yPos );
+
+			lucWindow_KeyboardEvent( self, key, xPos, yPos );
+
+			if ( !self->interactive )
+			{
+				/* Hide Window */
+				HideWindow(self->window);
+				self->quitEventLoop = true;
+			}
+		}
+	}
+	else if ( eventClass == kEventClassMouse ) { 
+		switch (kind) { 
+			case kEventMouseDown:  case kEventMouseUp:
+				GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &button); 
+				GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); 
+				
+				/* Make sure that mouse click was within window */
+				if ( lucCarbonWindow_IsPointOutsideWindow( self, &point )) 
+					return (CallNextEventHandler(nextHandler, event)); 
+					
+				lucCarbonWindow_GetPixelIndicies( self, &point, &xPos, &yPos );
+
+				whichButton = ( button == kEventMouseButtonTertiary ? lucMiddleButton :
+						button == kEventMouseButtonSecondary ? lucRightButton : lucLeftButton );
+
+				mouseState = (kind == kEventMouseDown ? lucButtonPress : lucButtonRelease );
+
+				lucWindow_MouseClick( self, whichButton, mouseState, xPos, yPos);
+				break; 
+			case kEventMouseDragged : 
+				GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); 
+				
+				/* Make sure that mouse click was within window */
+				if ( lucCarbonWindow_IsPointOutsideWindow( self, &point )) 
+					return (CallNextEventHandler(nextHandler, event)); 
+				
+				lucCarbonWindow_GetPixelIndicies( self, &point, &xPos, &yPos );
+				lucWindow_MouseMotion(self, whichButton, xPos, yPos); 
+				break; 
+			case kEventMouseWheelMoved:
+				GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point); 
+				GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta );
+				
+				/* Make sure that mouse click was within window */
+				if ( lucCarbonWindow_IsPointOutsideWindow( self, &point )) 
+					return (CallNextEventHandler(nextHandler, event)); 
+
+				lucCarbonWindow_GetPixelIndicies( self, &point, &xPos, &yPos );
+
+				whichButton = ( delta > 0 ? lucWheelUp : lucWheelDown );
+
+				lucWindow_MouseClick( self, whichButton, lucButtonPress, xPos, yPos);
+				break;
+			default : 
+				return (CallNextEventHandler(nextHandler, event)); 
+		} 
+	} 
+	else {
+		Journal_Firewall( False, Journal_MyStream( Error_Type, self ), 
+				"In func '%s' - Cannot understand event class type '%d'\n", __func__, eventClass );
+	}
+
+	/* Break out of event processing if no more events */
+	if (self->quitEventLoop || _lucCarbonWindow_EventsWaiting(self) == 0)
+		QuitApplicationEventLoop();
+
+	return  noErr;
+}
+
+pascal void lucCarbonWindow_IdleTimer(EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void * inUserData) {
+		
+	lucCarbonWindow*        self = (lucCarbonWindow*) inUserData;
+
+	/* idle timeout check */
+	if (inState == kEventLoopIdleTimerIdling)
+	{
+		if (self->interactive)
+			lucWindow_IdleCheck(inUserData);
+		else
+		{
+			RemoveEventLoopTimer( self->timer );
+			self->timer = NULL;
+		}
+
+		/* Drop out of event loop if in continuous mode */
+		if (self->continuous) QuitApplicationEventLoop();
+	}
+	else
+	{
+		/* Reset idle timer */
+		lucWindow_IdleReset(inUserData);
+	}
+}
+
+Bool lucCarbonWindow_IsPointOutsideWindow( lucCarbonWindow* self, Point* point ) {
+	return point->v < self->offsetY || (point->v > (self->offsetY + self->height - 8) && point->h > (self->offsetX + self->width - 8));
+}
+
+void lucCarbonWindow_GetPixelIndicies( lucCarbonWindow* self, Point* point, Pixel_Index *xPos, Pixel_Index *yPos ) {
+	*xPos = (Pixel_Index) point->h - self->offsetX;
+	*yPos = self->height - ((Pixel_Index) point->v - self->offsetY);
+}
+
+#endif
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/Finalise.c
--- a/Windowing/src/Finalise.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include "Finalise.h"
-
-#include <stdio.h>
-
-Bool lucWindowing_Finalise( void ) {
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Windowing/src/Finalise.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,60 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include "Finalise.h"
+
+#include <stdio.h>
+
+Bool lucWindowing_Finalise( void ) {
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/Init.c
--- a/Windowing/src/Init.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/Base/Base.h>
-
-#include "Windowing.h"
-
-const Type lucDefaultWindow_Type = "lucDefaultWindow";
-
-Dictionary* lucDefaultWindow_MetaAsDictionary() {
-	return Dictionary_New();
-}
-
-Dictionary* lucDefaultWindow_Type_MetaAsDictionary() {
-	return lucDefaultWindow_MetaAsDictionary();
-}
-
-Bool lucWindowing_Init() {
-	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
-
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-
-    /* Order of priority for default output window: OSMesa, X11, SDL, Carbon */
-    /* SDL will work with OSMesa to allow on/off-screen rendering so if present is first choice */
-    /* If OSMesa is linked, Carbon and X11 will NOT work as they depend on the system OpenGL */
-    /* library, which OSMesa replaces. */ 
-
-	#ifdef HAVE_OSMESA  
-		#ifdef HAVE_SDL
-			Stg_ComponentRegister_Add( componentRegister, lucSDLWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew  );
-			RegisterParent( lucSDLWindow_Type, lucWindow_Type );
-			if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
-				Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew  );		
-		#endif		
-		Stg_ComponentRegister_Add( componentRegister, lucOSMesaWindow_Type, (Name)"0", _lucOSMesaWindow_DefaultNew  );
-		RegisterParent( lucOSMesaWindow_Type, lucWindow_Type );
-		if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
-			Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucOSMesaWindow_DefaultNew  );
-	#else
-		#ifdef HAVE_X11
-			Stg_ComponentRegister_Add( componentRegister, lucX11Window_Type, (Name)"0", _lucX11Window_DefaultNew  );
-			RegisterParent( lucX11Window_Type, lucWindow_Type );
-			if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
-				Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucX11Window_DefaultNew  );
-		#endif	
-
-		#ifdef HAVE_SDL
-			Stg_ComponentRegister_Add( componentRegister, lucSDLWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew  );
-			RegisterParent( lucSDLWindow_Type, lucWindow_Type );
-			if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
-				Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew  );		
-		#endif		
-	#endif
-
-	#ifdef HAVE_CARBON
-	#ifdef __LP64__ /* Carbon does not support 64-bit, compile with -m32 */
-		Journal_Printf( Journal_Register( ErrorStream_Type, (Name)"Context"  ), "CarbonWindow not available on 64bit compile\n", __func__ ); 
-	#else
-		Stg_ComponentRegister_Add( componentRegister, lucCarbonWindow_Type, (Name)"0", _lucCarbonWindow_DefaultNew  );
-		RegisterParent( lucCarbonWindow_Type, lucWindow_Type );
-		if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
-			Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucCarbonWindow_DefaultNew  );
-	#endif
-	#endif
-
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Windowing/src/Init.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,116 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/Base/Base.h>
+
+#include "Windowing.h"
+
+const Type lucDefaultWindow_Type = "lucDefaultWindow";
+
+Dictionary* lucDefaultWindow_MetaAsDictionary() {
+	return Dictionary_New();
+}
+
+Dictionary* lucDefaultWindow_Type_MetaAsDictionary() {
+	return lucDefaultWindow_MetaAsDictionary();
+}
+
+Bool lucWindowing_Init() {
+	Stg_ComponentRegister* componentRegister = Stg_ComponentRegister_Get_ComponentRegister();
+
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+
+    /* Order of priority for default output window: OSMesa, X11, SDL, Carbon */
+    /* SDL will work with OSMesa to allow on/off-screen rendering so if present is first choice */
+    /* If OSMesa is linked, Carbon and X11 will NOT work as they depend on the system OpenGL */
+    /* library, which OSMesa replaces. */ 
+
+	#ifdef HAVE_OSMESA  
+		#ifdef HAVE_SDL
+			Stg_ComponentRegister_Add( componentRegister, lucSDLWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew  );
+			RegisterParent( lucSDLWindow_Type, lucWindow_Type );
+			if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
+				Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew  );		
+		#endif		
+		Stg_ComponentRegister_Add( componentRegister, lucOSMesaWindow_Type, (Name)"0", _lucOSMesaWindow_DefaultNew  );
+		RegisterParent( lucOSMesaWindow_Type, lucWindow_Type );
+		if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
+			Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucOSMesaWindow_DefaultNew  );
+	#else
+		#ifdef HAVE_X11
+			Stg_ComponentRegister_Add( componentRegister, lucX11Window_Type, (Name)"0", _lucX11Window_DefaultNew  );
+			RegisterParent( lucX11Window_Type, lucWindow_Type );
+			if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
+				Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucX11Window_DefaultNew  );
+		#endif	
+
+		#ifdef HAVE_SDL
+			Stg_ComponentRegister_Add( componentRegister, lucSDLWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew  );
+			RegisterParent( lucSDLWindow_Type, lucWindow_Type );
+			if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
+				Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucSDLWindow_DefaultNew  );		
+		#endif		
+	#endif
+
+	#ifdef HAVE_CARBON
+	#ifdef __LP64__ /* Carbon does not support 64-bit, compile with -m32 */
+		Journal_Printf( Journal_Register( ErrorStream_Type, (Name)"Context"  ), "CarbonWindow not available on 64bit compile\n", __func__ ); 
+	#else
+		Stg_ComponentRegister_Add( componentRegister, lucCarbonWindow_Type, (Name)"0", _lucCarbonWindow_DefaultNew  );
+		RegisterParent( lucCarbonWindow_Type, lucWindow_Type );
+		if ( !Stg_ComponentRegister_Get( componentRegister, lucDefaultWindow_Type, "0" ) )
+			Stg_ComponentRegister_Add( componentRegister, lucDefaultWindow_Type, (Name)"0", _lucCarbonWindow_DefaultNew  );
+	#endif
+	#endif
+
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/OSMesaWindow.c
--- a/Windowing/src/OSMesaWindow.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: OSMesaWindow.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_OSMESA
-
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include <glu.h>
-#include <osmesa.h>
-#include "types.h"
-#include "OSMesaWindow.h"
-
-#include <assert.h>
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucOSMesaWindow_Type = "lucOSMesaWindow";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucOSMesaWindow* _lucOSMesaWindow_New(  LUCOSMESAWINDOW_DEFARGS  ) 
-{
-	lucOSMesaWindow*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucOSMesaWindow) );
-	self = (lucOSMesaWindow*) _lucWindow_New(  LUCWINDOW_PASSARGS  );
-	
-	return self;
-}
-
-void _lucOSMesaWindow_Init( lucOSMesaWindow* self ) {
-}
-
-void _lucOSMesaWindow_Delete( void* window ) {
-	_lucWindow_Delete( window );
-}
-
-void _lucOSMesaWindow_Print( void* window, Stream* stream ) {
-	lucOSMesaWindow*  self = (lucOSMesaWindow*)window;
-
-	_lucWindow_Print( self, stream );
-	Journal_PrintPointer( stream, self->pixelBuffer );
-	Journal_PrintPointer( stream, self->osMesaContext );
-}
-
-void* _lucOSMesaWindow_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucOSMesaWindow*  self = (lucOSMesaWindow*)window;
-	lucOSMesaWindow* newWindow;
-
-	newWindow = _lucWindow_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newWindow;
-}
-
-
-void* _lucOSMesaWindow_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucOSMesaWindow);
-	Type                                                      type = lucOSMesaWindow_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucOSMesaWindow_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucOSMesaWindow_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOSMesaWindow_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucOSMesaWindow_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucOSMesaWindow_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucOSMesaWindow_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucOSMesaWindow_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucOSMesaWindow_Destroy;
-	lucWindow_DisplayFunction*                      _displayWindow = lucWindow_Display;
-	lucWindow_EventsWaitingFunction*                _eventsWaiting = lucWindow_EventsWaiting;
-	lucWindow_EventProcessorFunction*              _eventProcessor = lucWindow_EventProcessor;
-	lucWindow_ResizeFunction*                        _resizeWindow = lucWindow_Resize;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucOSMesaWindow_New(  LUCOSMESAWINDOW_PASSARGS  );
-}
-
-void _lucOSMesaWindow_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ){
-	lucOSMesaWindow*  self = (lucOSMesaWindow*)window;
-
-	/* Construct Parent */
-	_lucWindow_AssignFromXML( self, cf, data );
-	
-	_lucOSMesaWindow_Init( self );
-}
-
-void _lucOSMesaWindow_Build( void* window, void* data ) {
-	/* Run the parent function to build window... */
-	_lucWindow_Build(window, data);	
-}
-
-void _lucOSMesaWindow_Initialise( void* window, void* data ) {
-	lucOSMesaWindow*     self      = (lucOSMesaWindow*)window;
-
-	/* Init OSMesa display buffer */
-	self->pixelBuffer = Memory_Alloc_Array( lucAlphaPixel, self->width * self->height, "OSMesa pixelBuffer" );
-	self->osMesaContext = OSMesaCreateContextExt( OSMESA_RGBA, 16, 1, 0, NULL); /* 16 bit depth, 1 bit stencil */
-
-	OSMesaMakeCurrent( self->osMesaContext, self->pixelBuffer, GL_UNSIGNED_BYTE, self->width, self->height );
-
-	/* Run the parent function to init window... */
-	_lucWindow_Initialise(window, data);	
-}
-
-void _lucOSMesaWindow_Execute( void* window, void* data ) {
-    /* Make sure we are using the correct context when more than one are created */
-	lucOSMesaWindow*     self      = (lucOSMesaWindow*)window;
-	OSMesaMakeCurrent( self->osMesaContext, self->pixelBuffer, GL_UNSIGNED_BYTE, self->width, self->height );
-
-	/* Run the parent function to execute window... */
-	_lucWindow_Execute(window, data);	
-}
-
-void _lucOSMesaWindow_Destroy( void* window, void* data ) {
-	lucOSMesaWindow*     self      = (lucOSMesaWindow*)window;
-
-	/* Moved from _Delete */
-	OSMesaDestroyContext( self->osMesaContext );
-	Memory_Free( self->pixelBuffer );
-
-	/* Run the parent function to destroy window... */
-	_lucWindow_Destroy(window, data);	
-}
-
-#endif /* HAVE_OSMESA */
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/OSMesaWindow.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Windowing/src/OSMesaWindow.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,176 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: OSMesaWindow.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_OSMESA
+
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include <glu.h>
+#include <osmesa.h>
+#include "types.h"
+#include "OSMesaWindow.h"
+
+#include <assert.h>
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucOSMesaWindow_Type = "lucOSMesaWindow";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucOSMesaWindow* _lucOSMesaWindow_New(  LUCOSMESAWINDOW_DEFARGS  ) 
+{
+	lucOSMesaWindow*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucOSMesaWindow) );
+	self = (lucOSMesaWindow*) _lucWindow_New(  LUCWINDOW_PASSARGS  );
+	
+	return self;
+}
+
+void _lucOSMesaWindow_Init( lucOSMesaWindow* self ) {
+}
+
+void _lucOSMesaWindow_Delete( void* window ) {
+	_lucWindow_Delete( window );
+}
+
+void _lucOSMesaWindow_Print( void* window, Stream* stream ) {
+	lucOSMesaWindow*  self = (lucOSMesaWindow*)window;
+
+	_lucWindow_Print( self, stream );
+	Journal_PrintPointer( stream, self->pixelBuffer );
+	Journal_PrintPointer( stream, self->osMesaContext );
+}
+
+void* _lucOSMesaWindow_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucOSMesaWindow*  self = (lucOSMesaWindow*)window;
+	lucOSMesaWindow* newWindow;
+
+	newWindow = _lucWindow_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newWindow;
+}
+
+
+void* _lucOSMesaWindow_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucOSMesaWindow);
+	Type                                                      type = lucOSMesaWindow_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucOSMesaWindow_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucOSMesaWindow_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucOSMesaWindow_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucOSMesaWindow_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucOSMesaWindow_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucOSMesaWindow_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucOSMesaWindow_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucOSMesaWindow_Destroy;
+	lucWindow_DisplayFunction*                      _displayWindow = lucWindow_Display;
+	lucWindow_EventsWaitingFunction*                _eventsWaiting = lucWindow_EventsWaiting;
+	lucWindow_EventProcessorFunction*              _eventProcessor = lucWindow_EventProcessor;
+	lucWindow_ResizeFunction*                        _resizeWindow = lucWindow_Resize;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucOSMesaWindow_New(  LUCOSMESAWINDOW_PASSARGS  );
+}
+
+void _lucOSMesaWindow_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ){
+	lucOSMesaWindow*  self = (lucOSMesaWindow*)window;
+
+	/* Construct Parent */
+	_lucWindow_AssignFromXML( self, cf, data );
+	
+	_lucOSMesaWindow_Init( self );
+}
+
+void _lucOSMesaWindow_Build( void* window, void* data ) {
+	/* Run the parent function to build window... */
+	_lucWindow_Build(window, data);	
+}
+
+void _lucOSMesaWindow_Initialise( void* window, void* data ) {
+	lucOSMesaWindow*     self      = (lucOSMesaWindow*)window;
+
+	/* Init OSMesa display buffer */
+	self->pixelBuffer = Memory_Alloc_Array( lucAlphaPixel, self->width * self->height, "OSMesa pixelBuffer" );
+	self->osMesaContext = OSMesaCreateContextExt( OSMESA_RGBA, 16, 1, 0, NULL); /* 16 bit depth, 1 bit stencil */
+
+	OSMesaMakeCurrent( self->osMesaContext, self->pixelBuffer, GL_UNSIGNED_BYTE, self->width, self->height );
+
+	/* Run the parent function to init window... */
+	_lucWindow_Initialise(window, data);	
+}
+
+void _lucOSMesaWindow_Execute( void* window, void* data ) {
+    /* Make sure we are using the correct context when more than one are created */
+	lucOSMesaWindow*     self      = (lucOSMesaWindow*)window;
+	OSMesaMakeCurrent( self->osMesaContext, self->pixelBuffer, GL_UNSIGNED_BYTE, self->width, self->height );
+
+	/* Run the parent function to execute window... */
+	_lucWindow_Execute(window, data);	
+}
+
+void _lucOSMesaWindow_Destroy( void* window, void* data ) {
+	lucOSMesaWindow*     self      = (lucOSMesaWindow*)window;
+
+	/* Moved from _Delete */
+	OSMesaDestroyContext( self->osMesaContext );
+	Memory_Free( self->pixelBuffer );
+
+	/* Run the parent function to destroy window... */
+	_lucWindow_Destroy(window, data);	
+}
+
+#endif /* HAVE_OSMESA */
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/SDLWindow.c
--- a/Windowing/src/SDLWindow.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,469 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: SDLWindow.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-#ifdef HAVE_SDL
-
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "SDLWindow.h"
-#include <stdlib.h>
-#include <signal.h>
-#include <assert.h>
-#include <gl.h>
-#include <glu.h>
-
-#ifdef HAVE_OSMESA
-	#include <osmesa.h>
-#endif
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucSDLWindow_Type = "lucSDLWindow";
-
-/* Globals required to store maximum window size as SDL only allows a single actual window to be open */
-int SDL_widthMax = 0;
-int SDL_heightMax = 0;
-SDL_Surface *screen = NULL;
-int SDL_useCount = 0;
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucSDLWindow* _lucSDLWindow_New(  LUCSDLWINDOW_DEFARGS  ) 
-{
-	lucSDLWindow*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucSDLWindow) );
-	self = (lucSDLWindow*) _lucWindow_New(  LUCWINDOW_PASSARGS  );
-	
-	return self;
-}
-
-
-void _lucSDLWindow_Delete( void* window ) {
-	_lucWindow_Delete( window );
-}
-
-void _lucSDLWindow_Print( void* window, Stream* stream ) {
-	lucSDLWindow*  self = (lucSDLWindow*)window;
-
-	_lucWindow_Print( self, stream );
-}
-
-void* _lucSDLWindow_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucSDLWindow*  self = (lucSDLWindow*)window;
-	lucSDLWindow* newWindow;
-
-	newWindow = _lucWindow_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newWindow;
-}
-
-
-void* _lucSDLWindow_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucSDLWindow);
-	Type                                                      type = lucSDLWindow_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucSDLWindow_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucSDLWindow_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucSDLWindow_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucSDLWindow_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucSDLWindow_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucSDLWindow_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucSDLWindow_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucSDLWindow_Destroy;
-	lucWindow_DisplayFunction*                      _displayWindow = _lucSDLWindow_Display;
-	lucWindow_EventsWaitingFunction*                _eventsWaiting = _lucSDLWindow_EventsWaiting;
-	lucWindow_EventProcessorFunction*              _eventProcessor = _lucSDLWindow_EventProcessor;
-	lucWindow_ResizeFunction*                        _resizeWindow = _lucSDLWindow_Resize;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucSDLWindow_New(  LUCSDLWINDOW_PASSARGS  );
-}
-
-void _lucSDLWindow_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ) {
-	lucSDLWindow*  self = (lucSDLWindow*)window;
-
-	/* Construct Parent */
-	_lucWindow_AssignFromXML( self, cf, data );
-} 
-
-void _lucSDLWindow_Build( void* window, void* data ) {
-	lucSDLWindow*     self      = (lucSDLWindow*)window;
-
-	/* Run the parent function to build window... */
-	_lucWindow_Build(window, data);	
-
-    /* Save largest window dimensions required */
-    if (self->width > SDL_widthMax) SDL_widthMax = self->width; 
-    if (self->height > SDL_heightMax) SDL_heightMax = self->height; 
-}
-
-void _lucSDLWindow_Initialise( void* window, void* data ) {
-	lucSDLWindow*     self      = (lucSDLWindow*)window;
-
-	/* Initialise SDL Video subsystem */
-    if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ) < 0 ) { 
-        Journal_Printf( lucError, "In func %s: Unable to initialize SDL: %s\n", __func__, SDL_GetError() );
-        abort();
-    }
-
-    putenv("SDL_VIDEO_CENTERED=1");
-    
-    const SDL_VideoInfo *pSDLVideoInfo = SDL_GetVideoInfo();
-
-    if( !pSDLVideoInfo )
-    {
-        Journal_Printf( lucError, "In func %s: SDL_GetVideoInfo() failed. SDL Error: %s\n", __func__, SDL_GetError() );
-        SDL_Quit();
-        exit(1);
-    }
-
-    /*** SDL will use OSMesa as the OpenGL implementation if it is present, by copying the OSMesa output
-     *** to the SDL display. This allows SDL on-screen and OSMesa off-screen rendering available in the same binary.
-     *** For this to work, OSMesa must be linked without/before any other OpenGL implementations. */
-  #ifdef HAVE_OSMESA
-    Journal_Printf( Journal_MyStream( Info_Type, self ), "*** Using OSMesa library for OpenGL graphics in SDL Window ***.\n" );
-    self->osMesaContext = OSMesaCreateContextExt( GL_RGBA, 16, 1, 0, NULL );    /* 16 bit depth, 1 bit stencil */
-    if (!self->osMesaContext) {
-        Journal_Printf( lucError, "In func %s: OSMesaCreateContext failed!\n", __func__);
-        abort();
-    }
-    if( pSDLVideoInfo->hw_available ) 	/* Hardware surfaces enabled? */
-        self->sdlFlags = SDL_RESIZABLE | SDL_HWSURFACE | SDL_DOUBLEBUF;
-    else
-        self->sdlFlags = SDL_RESIZABLE | SDL_SWSURFACE;
-  #else
-    self->sdlFlags = SDL_OPENGL | SDL_RESIZABLE;
-    /* set opengl attributes */
-    SDL_GL_SetAttribute(SDL_GL_RED_SIZE,        8);
-    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,      8);
-    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,       8);
-    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,      8);
-    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,      16);
-    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,    1);
-    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,    1);
-  #endif
-
-    /* Create display */	
-    lucSDLWindow_CreateWindow(self);
-    
-    if (self->interactive && self->isMaster)
-        /* Install 1sec idle timer */
-        self->timer = SDL_AddTimer(1000, lucSDLWindow_IdleTimer, self);
-
-    /* NOTE: we still want Ctrl-C to work, so we undo the SDL redirections */
-    signal(SIGINT, SIG_DFL);
-    signal(SIGQUIT, SIG_DFL);
-
-	/* Run the parent function to init window... */
-	_lucWindow_Initialise(window, data);	
-
-	/* Refresh display */
-	//_lucSDLWindow_Display(window);
-}
-
-void _lucSDLWindow_Execute( void* window, void* data ) {
-	lucSDLWindow*   self = (lucSDLWindow*)window;
-
-    /* Update title */
-    SDL_WM_SetCaption( self->title, NULL );
-  #ifdef HAVE_OSMESA
-    OSMesaMakeCurrent( self->osMesaContext, self->buffer->pixels, GL_UNSIGNED_BYTE, self->width, self->height );
-    Journal_DPrintfL( lucDebug, 2, "OSMesa make current %d,%d\n", self->width, self->height);
-  #else
-    /* Clear background */
-		self->renderingEngine->_clear(self, window, False);
-  #endif
-	/* Run the parent function to execute the window... */
-	_lucWindow_Execute(window, data);	
-}
-
-void _lucSDLWindow_Destroy( void* window, void* data ) {
-	lucSDLWindow*   self = (lucSDLWindow*)window;
-
-	/* Run the parent function to destroy window... */
-	_lucWindow_Destroy(window, data);
-
-    lucSDLWindow_DeleteWindow(window);
-
-  #ifdef HAVE_OSMESA
-    /* destroy the context */
-    if (self->osMesaContext) OSMesaDestroyContext( self->osMesaContext );
-    if (!self->interactive || !self->isMaster) return;  /* Already quit sdl */
-  #endif
-
-	/* Shut down SDL */
-	SDL_Quit();
-}
-
-/* Window Virtuals */
-void _lucSDLWindow_Display( void* window ) {
-	lucSDLWindow*        self = (lucSDLWindow*) window; 
-
-	/* Run the parent function to display window... */
-	lucWindow_Display(window);	
-
-  #ifdef HAVE_OSMESA
-	/* Render in SDL using OSMesa output buffer */
-    if (self->interactive)
-    {
-        SDL_PixelFormat *fmt = self->screen->format;
-        lucColour *c = &self->backgroundColour;
-        SDL_FillRect(self->screen, NULL, SDL_MapRGBA(fmt, (Uint8)(c->red * 255), (Uint8)(c->green * 255), 
-                                                          (Uint8)(c->blue * 255), (Uint8)(c->opacity * 255)));
-        Journal_DPrintfL( lucDebug, 2, "SDL BLIT SURFACE src %d,%d to dst %d,%d\n\n", self->buffer->w, self->buffer->h, self->screen->w, self->screen->h);
-    	SDL_BlitSurface(self->buffer,NULL,self->screen,NULL);
-	    SDL_Flip(self->screen);
-    }
-  #else	
-	/* Swap buffers */
-	SDL_GL_SwapBuffers();
-  #endif
-}
-
-int _lucSDLWindow_EventsWaiting( void* window ) {
-	/* Check for events without removing from queue */
-	SDL_Event events[10];
-	SDL_PumpEvents();
-	return SDL_PeepEvents(events, 10, SDL_PEEKEVENT, SDL_ALLEVENTS);
-}
-
-Bool _lucSDLWindow_EventProcessor( void* window ) {
-	lucSDLWindow*   self = (lucSDLWindow*)window;
-	char            keyPressed;
-	static int      button = 0;
-	static Bool     buttonDown = False;
-	Bool			redisplay = True;
-	SDL_Event       event;
-	
-	/* Wait for next event */
-	SDL_WaitEvent( &event );
-
-	switch( event.type ) {
-		case SDL_QUIT:
-			lucWindow_ToggleApplicationQuit( window );
-			break;	
-		case SDL_VIDEORESIZE:
-			redisplay = lucWindow_SetSize( self, event.resize.w, event.resize.h);
-			break;
-		case SDL_KEYDOWN:
-			keyPressed = event.key.keysym.sym;
-			int xpos, ypos;
-			SDL_GetMouseState(&xpos, &ypos);
-			lucWindow_KeyboardEvent( self, keyPressed, xpos, self->height - ypos);
-			break;
-		case SDL_MOUSEMOTION:
-			if (buttonDown)
-				lucWindow_MouseMotion(self, button, event.motion.x, self->height - event.motion.y);
-			else
-				redisplay = False;
-			break;
-		case SDL_MOUSEBUTTONDOWN: 
-			buttonDown = True;
-			button = event.button.button;
-			lucWindow_MouseClick( self, button, event.type, event.button.x, self->height - event.button.y);
-			break;
-		case SDL_MOUSEBUTTONUP:
-			buttonDown = False;
-			break;
-		case SDL_USEREVENT:
-			/* Timer event */
-			if (!self->interactive) 
-			{
-				/* Interactive mode switched off */
-                Journal_DPrintfL( lucDebug, 2, "Interactive mode OFF\n");
-				lucWindow_SetViewportNeedsToDrawFlag( self, True );
-	    		SDL_RemoveTimer(self->timer);
-                #ifdef HAVE_OSMESA
-                    lucSDLWindow_DeleteWindow(window);
-                #endif
-				self->quitEventLoop = True;
-                self->resized = True;
-			}
-			else
-			{
-				/* idle timeout check */
-				lucWindow_IdleCheck(self);
-		        redisplay = False;
-			}
-			break;
-		case SDL_ACTIVEEVENT:
-			if (event.active.state == SDL_APPACTIVE && event.active.gain == 1)	/* Restored from icon */
-				lucWindow_SetViewportNeedsToDrawFlag( self, True );
-			else
-				redisplay = False;
-			break;
-		case SDL_VIDEOEXPOSE:
-		default:	
-			redisplay = False;	/* No change to display, don't redraw */
-	}
-	
-	/* Reset idle timer */
-	lucWindow_IdleReset(self);
-
-	/* Returns true if display needs refresh */
-	return redisplay;
-}
-
-void _lucSDLWindow_Resize( void* window ) {
-	lucSDLWindow*        self = (lucSDLWindow*) window; 
-
-    /* Free existing window data structures */
-    lucSDLWindow_DeleteWindow(self);
-
-    /* Recreate in new dimensions */
-    lucSDLWindow_CreateWindow(self);
-  #ifdef HAVE_OSMESA
-    if (!self->interactive) return; /* Interactive switched off, no need to redo viewports */
-  #endif
-	/* Run the parent function to resize window viewports... */
-	lucWindow_Resize(window);	
-}
-
-/* Timer callback */
-Uint32 lucSDLWindow_IdleTimer(Uint32 interval, void* param) {
-	lucSDLWindow* self;
-
-	self = (lucSDLWindow*) param; 
-
-    /* Create a user event and post */
-    SDL_Event event;
-    
-    event.type = SDL_USEREVENT;
-    event.user.code = 1;
-    event.user.data1 = 0;
-    event.user.data2 = 0;
-    
-    SDL_PushEvent(&event);
-
-	return interval;
-}
-
-void lucSDLWindow_CreateWindow( void* window ) {
-
-	lucSDLWindow* self = (lucSDLWindow*)window;
-    Journal_DPrintfL( lucDebug, 2, "*** Create window %d,%d (%s)\n", self->width, self->height, self->name);
-    if (self->width > SDL_widthMax) SDL_widthMax = self->width; 
-    if (self->height > SDL_heightMax) SDL_heightMax = self->height; 
-
-  #ifdef HAVE_OSMESA
-    /* SDL interprets each pixel as a 32-bit number, so our masks depend on the byte order */
-	Uint32 rmask, gmask, bmask, amask;
-	#if SDL_BYTEORDER == SDL_BIG_ENDIAN 
-		rmask = 0xff000000; gmask = 0x00ff0000;	bmask = 0x0000ff00;	amask = 0x000000ff;
-	#else
-		rmask = 0x000000ff;	gmask = 0x0000ff00;	bmask = 0x00ff0000;	amask = 0xff000000;
-	#endif
-
-	/* buffer for display */
-	self->buffer = SDL_CreateRGBSurface(SDL_SWSURFACE, self->width, self->height, 32, rmask, gmask,  bmask, amask);
-    SDL_SetAlpha(self->buffer, 0, 0);
-         
-	/* Bind the buffer to the context and make it current */
-   	if (!OSMesaMakeCurrent( self->osMesaContext, self->buffer->pixels, GL_UNSIGNED_BYTE, self->width, self->height )) {
-		Journal_Printf( lucError, "In func %s: OSMesaMakeCurrent failed!\n", __func__);
-		abort();
-   	}
-	OSMesaPixelStore(OSMESA_Y_UP,0);
-    if (!self->interactive || !self->isMaster) return;  /* No SDL window required */
-  #endif
-
-    /* Create our rendering surface */
-    if (screen == NULL || screen->w < SDL_widthMax || screen->h < SDL_heightMax) 
-    {
-        if (screen != NULL) SDL_FreeSurface(self->screen);
-        
-        screen = SDL_SetVideoMode( SDL_widthMax, SDL_heightMax, 32, self->sdlFlags );
-        Journal_DPrintfL( lucDebug, 2, "SDL SET VIDEO %d,%d\n\n", SDL_widthMax, SDL_heightMax);
-        if (!screen)
-        {
-            Journal_Printf( lucError, "In func %s: Call to SDL_SetVideoMode() failed! - SDL_Error: %s\n", __func__, SDL_GetError() );
-            SDL_Quit();
-            abort();
-        }
-    }
-    self->screen = screen;
-    SDL_useCount++;;
-}
-
-void lucSDLWindow_DeleteWindow(void *window) {
-	lucSDLWindow* self = (lucSDLWindow*)window;
-
-  #ifdef HAVE_OSMESA
-    /* free the image buffer */
-    if (self->buffer) SDL_FreeSurface(self->buffer);
-  #endif
-
-    /* Decrement usage count, free if no longer needed */
-    if (self->screen) 
-    {
-        SDL_useCount--;
-        if (SDL_useCount < 1)
-        { 
-            SDL_FreeSurface(self->screen);
-            SDL_Quit();
-            screen = NULL;
-        }
-    }
-
-    self->buffer = NULL;
-    self->screen = NULL;
-	Journal_DPrintfL( lucDebug, 2, "Delete Window %s in %s\n", self->name, __func__);
-}
-
-#endif
-
-
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/SDLWindow.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Windowing/src/SDLWindow.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,469 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: SDLWindow.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifdef HAVE_SDL
+
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "SDLWindow.h"
+#include <stdlib.h>
+#include <signal.h>
+#include <assert.h>
+#include <gl.h>
+#include <glu.h>
+
+#ifdef HAVE_OSMESA
+	#include <osmesa.h>
+#endif
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucSDLWindow_Type = "lucSDLWindow";
+
+/* Globals required to store maximum window size as SDL only allows a single actual window to be open */
+int SDL_widthMax = 0;
+int SDL_heightMax = 0;
+SDL_Surface *screen = NULL;
+int SDL_useCount = 0;
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucSDLWindow* _lucSDLWindow_New(  LUCSDLWINDOW_DEFARGS  ) 
+{
+	lucSDLWindow*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucSDLWindow) );
+	self = (lucSDLWindow*) _lucWindow_New(  LUCWINDOW_PASSARGS  );
+	
+	return self;
+}
+
+
+void _lucSDLWindow_Delete( void* window ) {
+	_lucWindow_Delete( window );
+}
+
+void _lucSDLWindow_Print( void* window, Stream* stream ) {
+	lucSDLWindow*  self = (lucSDLWindow*)window;
+
+	_lucWindow_Print( self, stream );
+}
+
+void* _lucSDLWindow_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucSDLWindow*  self = (lucSDLWindow*)window;
+	lucSDLWindow* newWindow;
+
+	newWindow = _lucWindow_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newWindow;
+}
+
+
+void* _lucSDLWindow_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucSDLWindow);
+	Type                                                      type = lucSDLWindow_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucSDLWindow_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucSDLWindow_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucSDLWindow_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucSDLWindow_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucSDLWindow_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucSDLWindow_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucSDLWindow_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucSDLWindow_Destroy;
+	lucWindow_DisplayFunction*                      _displayWindow = _lucSDLWindow_Display;
+	lucWindow_EventsWaitingFunction*                _eventsWaiting = _lucSDLWindow_EventsWaiting;
+	lucWindow_EventProcessorFunction*              _eventProcessor = _lucSDLWindow_EventProcessor;
+	lucWindow_ResizeFunction*                        _resizeWindow = _lucSDLWindow_Resize;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucSDLWindow_New(  LUCSDLWINDOW_PASSARGS  );
+}
+
+void _lucSDLWindow_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ) {
+	lucSDLWindow*  self = (lucSDLWindow*)window;
+
+	/* Construct Parent */
+	_lucWindow_AssignFromXML( self, cf, data );
+} 
+
+void _lucSDLWindow_Build( void* window, void* data ) {
+	lucSDLWindow*     self      = (lucSDLWindow*)window;
+
+	/* Run the parent function to build window... */
+	_lucWindow_Build(window, data);	
+
+    /* Save largest window dimensions required */
+    if (self->width > SDL_widthMax) SDL_widthMax = self->width; 
+    if (self->height > SDL_heightMax) SDL_heightMax = self->height; 
+}
+
+void _lucSDLWindow_Initialise( void* window, void* data ) {
+	lucSDLWindow*     self      = (lucSDLWindow*)window;
+
+	/* Initialise SDL Video subsystem */
+    if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ) < 0 ) { 
+        Journal_Printf( lucError, "In func %s: Unable to initialize SDL: %s\n", __func__, SDL_GetError() );
+        abort();
+    }
+
+    putenv("SDL_VIDEO_CENTERED=1");
+    
+    const SDL_VideoInfo *pSDLVideoInfo = SDL_GetVideoInfo();
+
+    if( !pSDLVideoInfo )
+    {
+        Journal_Printf( lucError, "In func %s: SDL_GetVideoInfo() failed. SDL Error: %s\n", __func__, SDL_GetError() );
+        SDL_Quit();
+        exit(1);
+    }
+
+    /*** SDL will use OSMesa as the OpenGL implementation if it is present, by copying the OSMesa output
+     *** to the SDL display. This allows SDL on-screen and OSMesa off-screen rendering available in the same binary.
+     *** For this to work, OSMesa must be linked without/before any other OpenGL implementations. */
+  #ifdef HAVE_OSMESA
+    Journal_Printf( Journal_MyStream( Info_Type, self ), "*** Using OSMesa library for OpenGL graphics in SDL Window ***.\n" );
+    self->osMesaContext = OSMesaCreateContextExt( GL_RGBA, 16, 1, 0, NULL );    /* 16 bit depth, 1 bit stencil */
+    if (!self->osMesaContext) {
+        Journal_Printf( lucError, "In func %s: OSMesaCreateContext failed!\n", __func__);
+        abort();
+    }
+    if( pSDLVideoInfo->hw_available ) 	/* Hardware surfaces enabled? */
+        self->sdlFlags = SDL_RESIZABLE | SDL_HWSURFACE | SDL_DOUBLEBUF;
+    else
+        self->sdlFlags = SDL_RESIZABLE | SDL_SWSURFACE;
+  #else
+    self->sdlFlags = SDL_OPENGL | SDL_RESIZABLE;
+    /* set opengl attributes */
+    SDL_GL_SetAttribute(SDL_GL_RED_SIZE,        8);
+    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,      8);
+    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,       8);
+    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,      8);
+    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,      16);
+    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,    1);
+    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,    1);
+  #endif
+
+    /* Create display */	
+    lucSDLWindow_CreateWindow(self);
+    
+    if (self->interactive && self->isMaster)
+        /* Install 1sec idle timer */
+        self->timer = SDL_AddTimer(1000, lucSDLWindow_IdleTimer, self);
+
+    /* NOTE: we still want Ctrl-C to work, so we undo the SDL redirections */
+    signal(SIGINT, SIG_DFL);
+    signal(SIGQUIT, SIG_DFL);
+
+	/* Run the parent function to init window... */
+	_lucWindow_Initialise(window, data);	
+
+	/* Refresh display */
+	//_lucSDLWindow_Display(window);
+}
+
+void _lucSDLWindow_Execute( void* window, void* data ) {
+	lucSDLWindow*   self = (lucSDLWindow*)window;
+
+    /* Update title */
+    SDL_WM_SetCaption( self->title, NULL );
+  #ifdef HAVE_OSMESA
+    OSMesaMakeCurrent( self->osMesaContext, self->buffer->pixels, GL_UNSIGNED_BYTE, self->width, self->height );
+    Journal_DPrintfL( lucDebug, 2, "OSMesa make current %d,%d\n", self->width, self->height);
+  #else
+    /* Clear background */
+		self->renderingEngine->_clear(self, window, False);
+  #endif
+	/* Run the parent function to execute the window... */
+	_lucWindow_Execute(window, data);	
+}
+
+void _lucSDLWindow_Destroy( void* window, void* data ) {
+	lucSDLWindow*   self = (lucSDLWindow*)window;
+
+	/* Run the parent function to destroy window... */
+	_lucWindow_Destroy(window, data);
+
+    lucSDLWindow_DeleteWindow(window);
+
+  #ifdef HAVE_OSMESA
+    /* destroy the context */
+    if (self->osMesaContext) OSMesaDestroyContext( self->osMesaContext );
+    if (!self->interactive || !self->isMaster) return;  /* Already quit sdl */
+  #endif
+
+	/* Shut down SDL */
+	SDL_Quit();
+}
+
+/* Window Virtuals */
+void _lucSDLWindow_Display( void* window ) {
+	lucSDLWindow*        self = (lucSDLWindow*) window; 
+
+	/* Run the parent function to display window... */
+	lucWindow_Display(window);	
+
+  #ifdef HAVE_OSMESA
+	/* Render in SDL using OSMesa output buffer */
+    if (self->interactive)
+    {
+        SDL_PixelFormat *fmt = self->screen->format;
+        lucColour *c = &self->backgroundColour;
+        SDL_FillRect(self->screen, NULL, SDL_MapRGBA(fmt, (Uint8)(c->red * 255), (Uint8)(c->green * 255), 
+                                                          (Uint8)(c->blue * 255), (Uint8)(c->opacity * 255)));
+        Journal_DPrintfL( lucDebug, 2, "SDL BLIT SURFACE src %d,%d to dst %d,%d\n\n", self->buffer->w, self->buffer->h, self->screen->w, self->screen->h);
+    	SDL_BlitSurface(self->buffer,NULL,self->screen,NULL);
+	    SDL_Flip(self->screen);
+    }
+  #else	
+	/* Swap buffers */
+	SDL_GL_SwapBuffers();
+  #endif
+}
+
+int _lucSDLWindow_EventsWaiting( void* window ) {
+	/* Check for events without removing from queue */
+	SDL_Event events[10];
+	SDL_PumpEvents();
+	return SDL_PeepEvents(events, 10, SDL_PEEKEVENT, SDL_ALLEVENTS);
+}
+
+Bool _lucSDLWindow_EventProcessor( void* window ) {
+	lucSDLWindow*   self = (lucSDLWindow*)window;
+	char            keyPressed;
+	static int      button = 0;
+	static Bool     buttonDown = False;
+	Bool			redisplay = True;
+	SDL_Event       event;
+	
+	/* Wait for next event */
+	SDL_WaitEvent( &event );
+
+	switch( event.type ) {
+		case SDL_QUIT:
+			lucWindow_ToggleApplicationQuit( window );
+			break;	
+		case SDL_VIDEORESIZE:
+			redisplay = lucWindow_SetSize( self, event.resize.w, event.resize.h);
+			break;
+		case SDL_KEYDOWN:
+			keyPressed = event.key.keysym.sym;
+			int xpos, ypos;
+			SDL_GetMouseState(&xpos, &ypos);
+			lucWindow_KeyboardEvent( self, keyPressed, xpos, self->height - ypos);
+			break;
+		case SDL_MOUSEMOTION:
+			if (buttonDown)
+				lucWindow_MouseMotion(self, button, event.motion.x, self->height - event.motion.y);
+			else
+				redisplay = False;
+			break;
+		case SDL_MOUSEBUTTONDOWN: 
+			buttonDown = True;
+			button = event.button.button;
+			lucWindow_MouseClick( self, button, event.type, event.button.x, self->height - event.button.y);
+			break;
+		case SDL_MOUSEBUTTONUP:
+			buttonDown = False;
+			break;
+		case SDL_USEREVENT:
+			/* Timer event */
+			if (!self->interactive) 
+			{
+				/* Interactive mode switched off */
+                Journal_DPrintfL( lucDebug, 2, "Interactive mode OFF\n");
+				lucWindow_SetViewportNeedsToDrawFlag( self, True );
+	    		SDL_RemoveTimer(self->timer);
+                #ifdef HAVE_OSMESA
+                    lucSDLWindow_DeleteWindow(window);
+                #endif
+				self->quitEventLoop = True;
+                self->resized = True;
+			}
+			else
+			{
+				/* idle timeout check */
+				lucWindow_IdleCheck(self);
+		        redisplay = False;
+			}
+			break;
+		case SDL_ACTIVEEVENT:
+			if (event.active.state == SDL_APPACTIVE && event.active.gain == 1)	/* Restored from icon */
+				lucWindow_SetViewportNeedsToDrawFlag( self, True );
+			else
+				redisplay = False;
+			break;
+		case SDL_VIDEOEXPOSE:
+		default:	
+			redisplay = False;	/* No change to display, don't redraw */
+	}
+	
+	/* Reset idle timer */
+	lucWindow_IdleReset(self);
+
+	/* Returns true if display needs refresh */
+	return redisplay;
+}
+
+void _lucSDLWindow_Resize( void* window ) {
+	lucSDLWindow*        self = (lucSDLWindow*) window; 
+
+    /* Free existing window data structures */
+    lucSDLWindow_DeleteWindow(self);
+
+    /* Recreate in new dimensions */
+    lucSDLWindow_CreateWindow(self);
+  #ifdef HAVE_OSMESA
+    if (!self->interactive) return; /* Interactive switched off, no need to redo viewports */
+  #endif
+	/* Run the parent function to resize window viewports... */
+	lucWindow_Resize(window);	
+}
+
+/* Timer callback */
+Uint32 lucSDLWindow_IdleTimer(Uint32 interval, void* param) {
+	lucSDLWindow* self;
+
+	self = (lucSDLWindow*) param; 
+
+    /* Create a user event and post */
+    SDL_Event event;
+    
+    event.type = SDL_USEREVENT;
+    event.user.code = 1;
+    event.user.data1 = 0;
+    event.user.data2 = 0;
+    
+    SDL_PushEvent(&event);
+
+	return interval;
+}
+
+void lucSDLWindow_CreateWindow( void* window ) {
+
+	lucSDLWindow* self = (lucSDLWindow*)window;
+    Journal_DPrintfL( lucDebug, 2, "*** Create window %d,%d (%s)\n", self->width, self->height, self->name);
+    if (self->width > SDL_widthMax) SDL_widthMax = self->width; 
+    if (self->height > SDL_heightMax) SDL_heightMax = self->height; 
+
+  #ifdef HAVE_OSMESA
+    /* SDL interprets each pixel as a 32-bit number, so our masks depend on the byte order */
+	Uint32 rmask, gmask, bmask, amask;
+	#if SDL_BYTEORDER == SDL_BIG_ENDIAN 
+		rmask = 0xff000000; gmask = 0x00ff0000;	bmask = 0x0000ff00;	amask = 0x000000ff;
+	#else
+		rmask = 0x000000ff;	gmask = 0x0000ff00;	bmask = 0x00ff0000;	amask = 0xff000000;
+	#endif
+
+	/* buffer for display */
+	self->buffer = SDL_CreateRGBSurface(SDL_SWSURFACE, self->width, self->height, 32, rmask, gmask,  bmask, amask);
+    SDL_SetAlpha(self->buffer, 0, 0);
+         
+	/* Bind the buffer to the context and make it current */
+   	if (!OSMesaMakeCurrent( self->osMesaContext, self->buffer->pixels, GL_UNSIGNED_BYTE, self->width, self->height )) {
+		Journal_Printf( lucError, "In func %s: OSMesaMakeCurrent failed!\n", __func__);
+		abort();
+   	}
+	OSMesaPixelStore(OSMESA_Y_UP,0);
+    if (!self->interactive || !self->isMaster) return;  /* No SDL window required */
+  #endif
+
+    /* Create our rendering surface */
+    if (screen == NULL || screen->w < SDL_widthMax || screen->h < SDL_heightMax) 
+    {
+        if (screen != NULL) SDL_FreeSurface(self->screen);
+        
+        screen = SDL_SetVideoMode( SDL_widthMax, SDL_heightMax, 32, self->sdlFlags );
+        Journal_DPrintfL( lucDebug, 2, "SDL SET VIDEO %d,%d\n\n", SDL_widthMax, SDL_heightMax);
+        if (!screen)
+        {
+            Journal_Printf( lucError, "In func %s: Call to SDL_SetVideoMode() failed! - SDL_Error: %s\n", __func__, SDL_GetError() );
+            SDL_Quit();
+            abort();
+        }
+    }
+    self->screen = screen;
+    SDL_useCount++;;
+}
+
+void lucSDLWindow_DeleteWindow(void *window) {
+	lucSDLWindow* self = (lucSDLWindow*)window;
+
+  #ifdef HAVE_OSMESA
+    /* free the image buffer */
+    if (self->buffer) SDL_FreeSurface(self->buffer);
+  #endif
+
+    /* Decrement usage count, free if no longer needed */
+    if (self->screen) 
+    {
+        SDL_useCount--;
+        if (SDL_useCount < 1)
+        { 
+            SDL_FreeSurface(self->screen);
+            SDL_Quit();
+            screen = NULL;
+        }
+    }
+
+    self->buffer = NULL;
+    self->screen = NULL;
+	Journal_DPrintfL( lucDebug, 2, "Delete Window %s in %s\n", self->name, __func__);
+}
+
+#endif
+
+
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/X11Window.c
--- a/Windowing/src/X11Window.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,611 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: X11Window.c 787 2008-08-26 07:57:24Z JulianGiordani $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
- 
-#ifdef HAVE_X11
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include <glucifer/Base/Base.h>
-
-#include "types.h"
-#include "X11Window.h"
-
-#include <assert.h>
-#ifdef __APPLE__
-#include <CoreServices/CoreServices.h>
-#endif
-
-#ifndef MASTER
-	#define MASTER 0
-#endif
-
-#include <signal.h>
-#include <sys/time.h>
-lucWindow* parent;	/* Need to save in global so signal handler for idle timer can access */
-
-/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
-const Type lucX11Window_Type = "lucX11Window";
-
-/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
-lucX11Window* _lucX11Window_New(  LUCX11WINDOW_DEFARGS  ) 
-{
-	lucX11Window*					self;
-
-	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
-	assert( _sizeOfSelf >= sizeof(lucX11Window) );
-	self = (lucX11Window*) _lucWindow_New(  LUCWINDOW_PASSARGS  );
-	
-	return self;
-}
-
-void _lucX11Window_Init( 
-		lucX11Window*                                      self,
-		Name                                               host,
-		unsigned int                                       displayNumber,
-		unsigned int                                       displayScreen )
-{
-
-	/* Setup display name */
-	Stg_asprintf( &self->displayName, "%s:%u.%u", host, displayNumber, displayScreen );
-	self->host          = StG_Strdup( host );
-	self->displayNumber = displayNumber;
-	self->displayScreen = displayScreen;
-}
-
-void _lucX11Window_Delete( void* window ) {
-	_lucWindow_Delete( window );
-}
-
-void _lucX11Window_Print( void* window, Stream* stream ) {
-	lucX11Window*  self = (lucX11Window*)window;
-
-	_lucWindow_Print( self, stream );
-}
-
-void* _lucX11Window_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
-	lucX11Window*  self = (lucX11Window*)window;
-	lucX11Window* newWindow;
-
-	newWindow = _lucWindow_Copy( self, dest, deep, nameExt, ptrMap );
-
-	/* TODO */
-	abort();
-
-	return (void*) newWindow;
-}
-
-
-void* _lucX11Window_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(lucX11Window);
-	Type                                                      type = lucX11Window_Type;
-	Stg_Class_DeleteFunction*                              _delete = _lucX11Window_Delete;
-	Stg_Class_PrintFunction*                                _print = _lucX11Window_Print;
-	Stg_Class_CopyFunction*                                  _copy = NULL;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucX11Window_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucX11Window_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _lucX11Window_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _lucX11Window_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _lucX11Window_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _lucX11Window_Destroy;
-	lucWindow_DisplayFunction*                      _displayWindow = _lucX11Window_Display;
-	lucWindow_EventsWaitingFunction*                _eventsWaiting = _lucX11Window_EventsWaiting;
-	lucWindow_EventProcessorFunction*              _eventProcessor = _lucX11Window_EventProcessor;
-	lucWindow_ResizeFunction*                        _resizeWindow = _lucX11Window_Resize;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return (void*) _lucX11Window_New(  LUCX11WINDOW_PASSARGS  );
-}
-
-void _lucX11Window_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ){
-	lucX11Window*  self = (lucX11Window*)window;
-
-	/* Construct Parent */
-	_lucWindow_AssignFromXML( self, cf, data ); 
-				
-	_lucX11Window_Init( 
-			self,
-			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"host", "localhost"  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"displayNumber", 0  ),
-			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"displayScreen", 0 )  );
-			
-			
-}
-
-void _lucX11Window_Build( void* window, void* data ) {
-	/* Run the parent function to build window... */
-	_lucWindow_Build(window, data);	
-}
-
-void _lucX11Window_Initialise( void* window, void* data ) {
-	lucX11Window*  self = (lucX11Window*)window;
-
-	lucDebug_PrintFunctionBegin( self, 1 );
-
-	XSetErrorHandler(lucX11Window_Error);
-	
-	Journal_Firewall(lucX11Window_CreateDisplay( self ),
-					 lucError,
-					 "Error in func '%s' for %s '%s': Cannot create display.\n", __func__, self->type, self->name );
-
-	if ( self->interactive && self->isMaster) {
-		Journal_DPrintf( lucDebug, "Opening Interactive window.\n");
-		lucX11Window_CreateInteractiveWindow( self );
-	}
-	else {
-		Journal_DPrintf( lucDebug, "Opening background window.\n");
-		lucX11Window_CreateBackgroundWindow( self );
-	}
-
-	/* Run the parent function to init window... */
-	_lucWindow_Initialise(window, data);
-
-	lucDebug_PrintFunctionEnd( self, 1 );
-}
-
-void _lucX11Window_Execute( void* window, void* data ) {
-	lucX11Window*        self = (lucX11Window*) window; 
-
-    /* Make sure we are using the correct context - for multiple windows */
-	if (self->interactive && self->isMaster)
-    {
-		glXMakeCurrent( self->display, self->win, self->glxcontext);
-      //XSetInputFocus(self->display, self->win, RevertToParent, CurrentTime);
-    }
-    else 
-        glXMakeCurrent( self->display, self->glxpmap, self->glxcontext);
-
-	/* Run the parent function to execute the window... */
-	_lucWindow_Execute(window, data);	
-}
-
-void _lucX11Window_Destroy( void* window, void* data ) {
-	lucX11Window*  self = (lucX11Window*)window;
-
-	/* Run the parent function to destroy window... */
-	_lucWindow_Destroy(window, data);	
-
-	if (self->win) 
-		lucX11Window_CloseInteractiveWindow( self );
-	else
-		lucX11Window_CloseBackgroundWindow( self );
-
-	/* Close glx window */
-	XFree( self->vi );
-	self->vi = 0;
-
-	if (self->glxcontext) 
-	   glXDestroyContext( self->display,  self->glxcontext);
-	self->glxcontext = 0;
-
-	XSetCloseDownMode( self->display,  DestroyAll);
-	XCloseDisplay( self->display );
-	self->display = 0;
-
-	/* Moved from _Delete */
-	Memory_Free( self->displayName );
-	Memory_Free( self->host );
-
-	lucDebug_PrintFunctionEnd( self, 1 );
-}
-
-/* Window Virtuals */
-void _lucX11Window_Display( void* window ) {
-	lucX11Window*        self = (lucX11Window*) window; 
-
-	/* Run the parent function to display window... */
-	lucWindow_Display(window);	
-
-	/* Swap buffers if interactive */
-	if ( self->isMaster && self->doubleBuffer && self->interactive)
-		glXSwapBuffers(self->display, self->win);
-}
-
-int _lucX11Window_EventsWaiting( void* window )
-{
-	lucX11Window*  self = (lucX11Window*)window;
-	return XPending(self->display);
-}
-
-Bool _lucX11Window_EventProcessor( void* window ) {
-	lucX11Window*  self = (lucX11Window*)window;
-	KeySym         ks;
-	XEvent         event;
-	Atom           wmDeleteWindow;
-	static unsigned int button = 0;
-	static Bool visible = True;
-	Bool redisplay = True;
-
-	lucDebug_PrintFunctionBegin( self, 1 );
-	
-	/* Avoid busy wait loop by using blocking event check 
-	   (signal callback wakes every few seconds to check idle timeout) */
-	XNextEvent(self->display, &event);
-
-	/* Reset idle timer */
-	lucWindow_IdleReset(window);
-	
-	switch (event.type) {
-		case ButtonPress:
-			button = event.xbutton.button;
-    		lucWindow_MouseClick( self, button, event.type, event.xmotion.x, self->height - event.xmotion.y);
-	    	break;
-		case MotionNotify:
-			lucWindow_MouseMotion( self, button , event.xmotion.x, self->height - event.xmotion.y);
-    		break;
-		case KeyPress:
-			ks = XLookupKeysym((XKeyEvent *) & event, 0);
-			lucWindow_KeyboardEvent( self, ks, event.xkey.x, self->height - event.xkey.y);
-			break;
-    	case ClientMessage:
-			if (event.xclient.data.l[0] == self->wmDeleteWindow)
-				lucWindow_ToggleApplicationQuit( window );
-			break;
-		case MapNotify:
- 			/* Window shown */
-			if (!visible) lucWindow_SetViewportNeedsToDrawFlag( window, True );
-			visible = True;
-			break;
-		case UnmapNotify:
-			/* Window hidden, iconized */
-			visible = False;
-			lucWindow_SetViewportNeedsToDrawFlag( window, True );
- 			break;
-   		case ConfigureNotify:
-        {
-			/* Notification of window actions, including resize */
-    		redisplay = lucWindow_SetSize( self, event.xconfigure.width, event.xconfigure.height);
-    		break;
-        }
-		default:
-			redisplay = False;
-	}
-
-    if (!self->interactive) self->resized = True;  /* Flag mode switch required */
-	
-	/* Returns true if display refresh required */
-	return redisplay;
-}
-
-void _lucX11Window_Resize( void* window ) {
-	lucX11Window*        self = (lucX11Window*) window; 
-
-    /* Master window resized? Create new background pixmap of required size */
-    if (self->interactive && !self->isMaster)
-    {
-      lucX11Window_CloseBackgroundWindow( self );
-      lucX11Window_CreateBackgroundWindow( self );
-    }
-
-	/* Close window and create background window if switched out of interactive mode */
-	if (!self->interactive)
-	{
-      lucX11Window_CloseInteractiveWindow( self );
-      lucX11Window_CreateBackgroundWindow( self );
-		self->quitEventLoop = True;
-	}
-
-	/* Run the parent function to resize window... */
-	lucWindow_Resize(window);	
-}
-
-Bool lucX11Window_CreateDisplay( void* window )  {
-	lucX11Window*  self      = (lucX11Window*)window;
-	static int configuration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
-			GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None};
-	static int alphaConfiguration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
-			GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, None}; 
-   int* config = alphaConfiguration;
-
-	/*********************** Create Display ******************************/
-	self->display = XOpenDisplay(NULL);
-	if (self->display == NULL) {
-		Journal_Printf( lucError, "In func %s: Function XOpenDisplay(NULL) returned NULL\n", __func__);
-
-		/* Second Try */
-		self->display = XOpenDisplay(self->displayName);
-		if (self->display == NULL) {
-			Journal_Printf( lucError, "In func %s: Function XOpenDisplay(%s) didn't work.\n", __func__ , self->displayName);
-		
-			/* Third Try */
-			self->display = XOpenDisplay(":0.0");
-			if (self->display == NULL) {
-				Journal_Printf( lucError, "In func %s: Function XOpenDisplay(\":0.0\") returned NULL\n", __func__);
-
-				return False;
-			}
-		}
-	}
-	
-	/* Check to make sure display we've just opened has a glx extension */
-	if (!glXQueryExtension(self->display, NULL, NULL)) {
-		Journal_Printf( lucError,"In func %s: X server has no OpenGL GLX extension\n", __func__);
-		return False;
-	}
-
-	/* find an OpenGL-capable display - trying different configurations if nessesary */
-   /* Note: only attempt to get double buffered visuals when in interactive mode */
-   self->vi = NULL;
-   if (self->interactive)
-   	self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), config);
-	self->doubleBuffer = True;
-	if (self->vi == NULL) {
-		Journal_Printf( lucError, "In func %s: Couldn't open RGBA Double Buffer display\n", __func__);
-		self->vi = glXChooseVisual( self->display, DefaultScreen( self->display), config + 1);
-		self->doubleBuffer = False;
-	}
-	if (self->interactive && self->vi == NULL) {
-		Journal_Printf( lucError, "In func %s: Couldn't open RGBA display\n", __func__);
-		self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &configuration[0]);
-		self->doubleBuffer = True;
-	}
-	if (self->vi == NULL) {
-		Journal_Printf( lucError, "In func %s: Couldn't open Double Buffer display\n", __func__);
-		self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &configuration[1]);
-		self->doubleBuffer = False;
-	}
-	if (self->vi == NULL) {
-		Journal_Printf( lucError, "In func %s: Couldn't open display\n", __func__);
-		return False;
-	}
-
-	return True;
-}
-
-Bool lucX11Window_CreateContext( void* window, Bool direct )  {
-	lucX11Window*  self      = (lucX11Window*)window;
-
-	if (self->glxcontext)
-		glXDestroyContext( self->display,  self->glxcontext);
-	
-	/* Create an OpenGL rendering context */
-	self->glxcontext = glXCreateContext(self->display, self->vi, NULL, direct); 
-	if (self->glxcontext == NULL) {
-		Journal_Printf(  lucError, "In func %s: Could not create GLX rendering context.\n", __func__);
-		return False;
-	}
-
-    if (glXIsDirect(self->display, self->glxcontext))
-		Journal_DPrintf( lucDebug, "GLX: Direct Rendering enabled.\n");
-    else
-        Journal_DPrintf( lucDebug, "GLX: Sorry, no Direct Rendering possible\n");
-
-	return True;
-}
-
-void lucX11Window_CreateBackgroundWindow( void* window )  {
-	lucX11Window*  self         = (lucX11Window*)window;
-	
-	lucDebug_PrintFunctionBegin( self, 1 );
-
-	/* Create rendering context, direct rendering disabled */
-	lucX11Window_CreateContext(self, False);
-	
-	/* Create Pixmap Window */
-	self->pmap = XCreatePixmap(
-			self->display,
-			RootWindow(self->display, self->vi->screen ), 
-			self->width, 
-			self->height,
-			self->vi->depth );
-	
-	self->glxpmap = glXCreateGLXPixmap( self->display,  self->vi, self->pmap );
-	if (glXMakeCurrent( self->display, self->glxpmap, self->glxcontext) == False)
-		Journal_Printf( lucError, "In func %s: glXMakeCurrent failed\n", __func__);
-		
-	lucDebug_PrintFunctionEnd( self, 1 );
-}
-
-
-void lucX11Window_CreateInteractiveWindow( void* window ) {
-	lucX11Window*        self         = (lucX11Window*)window;
-	Colormap             cmap;
-	XSetWindowAttributes swa;
-	XWMHints *           wmHints;
-	XSizeHints *		 sHints;
-	
-	lucDebug_PrintFunctionBegin( self, 1 );
-
-	/* Create rendering context, direct rendering enabled */
-	lucX11Window_CreateContext(self, True);
-
-	/* Create Colourmap */
-	cmap = lucX11Window_GetShareableColormap( self );
-	swa.colormap = cmap;
-	swa.border_pixel = 0;
-	swa.event_mask = StructureNotifyMask | ButtonPressMask | ButtonMotionMask | KeyPressMask;
-
-	/* Setup window manager hints */
-	sHints = XAllocSizeHints();
-	wmHints = XAllocWMHints();
-
-    if ( sHints && wmHints) {
-        sHints->min_width = 32;
-        sHints->min_height = 32;
-        sHints->max_height = 4096;
-        sHints->max_width = 4096;
-
-		sHints->flags = PMaxSize | PMinSize | USPosition;
-        /* Center */
-	    sHints->x = (DisplayWidth(self->display, self->vi->screen) - self->width) / 2;
-		sHints->y = (DisplayHeight(self->display, self->vi->screen) - self->height) / 2;
-    
-
-		/* Create X window */
-		self->win = XCreateWindow(
-			self->display, 
-			RootWindow(self->display, self->vi->screen),
-			sHints->x,
-			sHints->y, 
-			self->width,
-			self->height, 
-			0,
-			self->vi->depth, 
-			InputOutput, 
-			self->vi->visual, 
-			CWBorderPixel | CWColormap | CWEventMask, 
-			&swa);
-
-		wmHints->initial_state = NormalState;
-		wmHints->flags = StateHint;
-
-		XTextProperty title;
-		XStringListToTextProperty(&self->title, 1, &title); 	/* argv, argc, normal_hints, wm_hints, class_hints */
-		XSetWMProperties(self->display, self->win, &title, &title, NULL, 0, sHints, wmHints, NULL);
-
-		self->wmDeleteWindow = XInternAtom(self->display, "WM_DELETE_WINDOW", True);
-		XSetWMProtocols(self->display, self->win, &self->wmDeleteWindow, 1);
-	
-		glXMakeCurrent( self->display, self->win, self->glxcontext);
-	
-		XMapRaised( self->display, self->win ); /* Show the window */
-
-        XFlush(self->display);  /* Flush output buffer */
-	}
-	else
-		abort();
-	
-	if (sHints) XFree(sHints);
-	if (wmHints) XFree(wmHints);
-	
-    /* Setup timer */
-    parent = (lucWindow*)window;	/* Save parent ref for signal handler... */
-    signal(SIGALRM, lucX11Window_Timer);
-    struct itimerval timerval;
-    timerval.it_value.tv_sec	= 1;
-    timerval.it_value.tv_usec	= 0;
-    timerval.it_interval = timerval.it_value;
-    setitimer(ITIMER_REAL, &timerval, NULL);
-
-	lucDebug_PrintFunctionEnd( self, 1 );
-}	
-
-Colormap lucX11Window_GetShareableColormap( lucX11Window* self ) {
-	Status             status;
-	XStandardColormap* standardCmaps;
-	Colormap           cmap;
-	int                i;
-	int                numCmaps;
-	
-	lucDebug_PrintFunctionBegin( self, 2 );
-	
-	/* be lazy; using DirectColor too involved for this example */
-	if (self->vi->class != TrueColor)
-		Journal_Printf( lucError, "No support for non-TrueColor visual.");
-	
-	/* if no standard colormap but TrueColor, just make an unshared one */
-	status = XmuLookupStandardColormap(self->display, self->vi->screen, self->vi->visualid,
-		self->vi->depth, XA_RGB_DEFAULT_MAP, /* replace */ False, /* retain */ True);
-		
-	if (status == 1) {
-		status = XGetRGBColormaps(self->display, RootWindow(self->display, self->vi->screen),
-			&standardCmaps, &numCmaps, XA_RGB_DEFAULT_MAP);
-	
-		if (status == 1)
-			for (i = 0; i < numCmaps; i++)
-				if (standardCmaps[i].visualid == self->vi->visualid) {
-					cmap = standardCmaps[i].colormap;
-					XFree(standardCmaps);
-					lucDebug_PrintFunctionEnd( self, 2 );
-					return cmap;
-				}
-	}
-	cmap = XCreateColormap(self->display, RootWindow(self->display, self->vi->screen), self->vi->visual, AllocNone);
-	
-	lucDebug_PrintFunctionEnd( self, 2 );
-	return cmap;
-}
-
-void lucX11Window_CloseInteractiveWindow( lucX11Window* self ) {
-	
-	lucDebug_PrintFunctionBegin( self, 1 );
-
-	XDestroyWindow( self->display , self->win );
-	self->win = 0;
-
-	lucDebug_PrintFunctionEnd( self, 1 );
-}
-	
-void lucX11Window_CloseBackgroundWindow( lucX11Window* self ) {
-
-	lucDebug_PrintFunctionBegin( self, 1 );
-
-	glXDestroyGLXPixmap(self->display, self->glxpmap);
-	self->glxpmap = 0;
-	XFreePixmap(self->display, self->pmap);
-	self->pmap = 0;
-
-	lucDebug_PrintFunctionEnd( self, 1 );
-}
-
-void lucX11Window_Timer( int x)
-{
-	if (parent->interactive)
-		lucWindow_IdleCheck(parent);
-	else
-	{
-		/* Remove timer */
-		struct itimerval timerval;
-		timerval.it_value.tv_sec = 0;
-		timerval.it_value.tv_usec = 0;
-		timerval.it_interval = timerval.it_value;
-		setitimer(ITIMER_REAL, &timerval, NULL);
-	}
-}
-
-int lucX11Window_Error(Display* display, XErrorEvent* error)
-{
-	char error_str[256];
-	XGetErrorText(display, error->error_code, error_str, 256);
-	Journal_DPrintf( lucError, "X11 Error: %d -> %s\n", error->error_code, error_str);
-}
-
-#endif
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef Windowing/src/X11Window.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Windowing/src/X11Window.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,611 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: X11Window.c 787 2008-08-26 07:57:24Z JulianGiordani $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+ 
+#ifdef HAVE_X11
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include <glucifer/Base/Base.h>
+
+#include "types.h"
+#include "X11Window.h"
+
+#include <assert.h>
+#ifdef __APPLE__
+#include <CoreServices/CoreServices.h>
+#endif
+
+#ifndef MASTER
+	#define MASTER 0
+#endif
+
+#include <signal.h>
+#include <sys/time.h>
+lucWindow* parent;	/* Need to save in global so signal handler for idle timer can access */
+
+/* Textual name of this class - This is a global pointer which is used for times when you need to refer to class and not a particular instance of a class */
+const Type lucX11Window_Type = "lucX11Window";
+
+/* Private Constructor: This will accept all the virtual functions for this class as arguments. */
+lucX11Window* _lucX11Window_New(  LUCX11WINDOW_DEFARGS  ) 
+{
+	lucX11Window*					self;
+
+	/* Call private constructor of parent - this will set virtual functions of parent and continue up the hierarchy tree. At the beginning of the tree it will allocate memory of the size of object and initialise all the memory to zero. */
+	assert( _sizeOfSelf >= sizeof(lucX11Window) );
+	self = (lucX11Window*) _lucWindow_New(  LUCWINDOW_PASSARGS  );
+	
+	return self;
+}
+
+void _lucX11Window_Init( 
+		lucX11Window*                                      self,
+		Name                                               host,
+		unsigned int                                       displayNumber,
+		unsigned int                                       displayScreen )
+{
+
+	/* Setup display name */
+	Stg_asprintf( &self->displayName, "%s:%u.%u", host, displayNumber, displayScreen );
+	self->host          = StG_Strdup( host );
+	self->displayNumber = displayNumber;
+	self->displayScreen = displayScreen;
+}
+
+void _lucX11Window_Delete( void* window ) {
+	_lucWindow_Delete( window );
+}
+
+void _lucX11Window_Print( void* window, Stream* stream ) {
+	lucX11Window*  self = (lucX11Window*)window;
+
+	_lucWindow_Print( self, stream );
+}
+
+void* _lucX11Window_Copy( void* window, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap) {
+	lucX11Window*  self = (lucX11Window*)window;
+	lucX11Window* newWindow;
+
+	newWindow = _lucWindow_Copy( self, dest, deep, nameExt, ptrMap );
+
+	/* TODO */
+	abort();
+
+	return (void*) newWindow;
+}
+
+
+void* _lucX11Window_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof(lucX11Window);
+	Type                                                      type = lucX11Window_Type;
+	Stg_Class_DeleteFunction*                              _delete = _lucX11Window_Delete;
+	Stg_Class_PrintFunction*                                _print = _lucX11Window_Print;
+	Stg_Class_CopyFunction*                                  _copy = NULL;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucX11Window_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucX11Window_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _lucX11Window_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _lucX11Window_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _lucX11Window_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _lucX11Window_Destroy;
+	lucWindow_DisplayFunction*                      _displayWindow = _lucX11Window_Display;
+	lucWindow_EventsWaitingFunction*                _eventsWaiting = _lucX11Window_EventsWaiting;
+	lucWindow_EventProcessorFunction*              _eventProcessor = _lucX11Window_EventProcessor;
+	lucWindow_ResizeFunction*                        _resizeWindow = _lucX11Window_Resize;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return (void*) _lucX11Window_New(  LUCX11WINDOW_PASSARGS  );
+}
+
+void _lucX11Window_AssignFromXML( void* window, Stg_ComponentFactory* cf, void* data ){
+	lucX11Window*  self = (lucX11Window*)window;
+
+	/* Construct Parent */
+	_lucWindow_AssignFromXML( self, cf, data ); 
+				
+	_lucX11Window_Init( 
+			self,
+			Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"host", "localhost"  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"displayNumber", 0  ),
+			Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"displayScreen", 0 )  );
+			
+			
+}
+
+void _lucX11Window_Build( void* window, void* data ) {
+	/* Run the parent function to build window... */
+	_lucWindow_Build(window, data);	
+}
+
+void _lucX11Window_Initialise( void* window, void* data ) {
+	lucX11Window*  self = (lucX11Window*)window;
+
+	lucDebug_PrintFunctionBegin( self, 1 );
+
+	XSetErrorHandler(lucX11Window_Error);
+	
+	Journal_Firewall(lucX11Window_CreateDisplay( self ),
+					 lucError,
+					 "Error in func '%s' for %s '%s': Cannot create display.\n", __func__, self->type, self->name );
+
+	if ( self->interactive && self->isMaster) {
+		Journal_DPrintf( lucDebug, "Opening Interactive window.\n");
+		lucX11Window_CreateInteractiveWindow( self );
+	}
+	else {
+		Journal_DPrintf( lucDebug, "Opening background window.\n");
+		lucX11Window_CreateBackgroundWindow( self );
+	}
+
+	/* Run the parent function to init window... */
+	_lucWindow_Initialise(window, data);
+
+	lucDebug_PrintFunctionEnd( self, 1 );
+}
+
+void _lucX11Window_Execute( void* window, void* data ) {
+	lucX11Window*        self = (lucX11Window*) window; 
+
+    /* Make sure we are using the correct context - for multiple windows */
+	if (self->interactive && self->isMaster)
+    {
+		glXMakeCurrent( self->display, self->win, self->glxcontext);
+      //XSetInputFocus(self->display, self->win, RevertToParent, CurrentTime);
+    }
+    else 
+        glXMakeCurrent( self->display, self->glxpmap, self->glxcontext);
+
+	/* Run the parent function to execute the window... */
+	_lucWindow_Execute(window, data);	
+}
+
+void _lucX11Window_Destroy( void* window, void* data ) {
+	lucX11Window*  self = (lucX11Window*)window;
+
+	/* Run the parent function to destroy window... */
+	_lucWindow_Destroy(window, data);	
+
+	if (self->win) 
+		lucX11Window_CloseInteractiveWindow( self );
+	else
+		lucX11Window_CloseBackgroundWindow( self );
+
+	/* Close glx window */
+	XFree( self->vi );
+	self->vi = 0;
+
+	if (self->glxcontext) 
+	   glXDestroyContext( self->display,  self->glxcontext);
+	self->glxcontext = 0;
+
+	XSetCloseDownMode( self->display,  DestroyAll);
+	XCloseDisplay( self->display );
+	self->display = 0;
+
+	/* Moved from _Delete */
+	Memory_Free( self->displayName );
+	Memory_Free( self->host );
+
+	lucDebug_PrintFunctionEnd( self, 1 );
+}
+
+/* Window Virtuals */
+void _lucX11Window_Display( void* window ) {
+	lucX11Window*        self = (lucX11Window*) window; 
+
+	/* Run the parent function to display window... */
+	lucWindow_Display(window);	
+
+	/* Swap buffers if interactive */
+	if ( self->isMaster && self->doubleBuffer && self->interactive)
+		glXSwapBuffers(self->display, self->win);
+}
+
+int _lucX11Window_EventsWaiting( void* window )
+{
+	lucX11Window*  self = (lucX11Window*)window;
+	return XPending(self->display);
+}
+
+Bool _lucX11Window_EventProcessor( void* window ) {
+	lucX11Window*  self = (lucX11Window*)window;
+	KeySym         ks;
+	XEvent         event;
+	Atom           wmDeleteWindow;
+	static unsigned int button = 0;
+	static Bool visible = True;
+	Bool redisplay = True;
+
+	lucDebug_PrintFunctionBegin( self, 1 );
+	
+	/* Avoid busy wait loop by using blocking event check 
+	   (signal callback wakes every few seconds to check idle timeout) */
+	XNextEvent(self->display, &event);
+
+	/* Reset idle timer */
+	lucWindow_IdleReset(window);
+	
+	switch (event.type) {
+		case ButtonPress:
+			button = event.xbutton.button;
+    		lucWindow_MouseClick( self, button, event.type, event.xmotion.x, self->height - event.xmotion.y);
+	    	break;
+		case MotionNotify:
+			lucWindow_MouseMotion( self, button , event.xmotion.x, self->height - event.xmotion.y);
+    		break;
+		case KeyPress:
+			ks = XLookupKeysym((XKeyEvent *) & event, 0);
+			lucWindow_KeyboardEvent( self, ks, event.xkey.x, self->height - event.xkey.y);
+			break;
+    	case ClientMessage:
+			if (event.xclient.data.l[0] == self->wmDeleteWindow)
+				lucWindow_ToggleApplicationQuit( window );
+			break;
+		case MapNotify:
+ 			/* Window shown */
+			if (!visible) lucWindow_SetViewportNeedsToDrawFlag( window, True );
+			visible = True;
+			break;
+		case UnmapNotify:
+			/* Window hidden, iconized */
+			visible = False;
+			lucWindow_SetViewportNeedsToDrawFlag( window, True );
+ 			break;
+   		case ConfigureNotify:
+        {
+			/* Notification of window actions, including resize */
+    		redisplay = lucWindow_SetSize( self, event.xconfigure.width, event.xconfigure.height);
+    		break;
+        }
+		default:
+			redisplay = False;
+	}
+
+    if (!self->interactive) self->resized = True;  /* Flag mode switch required */
+	
+	/* Returns true if display refresh required */
+	return redisplay;
+}
+
+void _lucX11Window_Resize( void* window ) {
+	lucX11Window*        self = (lucX11Window*) window; 
+
+    /* Master window resized? Create new background pixmap of required size */
+    if (self->interactive && !self->isMaster)
+    {
+      lucX11Window_CloseBackgroundWindow( self );
+      lucX11Window_CreateBackgroundWindow( self );
+    }
+
+	/* Close window and create background window if switched out of interactive mode */
+	if (!self->interactive)
+	{
+      lucX11Window_CloseInteractiveWindow( self );
+      lucX11Window_CreateBackgroundWindow( self );
+		self->quitEventLoop = True;
+	}
+
+	/* Run the parent function to resize window... */
+	lucWindow_Resize(window);	
+}
+
+Bool lucX11Window_CreateDisplay( void* window )  {
+	lucX11Window*  self      = (lucX11Window*)window;
+	static int configuration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
+			GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None};
+	static int alphaConfiguration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
+			GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, None}; 
+   int* config = alphaConfiguration;
+
+	/*********************** Create Display ******************************/
+	self->display = XOpenDisplay(NULL);
+	if (self->display == NULL) {
+		Journal_Printf( lucError, "In func %s: Function XOpenDisplay(NULL) returned NULL\n", __func__);
+
+		/* Second Try */
+		self->display = XOpenDisplay(self->displayName);
+		if (self->display == NULL) {
+			Journal_Printf( lucError, "In func %s: Function XOpenDisplay(%s) didn't work.\n", __func__ , self->displayName);
+		
+			/* Third Try */
+			self->display = XOpenDisplay(":0.0");
+			if (self->display == NULL) {
+				Journal_Printf( lucError, "In func %s: Function XOpenDisplay(\":0.0\") returned NULL\n", __func__);
+
+				return False;
+			}
+		}
+	}
+	
+	/* Check to make sure display we've just opened has a glx extension */
+	if (!glXQueryExtension(self->display, NULL, NULL)) {
+		Journal_Printf( lucError,"In func %s: X server has no OpenGL GLX extension\n", __func__);
+		return False;
+	}
+
+	/* find an OpenGL-capable display - trying different configurations if nessesary */
+   /* Note: only attempt to get double buffered visuals when in interactive mode */
+   self->vi = NULL;
+   if (self->interactive)
+   	self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), config);
+	self->doubleBuffer = True;
+	if (self->vi == NULL) {
+		Journal_Printf( lucError, "In func %s: Couldn't open RGBA Double Buffer display\n", __func__);
+		self->vi = glXChooseVisual( self->display, DefaultScreen( self->display), config + 1);
+		self->doubleBuffer = False;
+	}
+	if (self->interactive && self->vi == NULL) {
+		Journal_Printf( lucError, "In func %s: Couldn't open RGBA display\n", __func__);
+		self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &configuration[0]);
+		self->doubleBuffer = True;
+	}
+	if (self->vi == NULL) {
+		Journal_Printf( lucError, "In func %s: Couldn't open Double Buffer display\n", __func__);
+		self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &configuration[1]);
+		self->doubleBuffer = False;
+	}
+	if (self->vi == NULL) {
+		Journal_Printf( lucError, "In func %s: Couldn't open display\n", __func__);
+		return False;
+	}
+
+	return True;
+}
+
+Bool lucX11Window_CreateContext( void* window, Bool direct )  {
+	lucX11Window*  self      = (lucX11Window*)window;
+
+	if (self->glxcontext)
+		glXDestroyContext( self->display,  self->glxcontext);
+	
+	/* Create an OpenGL rendering context */
+	self->glxcontext = glXCreateContext(self->display, self->vi, NULL, direct); 
+	if (self->glxcontext == NULL) {
+		Journal_Printf(  lucError, "In func %s: Could not create GLX rendering context.\n", __func__);
+		return False;
+	}
+
+    if (glXIsDirect(self->display, self->glxcontext))
+		Journal_DPrintf( lucDebug, "GLX: Direct Rendering enabled.\n");
+    else
+        Journal_DPrintf( lucDebug, "GLX: Sorry, no Direct Rendering possible\n");
+
+	return True;
+}
+
+void lucX11Window_CreateBackgroundWindow( void* window )  {
+	lucX11Window*  self         = (lucX11Window*)window;
+	
+	lucDebug_PrintFunctionBegin( self, 1 );
+
+	/* Create rendering context, direct rendering disabled */
+	lucX11Window_CreateContext(self, False);
+	
+	/* Create Pixmap Window */
+	self->pmap = XCreatePixmap(
+			self->display,
+			RootWindow(self->display, self->vi->screen ), 
+			self->width, 
+			self->height,
+			self->vi->depth );
+	
+	self->glxpmap = glXCreateGLXPixmap( self->display,  self->vi, self->pmap );
+	if (glXMakeCurrent( self->display, self->glxpmap, self->glxcontext) == False)
+		Journal_Printf( lucError, "In func %s: glXMakeCurrent failed\n", __func__);
+		
+	lucDebug_PrintFunctionEnd( self, 1 );
+}
+
+
+void lucX11Window_CreateInteractiveWindow( void* window ) {
+	lucX11Window*        self         = (lucX11Window*)window;
+	Colormap             cmap;
+	XSetWindowAttributes swa;
+	XWMHints *           wmHints;
+	XSizeHints *		 sHints;
+	
+	lucDebug_PrintFunctionBegin( self, 1 );
+
+	/* Create rendering context, direct rendering enabled */
+	lucX11Window_CreateContext(self, True);
+
+	/* Create Colourmap */
+	cmap = lucX11Window_GetShareableColormap( self );
+	swa.colormap = cmap;
+	swa.border_pixel = 0;
+	swa.event_mask = StructureNotifyMask | ButtonPressMask | ButtonMotionMask | KeyPressMask;
+
+	/* Setup window manager hints */
+	sHints = XAllocSizeHints();
+	wmHints = XAllocWMHints();
+
+    if ( sHints && wmHints) {
+        sHints->min_width = 32;
+        sHints->min_height = 32;
+        sHints->max_height = 4096;
+        sHints->max_width = 4096;
+
+		sHints->flags = PMaxSize | PMinSize | USPosition;
+        /* Center */
+	    sHints->x = (DisplayWidth(self->display, self->vi->screen) - self->width) / 2;
+		sHints->y = (DisplayHeight(self->display, self->vi->screen) - self->height) / 2;
+    
+
+		/* Create X window */
+		self->win = XCreateWindow(
+			self->display, 
+			RootWindow(self->display, self->vi->screen),
+			sHints->x,
+			sHints->y, 
+			self->width,
+			self->height, 
+			0,
+			self->vi->depth, 
+			InputOutput, 
+			self->vi->visual, 
+			CWBorderPixel | CWColormap | CWEventMask, 
+			&swa);
+
+		wmHints->initial_state = NormalState;
+		wmHints->flags = StateHint;
+
+		XTextProperty title;
+		XStringListToTextProperty(&self->title, 1, &title); 	/* argv, argc, normal_hints, wm_hints, class_hints */
+		XSetWMProperties(self->display, self->win, &title, &title, NULL, 0, sHints, wmHints, NULL);
+
+		self->wmDeleteWindow = XInternAtom(self->display, "WM_DELETE_WINDOW", True);
+		XSetWMProtocols(self->display, self->win, &self->wmDeleteWindow, 1);
+	
+		glXMakeCurrent( self->display, self->win, self->glxcontext);
+	
+		XMapRaised( self->display, self->win ); /* Show the window */
+
+        XFlush(self->display);  /* Flush output buffer */
+	}
+	else
+		abort();
+	
+	if (sHints) XFree(sHints);
+	if (wmHints) XFree(wmHints);
+	
+    /* Setup timer */
+    parent = (lucWindow*)window;	/* Save parent ref for signal handler... */
+    signal(SIGALRM, lucX11Window_Timer);
+    struct itimerval timerval;
+    timerval.it_value.tv_sec	= 1;
+    timerval.it_value.tv_usec	= 0;
+    timerval.it_interval = timerval.it_value;
+    setitimer(ITIMER_REAL, &timerval, NULL);
+
+	lucDebug_PrintFunctionEnd( self, 1 );
+}	
+
+Colormap lucX11Window_GetShareableColormap( lucX11Window* self ) {
+	Status             status;
+	XStandardColormap* standardCmaps;
+	Colormap           cmap;
+	int                i;
+	int                numCmaps;
+	
+	lucDebug_PrintFunctionBegin( self, 2 );
+	
+	/* be lazy; using DirectColor too involved for this example */
+	if (self->vi->class != TrueColor)
+		Journal_Printf( lucError, "No support for non-TrueColor visual.");
+	
+	/* if no standard colormap but TrueColor, just make an unshared one */
+	status = XmuLookupStandardColormap(self->display, self->vi->screen, self->vi->visualid,
+		self->vi->depth, XA_RGB_DEFAULT_MAP, /* replace */ False, /* retain */ True);
+		
+	if (status == 1) {
+		status = XGetRGBColormaps(self->display, RootWindow(self->display, self->vi->screen),
+			&standardCmaps, &numCmaps, XA_RGB_DEFAULT_MAP);
+	
+		if (status == 1)
+			for (i = 0; i < numCmaps; i++)
+				if (standardCmaps[i].visualid == self->vi->visualid) {
+					cmap = standardCmaps[i].colormap;
+					XFree(standardCmaps);
+					lucDebug_PrintFunctionEnd( self, 2 );
+					return cmap;
+				}
+	}
+	cmap = XCreateColormap(self->display, RootWindow(self->display, self->vi->screen), self->vi->visual, AllocNone);
+	
+	lucDebug_PrintFunctionEnd( self, 2 );
+	return cmap;
+}
+
+void lucX11Window_CloseInteractiveWindow( lucX11Window* self ) {
+	
+	lucDebug_PrintFunctionBegin( self, 1 );
+
+	XDestroyWindow( self->display , self->win );
+	self->win = 0;
+
+	lucDebug_PrintFunctionEnd( self, 1 );
+}
+	
+void lucX11Window_CloseBackgroundWindow( lucX11Window* self ) {
+
+	lucDebug_PrintFunctionBegin( self, 1 );
+
+	glXDestroyGLXPixmap(self->display, self->glxpmap);
+	self->glxpmap = 0;
+	XFreePixmap(self->display, self->pmap);
+	self->pmap = 0;
+
+	lucDebug_PrintFunctionEnd( self, 1 );
+}
+
+void lucX11Window_Timer( int x)
+{
+	if (parent->interactive)
+		lucWindow_IdleCheck(parent);
+	else
+	{
+		/* Remove timer */
+		struct itimerval timerval;
+		timerval.it_value.tv_sec = 0;
+		timerval.it_value.tv_usec = 0;
+		timerval.it_interval = timerval.it_value;
+		setitimer(ITIMER_REAL, &timerval, NULL);
+	}
+}
+
+int lucX11Window_Error(Display* display, XErrorEvent* error)
+{
+	char error_str[256];
+	XGetErrorText(display, error->error_code, error_str, 256);
+	Journal_DPrintf( lucError, "X11 Error: %d -> %s\n", error->error_code, error_str);
+}
+
+#endif
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef libglucifer/src/Finalise.c
--- a/libglucifer/src/Finalise.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "glucifer.h"
-
-#include <stdio.h>
-
-Bool glucifer_Finalise( ) {
-	
-	lucWindowInteractions_Finalise();
-	lucInputFormats_Finalise();
-	lucOutputFormats_Finalise();
-	lucDrawingObjects_Finalise();
-	lucRenderingEngines_Finalise();
-	lucWindowing_Finalise();
-	lucBase_Finalise();
-	
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef libglucifer/src/Finalise.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libglucifer/src/Finalise.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,70 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Finalise.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "glucifer.h"
+
+#include <stdio.h>
+
+Bool glucifer_Finalise( ) {
+	
+	lucWindowInteractions_Finalise();
+	lucInputFormats_Finalise();
+	lucOutputFormats_Finalise();
+	lucDrawingObjects_Finalise();
+	lucRenderingEngines_Finalise();
+	lucWindowing_Finalise();
+	lucBase_Finalise();
+	
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef libglucifer/src/Init.c
--- a/libglucifer/src/Init.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-
-#include "glucifer.h"
-
-#include <stdio.h>
-
-Bool glucifer_Init() {
-	int tmp;
-	char* directory;
-
-	lucBase_Init();
-	lucWindowing_Init();
-	lucRenderingEngines_Init();
-	lucDrawingObjects_Init();
-	lucOutputFormats_Init();
-	lucInputFormats_Init();
-	lucWindowInteractions_Init();
-	
-	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
-	tmp = Stream_GetPrintingRank( Journal_Register( InfoStream_Type, (Name)"Context" )  );
-	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, (Name)"Context"  ), 0 );
-	Journal_Printf( /* DO NOT CHANGE OR REMOVE */
-		Journal_Register( InfoStream_Type, (Name)"Context"  ), 
-		"glucifer (Visualisation framework) revision %s. Copyright (C) 2005 Monash Cluster Computing.\n", VERSION );
-	Stream_Flush( Journal_Register( InfoStream_Type, (Name)"Context" )  );
-	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, (Name)"Context"  ), tmp );
-
-	/* Add the gLucifer path to the global xml path dictionary */
-	directory = Memory_Alloc_Array( char, 200, "xmlDirectory" ) ;
-	sprintf(directory, "%s%s", LIB_DIR, "/StGermain" );
-	XML_IO_Handler_AddDirectory( "gLucifer", directory );
-	Memory_Free(directory);
-
-	/* Add the plugin path to the global plugin list */
-	ModulesManager_AddDirectory( "gLucifer", LIB_DIR );
-
-	return True;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef libglucifer/src/Init.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libglucifer/src/Init.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,88 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: Init.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+
+#include "glucifer.h"
+
+#include <stdio.h>
+
+Bool glucifer_Init() {
+	int tmp;
+	char* directory;
+
+	lucBase_Init();
+	lucWindowing_Init();
+	lucRenderingEngines_Init();
+	lucDrawingObjects_Init();
+	lucOutputFormats_Init();
+	lucInputFormats_Init();
+	lucWindowInteractions_Init();
+	
+	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
+	tmp = Stream_GetPrintingRank( Journal_Register( InfoStream_Type, (Name)"Context" )  );
+	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, (Name)"Context"  ), 0 );
+	Journal_Printf( /* DO NOT CHANGE OR REMOVE */
+		Journal_Register( InfoStream_Type, (Name)"Context"  ), 
+		"glucifer (Visualisation framework) revision %s. Copyright (C) 2005 Monash Cluster Computing.\n", VERSION );
+	Stream_Flush( Journal_Register( InfoStream_Type, (Name)"Context" )  );
+	Stream_SetPrintingRank( Journal_Register( InfoStream_Type, (Name)"Context"  ), tmp );
+
+	/* Add the gLucifer path to the global xml path dictionary */
+	directory = Memory_Alloc_Array( char, 200, "xmlDirectory" ) ;
+	sprintf(directory, "%s%s", LIB_DIR, "/StGermain" );
+	XML_IO_Handler_AddDirectory( "gLucifer", directory );
+	Memory_Free(directory);
+
+	/* Add the plugin path to the global plugin list */
+	ModulesManager_AddDirectory( "gLucifer", LIB_DIR );
+
+	return True;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef plugins/lucPlugin/lucPlugin.c
--- a/plugins/lucPlugin/lucPlugin.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,282 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: lucPlugin.c 756 2008-02-12 00:28:41Z DavidMay $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/glucifer.h>
-
-
-const Type LucPlugin_Type = "LucPlugin";
-
-
-/** Special run function which replaces the abstract context's normal one */
-void lucPlugin_VisualOnlyRun( Context* _context ) {
-	DomainContext*  context = (DomainContext*)_context;
-	double                  dtLoadedFromFile = 0;
-	Index                   fieldVar_I;
-	FieldVariable*          fieldVar;
-	Swarm_Register*         swarm_Register = Swarm_Register_GetSwarm_Register();
-	Swarm*                  swarm;
-	Index                   swarm_I;
-	
-	Journal_Printf( context->info, "** Running in visualOnly mode**\n" );
-
-	if (context->maxTimeSteps) {
-		Journal_Printf( context->info, "Visualise timestep data until %u timeSteps have been run\n", context->maxTimeSteps );
-	}
-	if (context->finalTimeStep ) {
-		if (context->maxTimeSteps ) {
-			Journal_Printf( context->info, "or " );
-		}	
-		else {
-			Journal_Printf( context->info, "visualise " );
-		}
-		Journal_Printf( context->info, "until absolute time step %u reached\n", context->stopTime );
-	}
-	
-	if (context->stopTime) {
-		if (context->maxTimeSteps || context->finalTimeStep ) {
-			Journal_Printf( context->info, "or " );
-		}	
-		else {
-			Journal_Printf( context->info, "Visualise " );
-		}
-		Journal_Printf( context->info, "until simulation time passes %g.\n", context->stopTime );
-	}
-	
-	context->timeStepSinceJobRestart = 1;
-
-	if ( False == context->loadFromCheckPoint ) { 
-		context->timeStep = 0;
-		/* Need to ensure restart mode enabled so the swarms & feVariables do the appropriate
-		checkpoint loading stuff in their initialisation phase */
-		context->loadFromCheckPoint = True;
-		context->restartTimestep = 0;
-		/* Need to set the swarm particle layout types now */
-		for ( swarm_I = 0; swarm_I < swarm_Register->swarmList->count; swarm_I++ ) {
-
-			swarm = Swarm_Register_At( swarm_Register, swarm_I );
-			
-			if ( True == swarm->isSwarmTypeToCheckPointAndReload ) {
-				Swarm_ReplaceCurrentParticleLayoutWithFileParticleLayout( swarm, context );
-			}
-		}	
-	}
-
-	context->timeStep++;
-	context->restartTimestep++;
-	Dictionary_Set( context->dictionary, (Dictionary_Entry_Key)"restartTimestep", Dictionary_Entry_Value_FromUnsignedInt( context->restartTimestep ) );
-
-	while (1 ) {
-		/* If this checkpoint actually exists for this timestep, load it & possibly vis. it */
-		if ( True == AbstractContext_CheckPointExists( context, context->timeStep ) ) {
-			/* Note : always load timeInfo (currentTime) from file as we aren't solving anything,
-			but may want to visualise currentTime. */
-			_AbstractContext_LoadTimeInfoFromCheckPoint( (AbstractContext*)context, context->timeStep,
-				&dtLoadedFromFile );
-			/* We ignore dt, as this is the dt checkpointed to use for the _next_ timestep, so we
-			 * don't want it to change the currentTime calculation for this timestep */
-
-			/* Instead of solve here, re-load from checkpoint anything necessary to visualise results */
-			
-			for ( swarm_I = 0; swarm_I < swarm_Register->swarmList->count; swarm_I++ ) {
-
-				swarm = Swarm_Register_At( swarm_Register, swarm_I );
-				
-				if ( True == swarm->isSwarmTypeToCheckPointAndReload ) {
-               char*  swarmFileName     = NULL;
-               char*  swarmFileNamePart = NULL;
-
-					Stg_CheckType( swarm->particleLayout, FileParticleLayout );
-
-               swarmFileNamePart = Context_GetCheckPointReadPrefixString( (AbstractContext*)context );
-               #ifdef READ_HDF5
-                  Stg_asprintf( &swarmFileName, "%s%s.%05d", swarmFileNamePart, swarm->name, context->restartTimestep );
-               #else
-                  Stg_asprintf( &swarmFileName, "%s%s.%05d.dat", swarmFileNamePart, swarm->name, context->restartTimestep );
-               #endif
-               
-					((FileParticleLayout*)swarm->particleLayout)->filename         = swarmFileName;
-					/* set to one incase reading ascii */
-					((FileParticleLayout*)swarm->particleLayout)->checkpointfiles = 1;
-					/* now check if using hdf5 */ 
-					#ifdef READ_HDF5
-					((FileParticleLayout*)swarm->particleLayout)->checkpointfiles = _FileParticleLayout_GetFileCountFromTimeInfoFile( context );
-				        #endif
-					/* Need to re-build & initialise the particles in case the number of particles changed
-					due to pop. control */
-					Memory_Free( swarm->cellParticleCountTbl );
-					Memory_Free( swarm->cellParticleSizeTbl );
-					Memory_Free( swarm->cellParticleTbl );
-					ExtensionManager_Free( swarm->particleExtensionMgr, swarm->particles );
-					_Swarm_BuildParticles( swarm, context );
-					_Swarm_InitialiseParticles( swarm, context );
-
-               Memory_Free( swarmFileName );
-               Memory_Free( swarmFileNamePart );               
-				}
-			}	
-
-			/* Re-initialise each fieldVariable - which will automatically load the checkpointed values for
-			current timestep as a initial condition */
-			for ( fieldVar_I = 0; fieldVar_I < context->fieldVariable_Register->objects->count; fieldVar_I++ ) {
-				fieldVar = FieldVariable_Register_GetByIndex( context->fieldVariable_Register, fieldVar_I );
-
-				if ( Stg_Class_IsInstance( fieldVar, FieldVariable_Type ) ) {
-					/* Note: will automatically update fieldVariable checkpoint file name
-					based on context passed in */
-					Stg_Component_Initialise( fieldVar, context, True );
-				}
-			}	
-
-			/* We allow re-doing of frequent output if user forgot to add all their freq. output
-				plugins the first time round */
-			if ( context->frequentOutputEvery ) {
-				if ( context->timeStep % context->frequentOutputEvery == 0 )
-					AbstractContext_FrequentOutput( context );
-			}	
-			if ( context->dumpEvery ) {
-				if ( context->timeStep % context->dumpEvery == 0 )
-					AbstractContext_Dump( context );
-			}	
-		}
-
-		if (context->maxTimeSteps && (context->timeStepSinceJobRestart >= context->maxTimeSteps)) break;
-		if (context->finalTimeStep && (context->timeStep >= context->finalTimeStep)) break;
-		if (context->stopTime && (context->currentTime >= context->stopTime)) break; 
-		context->timeStep++;
-		context->timeStepSinceJobRestart++;
-		/* Need to do this to fool the checkpoint loading functions, eg the Swarm's, to load the
-		   correct timestep's data */
-		context->restartTimestep++;
-	}
-}
-
-
-void _lucPlugin_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
-	Codelet*	self		= (Codelet*)component;
-	Dictionary*	pluginDict	= Codelet_GetPluginDictionary( component, cf->rootDict );
-
-	AbstractContext* context;
-
-	context = (AbstractContext*)Stg_ComponentFactory_ConstructByName( cf, Dictionary_GetString( pluginDict, (Dictionary_Entry_Key)"Context"  ), AbstractContext, True, data );
-	self->context = context;
-	//glucifer_Init();
-
-	if ( Dictionary_GetBool( context->dictionary, "printGluciferComponents" ) ) {
-		Journal_Printf( lucInfo, "\nPossible Windows are:\n" );
-		PrintChildren( lucWindow_Type, lucInfo );
-
-		Journal_Printf( lucInfo, "\nPossible Drawing Objects are:\n" );
-		PrintChildren( lucDrawingObject_Type, lucInfo );
-		
-		Journal_Printf( lucInfo, "\nPossible Output Formats are:\n" );
-		PrintChildren( lucOutputFormat_Type, lucInfo );
-		
-		Journal_Printf( lucInfo, "\nPossible Input Formats are:\n" );
-		PrintChildren( lucInputFormat_Type, lucInfo );
-		
-		Journal_Printf( lucInfo, "\nPossible Rendering Engines are:\n" );
-		PrintChildren( lucRenderingEngine_Type, lucInfo );
-		
-		Journal_Printf( lucInfo, "\nPossible Window Interactions are:\n" );
-		PrintChildren( lucWindowInteraction_Type, lucInfo );
-		exit(EXIT_SUCCESS);
-	}
-
-	ContextEP_Prepend( context, AbstractContext_EP_DestroyExtensions, glucifer_Finalise );
-
-	/* This is a special option that will re-set the core behaviour of the code to do visualisation
-	   only - so assumes you are using --restartTimestep=X to visualise one of your previously calculated
-	   results.
-	   TODO: assumes the gLucifer plugin is loaded last to a certain extent.
-	   TODO: may want an option to only reload certain feVariables needed by visualisation */
-	if ( True == Dictionary_GetBool_WithDefault( context->dictionary, (Dictionary_Entry_Key)"visualOnlyOneTimestep", False )  ) {
-		Stream* errorStream = Journal_Register( Error_Type, (Name)LucPlugin_Type  );
-		Journal_Firewall( context->loadFromCheckPoint == True, errorStream,
-			"Error - in %s(): can only use gLucifer visualOnlyOneTimestep option if "
-			"loadFromCheckPoint mode enabled.\n", __func__ );
-		ContextEP_Purge( context, AbstractContext_EP_Execute );
-	}	
-	if ( True == Dictionary_GetBool_WithDefault( context->dictionary, (Dictionary_Entry_Key)"visualOnly", False )  ) {
-		ContextEP_ReplaceAll( context, AbstractContext_EP_Execute, lucPlugin_VisualOnlyRun );
-		
-	}	
-}
-
-
-void* _lucPlugin_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof( Codelet );
-	Type                                                      type = LucPlugin_Type;
-	Stg_Class_DeleteFunction*                              _delete = _Codelet_Delete;
-	Stg_Class_PrintFunction*                                _print = _Codelet_Print;
-	Stg_Class_CopyFunction*                                  _copy = _Codelet_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucPlugin_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _lucPlugin_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _Codelet_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _Codelet_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _Codelet_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _Codelet_Destroy;
-
-	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
-	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
-
-	return _Codelet_New(  CODELET_PASSARGS  );
-}
-
-
-Index lucPlugin_Register( PluginsManager* pluginsManager ) {
-	Index result;
-
-	glucifer_Init();
-	result = PluginsManager_Submit( pluginsManager, LucPlugin_Type, (Name)"0", _lucPlugin_DefaultNew  );
-
-	return result;
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef plugins/lucPlugin/lucPlugin.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/lucPlugin/lucPlugin.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,282 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: lucPlugin.c 756 2008-02-12 00:28:41Z DavidMay $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/glucifer.h>
+
+
+const Type LucPlugin_Type = "LucPlugin";
+
+
+/** Special run function which replaces the abstract context's normal one */
+void lucPlugin_VisualOnlyRun( Context* _context ) {
+	DomainContext*  context = (DomainContext*)_context;
+	double                  dtLoadedFromFile = 0;
+	Index                   fieldVar_I;
+	FieldVariable*          fieldVar;
+	Swarm_Register*         swarm_Register = Swarm_Register_GetSwarm_Register();
+	Swarm*                  swarm;
+	Index                   swarm_I;
+	
+	Journal_Printf( context->info, "** Running in visualOnly mode**\n" );
+
+	if (context->maxTimeSteps) {
+		Journal_Printf( context->info, "Visualise timestep data until %u timeSteps have been run\n", context->maxTimeSteps );
+	}
+	if (context->finalTimeStep ) {
+		if (context->maxTimeSteps ) {
+			Journal_Printf( context->info, "or " );
+		}	
+		else {
+			Journal_Printf( context->info, "visualise " );
+		}
+		Journal_Printf( context->info, "until absolute time step %u reached\n", context->stopTime );
+	}
+	
+	if (context->stopTime) {
+		if (context->maxTimeSteps || context->finalTimeStep ) {
+			Journal_Printf( context->info, "or " );
+		}	
+		else {
+			Journal_Printf( context->info, "Visualise " );
+		}
+		Journal_Printf( context->info, "until simulation time passes %g.\n", context->stopTime );
+	}
+	
+	context->timeStepSinceJobRestart = 1;
+
+	if ( False == context->loadFromCheckPoint ) { 
+		context->timeStep = 0;
+		/* Need to ensure restart mode enabled so the swarms & feVariables do the appropriate
+		checkpoint loading stuff in their initialisation phase */
+		context->loadFromCheckPoint = True;
+		context->restartTimestep = 0;
+		/* Need to set the swarm particle layout types now */
+		for ( swarm_I = 0; swarm_I < swarm_Register->swarmList->count; swarm_I++ ) {
+
+			swarm = Swarm_Register_At( swarm_Register, swarm_I );
+			
+			if ( True == swarm->isSwarmTypeToCheckPointAndReload ) {
+				Swarm_ReplaceCurrentParticleLayoutWithFileParticleLayout( swarm, context );
+			}
+		}	
+	}
+
+	context->timeStep++;
+	context->restartTimestep++;
+	Dictionary_Set( context->dictionary, (Dictionary_Entry_Key)"restartTimestep", Dictionary_Entry_Value_FromUnsignedInt( context->restartTimestep ) );
+
+	while (1 ) {
+		/* If this checkpoint actually exists for this timestep, load it & possibly vis. it */
+		if ( True == AbstractContext_CheckPointExists( context, context->timeStep ) ) {
+			/* Note : always load timeInfo (currentTime) from file as we aren't solving anything,
+			but may want to visualise currentTime. */
+			_AbstractContext_LoadTimeInfoFromCheckPoint( (AbstractContext*)context, context->timeStep,
+				&dtLoadedFromFile );
+			/* We ignore dt, as this is the dt checkpointed to use for the _next_ timestep, so we
+			 * don't want it to change the currentTime calculation for this timestep */
+
+			/* Instead of solve here, re-load from checkpoint anything necessary to visualise results */
+			
+			for ( swarm_I = 0; swarm_I < swarm_Register->swarmList->count; swarm_I++ ) {
+
+				swarm = Swarm_Register_At( swarm_Register, swarm_I );
+				
+				if ( True == swarm->isSwarmTypeToCheckPointAndReload ) {
+               char*  swarmFileName     = NULL;
+               char*  swarmFileNamePart = NULL;
+
+					Stg_CheckType( swarm->particleLayout, FileParticleLayout );
+
+               swarmFileNamePart = Context_GetCheckPointReadPrefixString( (AbstractContext*)context );
+               #ifdef READ_HDF5
+                  Stg_asprintf( &swarmFileName, "%s%s.%05d", swarmFileNamePart, swarm->name, context->restartTimestep );
+               #else
+                  Stg_asprintf( &swarmFileName, "%s%s.%05d.dat", swarmFileNamePart, swarm->name, context->restartTimestep );
+               #endif
+               
+					((FileParticleLayout*)swarm->particleLayout)->filename         = swarmFileName;
+					/* set to one incase reading ascii */
+					((FileParticleLayout*)swarm->particleLayout)->checkpointfiles = 1;
+					/* now check if using hdf5 */ 
+					#ifdef READ_HDF5
+					((FileParticleLayout*)swarm->particleLayout)->checkpointfiles = _FileParticleLayout_GetFileCountFromTimeInfoFile( context );
+				        #endif
+					/* Need to re-build & initialise the particles in case the number of particles changed
+					due to pop. control */
+					Memory_Free( swarm->cellParticleCountTbl );
+					Memory_Free( swarm->cellParticleSizeTbl );
+					Memory_Free( swarm->cellParticleTbl );
+					ExtensionManager_Free( swarm->particleExtensionMgr, swarm->particles );
+					_Swarm_BuildParticles( swarm, context );
+					_Swarm_InitialiseParticles( swarm, context );
+
+               Memory_Free( swarmFileName );
+               Memory_Free( swarmFileNamePart );               
+				}
+			}	
+
+			/* Re-initialise each fieldVariable - which will automatically load the checkpointed values for
+			current timestep as a initial condition */
+			for ( fieldVar_I = 0; fieldVar_I < context->fieldVariable_Register->objects->count; fieldVar_I++ ) {
+				fieldVar = FieldVariable_Register_GetByIndex( context->fieldVariable_Register, fieldVar_I );
+
+				if ( Stg_Class_IsInstance( fieldVar, FieldVariable_Type ) ) {
+					/* Note: will automatically update fieldVariable checkpoint file name
+					based on context passed in */
+					Stg_Component_Initialise( fieldVar, context, True );
+				}
+			}	
+
+			/* We allow re-doing of frequent output if user forgot to add all their freq. output
+				plugins the first time round */
+			if ( context->frequentOutputEvery ) {
+				if ( context->timeStep % context->frequentOutputEvery == 0 )
+					AbstractContext_FrequentOutput( context );
+			}	
+			if ( context->dumpEvery ) {
+				if ( context->timeStep % context->dumpEvery == 0 )
+					AbstractContext_Dump( context );
+			}	
+		}
+
+		if (context->maxTimeSteps && (context->timeStepSinceJobRestart >= context->maxTimeSteps)) break;
+		if (context->finalTimeStep && (context->timeStep >= context->finalTimeStep)) break;
+		if (context->stopTime && (context->currentTime >= context->stopTime)) break; 
+		context->timeStep++;
+		context->timeStepSinceJobRestart++;
+		/* Need to do this to fool the checkpoint loading functions, eg the Swarm's, to load the
+		   correct timestep's data */
+		context->restartTimestep++;
+	}
+}
+
+
+void _lucPlugin_AssignFromXML( void* component, Stg_ComponentFactory* cf, void* data ) {
+	Codelet*	self		= (Codelet*)component;
+	Dictionary*	pluginDict	= Codelet_GetPluginDictionary( component, cf->rootDict );
+
+	AbstractContext* context;
+
+	context = (AbstractContext*)Stg_ComponentFactory_ConstructByName( cf, Dictionary_GetString( pluginDict, (Dictionary_Entry_Key)"Context"  ), AbstractContext, True, data );
+	self->context = context;
+	//glucifer_Init();
+
+	if ( Dictionary_GetBool( context->dictionary, "printGluciferComponents" ) ) {
+		Journal_Printf( lucInfo, "\nPossible Windows are:\n" );
+		PrintChildren( lucWindow_Type, lucInfo );
+
+		Journal_Printf( lucInfo, "\nPossible Drawing Objects are:\n" );
+		PrintChildren( lucDrawingObject_Type, lucInfo );
+		
+		Journal_Printf( lucInfo, "\nPossible Output Formats are:\n" );
+		PrintChildren( lucOutputFormat_Type, lucInfo );
+		
+		Journal_Printf( lucInfo, "\nPossible Input Formats are:\n" );
+		PrintChildren( lucInputFormat_Type, lucInfo );
+		
+		Journal_Printf( lucInfo, "\nPossible Rendering Engines are:\n" );
+		PrintChildren( lucRenderingEngine_Type, lucInfo );
+		
+		Journal_Printf( lucInfo, "\nPossible Window Interactions are:\n" );
+		PrintChildren( lucWindowInteraction_Type, lucInfo );
+		exit(EXIT_SUCCESS);
+	}
+
+	ContextEP_Prepend( context, AbstractContext_EP_DestroyExtensions, glucifer_Finalise );
+
+	/* This is a special option that will re-set the core behaviour of the code to do visualisation
+	   only - so assumes you are using --restartTimestep=X to visualise one of your previously calculated
+	   results.
+	   TODO: assumes the gLucifer plugin is loaded last to a certain extent.
+	   TODO: may want an option to only reload certain feVariables needed by visualisation */
+	if ( True == Dictionary_GetBool_WithDefault( context->dictionary, (Dictionary_Entry_Key)"visualOnlyOneTimestep", False )  ) {
+		Stream* errorStream = Journal_Register( Error_Type, (Name)LucPlugin_Type  );
+		Journal_Firewall( context->loadFromCheckPoint == True, errorStream,
+			"Error - in %s(): can only use gLucifer visualOnlyOneTimestep option if "
+			"loadFromCheckPoint mode enabled.\n", __func__ );
+		ContextEP_Purge( context, AbstractContext_EP_Execute );
+	}	
+	if ( True == Dictionary_GetBool_WithDefault( context->dictionary, (Dictionary_Entry_Key)"visualOnly", False )  ) {
+		ContextEP_ReplaceAll( context, AbstractContext_EP_Execute, lucPlugin_VisualOnlyRun );
+		
+	}	
+}
+
+
+void* _lucPlugin_DefaultNew( Name name ) {
+	/* Variables set in this function */
+	SizeT                                              _sizeOfSelf = sizeof( Codelet );
+	Type                                                      type = LucPlugin_Type;
+	Stg_Class_DeleteFunction*                              _delete = _Codelet_Delete;
+	Stg_Class_PrintFunction*                                _print = _Codelet_Print;
+	Stg_Class_CopyFunction*                                  _copy = _Codelet_Copy;
+	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _lucPlugin_DefaultNew;
+	Stg_Component_ConstructFunction*                    _construct = _lucPlugin_AssignFromXML;
+	Stg_Component_BuildFunction*                            _build = _Codelet_Build;
+	Stg_Component_InitialiseFunction*                  _initialise = _Codelet_Initialise;
+	Stg_Component_ExecuteFunction*                        _execute = _Codelet_Execute;
+	Stg_Component_DestroyFunction*                        _destroy = _Codelet_Destroy;
+
+	/* Variables that are set to ZERO are variables that will be set either by the current _New function or another parent _New function further up the hierachy */
+	AllocationType  nameAllocationType = NON_GLOBAL /* default value NON_GLOBAL */;
+
+	return _Codelet_New(  CODELET_PASSARGS  );
+}
+
+
+Index lucPlugin_Register( PluginsManager* pluginsManager ) {
+	Index result;
+
+	glucifer_Init();
+	result = PluginsManager_Submit( pluginsManager, LucPlugin_Type, (Name)"0", _lucPlugin_DefaultNew  );
+
+	return result;
+}
+
+
diff -r 4eb4b2385be0 -r 2c1a490240ef src/main.c
--- a/src/main.c	Fri Nov 12 16:02:26 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-** Copyright (c) 2005, Monash Cluster Computing 
-** All rights reserved.
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-**
-** 		* Redistributions of source code must retain the above copyright notice, 
-** 			this list of conditions and the following disclaimer.
-** 		* Redistributions in binary form must reproduce the above copyright 
-**			notice, this list of conditions and the following disclaimer in the 
-**			documentation and/or other materials provided with the distribution.
-** 		* Neither the name of the Monash University nor the names of its contributors 
-**			may be used to endorse or promote products derived from this software 
-**			without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
-** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
-** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-**
-** Contact:
-*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
-*%
-** Contributors:
-*+		Cecile Duboz
-*+		Robert Turnbull
-*+		Alan Lo
-*+		Louis Moresi
-*+		David Stegman
-*+		David May
-*+		Stevan Quenette
-*+		Patrick Sunter
-*+		Greg Watson
-*+
-** $Id: main.c 750 2007-10-29 10:32:39Z RobertTurnbull $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-
-#ifdef HAVE_PYTHON
-#include <Python.h>
-#endif
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <glucifer/glucifer.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-int main( int argc, char* argv[] ) {
-	MPI_Comm               CommWorld;
-	int                    rank;
-	int                    numProcessors;
-	Dictionary*            dictionary;
-	XML_IO_Handler*        ioHandler;
-	DomainContext* context         = NULL;
-	
-	/* Initialise PETSc, get world info */
-	MPI_Init( &argc, &argv );
-	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
-	MPI_Comm_size( CommWorld, &numProcessors );
-	MPI_Comm_rank( CommWorld, &rank );
-	
-	StGermain_Init( &argc, &argv );
-	glucifer_Init();
-	#ifdef HAVE_PYTHON
-	Py_Initialize();
-	#endif
-
-	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
-	
-	/* Create the application's dictionary */
-	dictionary = Dictionary_New();
-
-	/* Read input */
-	ioHandler = XML_IO_Handler_New();
-	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
-	Journal_ReadFromDictionary( dictionary );
-
-	/* Construction phase -----------------------------------------------------------------------------------------------*/
-	context = DomainContext_New( "context", 0, 0, CommWorld, dictionary );
-	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, True	);
-
-	if( rank == 0 ) 
-		Context_PrintConcise( context, context->verbose );
-
-	if ( True == Dictionary_GetBool_WithDefault( dictionary, (Dictionary_Entry_Key)"showJournalStatus", False ) ) {
-		Journal_PrintConcise( );	
-	}			
-
-	/* Building phase ---------------------------------------------------------------------------------------------------*/
-	Stg_Component_Build( context, 0 /* dummy */, False );
-	
-	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
-	Stg_Component_Initialise( context, 0 /* dummy */, False );
-	
-	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
-	AbstractContext_Dump( context );
-	
-	/* Destruct phase ---------------------------------------------------------------------------------------------------*/
-	Stg_Component_Destroy( context, 0 /* dummy */, False );
-	Stg_Class_Delete( context );
-	Stg_Class_Delete( dictionary );
-
-	#ifdef HAVE_PYTHON
-	Py_Finalize();
-	#endif
-
-	lucBase_Finalise();
-	StGermain_Finalise();
-		
-	/* Close off MPI */
-	MPI_Finalize();
-	
-	return 0; /* success */
-}
-
-
diff -r 4eb4b2385be0 -r 2c1a490240ef src/main.cxx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main.cxx	Thu May 12 11:23:36 2011 -0700
@@ -0,0 +1,130 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** Copyright (c) 2005, Monash Cluster Computing 
+** All rights reserved.
+** Redistribution and use in source and binary forms, with or without modification,
+** are permitted provided that the following conditions are met:
+**
+** 		* Redistributions of source code must retain the above copyright notice, 
+** 			this list of conditions and the following disclaimer.
+** 		* Redistributions in binary form must reproduce the above copyright 
+**			notice, this list of conditions and the following disclaimer in the 
+**			documentation and/or other materials provided with the distribution.
+** 		* Neither the name of the Monash University nor the names of its contributors 
+**			may be used to endorse or promote products derived from this software 
+**			without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
+** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
+** OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+**
+**
+** Contact:
+*%		Cecile Duboz - Cecile.Duboz at sci.monash.edu.au
+*%
+** Contributors:
+*+		Cecile Duboz
+*+		Robert Turnbull
+*+		Alan Lo
+*+		Louis Moresi
+*+		David Stegman
+*+		David May
+*+		Stevan Quenette
+*+		Patrick Sunter
+*+		Greg Watson
+*+
+** $Id: main.c 750 2007-10-29 10:32:39Z RobertTurnbull $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+
+#ifdef HAVE_PYTHON
+#include <Python.h>
+#endif
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <glucifer/glucifer.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+int main( int argc, char* argv[] ) {
+	MPI_Comm               CommWorld;
+	int                    rank;
+	int                    numProcessors;
+	Dictionary*            dictionary;
+	XML_IO_Handler*        ioHandler;
+	DomainContext* context         = NULL;
+	
+	/* Initialise PETSc, get world info */
+	MPI_Init( &argc, &argv );
+	MPI_Comm_dup( MPI_COMM_WORLD, &CommWorld );
+	MPI_Comm_size( CommWorld, &numProcessors );
+	MPI_Comm_rank( CommWorld, &rank );
+	
+	StGermain_Init( &argc, &argv );
+	glucifer_Init();
+	#ifdef HAVE_PYTHON
+	Py_Initialize();
+	#endif
+
+	MPI_Barrier( CommWorld ); /* Ensures copyright info always come first in output */
+	
+	/* Create the application's dictionary */
+	dictionary = Dictionary_New();
+
+	/* Read input */
+	ioHandler = XML_IO_Handler_New();
+	IO_Handler_ReadAllFromCommandLine( ioHandler, argc, argv, dictionary );
+	Journal_ReadFromDictionary( dictionary );
+
+	/* Construction phase -----------------------------------------------------------------------------------------------*/
+	context = DomainContext_New( "context", 0, 0, CommWorld, dictionary );
+	Stg_Component_AssignFromXML( context, 0 /* dummy */, &context, True	);
+
+	if( rank == 0 ) 
+		Context_PrintConcise( context, context->verbose );
+
+	if ( True == Dictionary_GetBool_WithDefault( dictionary, (Dictionary_Entry_Key)"showJournalStatus", False ) ) {
+		Journal_PrintConcise( );	
+	}			
+
+	/* Building phase ---------------------------------------------------------------------------------------------------*/
+	Stg_Component_Build( context, 0 /* dummy */, False );
+	
+	/* Initialisaton phase ----------------------------------------------------------------------------------------------*/
+	Stg_Component_Initialise( context, 0 /* dummy */, False );
+	
+	/* Run (Solve) phase ------------------------------------------------------------------------------------------------*/
+	AbstractContext_Dump( context );
+	
+	/* Destruct phase ---------------------------------------------------------------------------------------------------*/
+	Stg_Component_Destroy( context, 0 /* dummy */, False );
+	Stg_Class_Delete( context );
+	Stg_Class_Delete( dictionary );
+
+	#ifdef HAVE_PYTHON
+	Py_Finalize();
+	#endif
+
+	lucBase_Finalise();
+	StGermain_Finalise();
+		
+	/* Close off MPI */
+	MPI_Finalize();
+	
+	return 0; /* success */
+}
+
+



More information about the CIG-COMMITS mailing list