[cig-commits] commit: Rename PressureTemperatureOutput to TracerOutput and make it more userfriendly

Mercurial hg at geodynamics.org
Fri May 6 14:05:56 PDT 2011


changeset:   860:d795d40fd164
tag:         tip
user:        Walter Landry <wlandry at caltech.edu>
date:        Fri May 06 14:03:37 2011 -0700
files:       Utils/src/Init.c Utils/src/PressureTemperatureOutput.c Utils/src/PressureTemperatureOutput.h Utils/src/PressureTemperatureOutput.meta Utils/src/TracerOutput.c Utils/src/TracerOutput.h Utils/src/TracerOutput.meta Utils/src/Utils.h Utils/src/types.h Utils/tests/testPressureTemperatureOutput.0of1.sh Utils/tests/testPressureTemperatureOutput.0of2.sh Utils/tests/testPressureTemperatureOutput.xml
description:
Rename PressureTemperatureOutput to TracerOutput and make it more userfriendly


diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/Init.c
--- a/Utils/src/Init.c	Fri Nov 12 16:01:56 2010 -0800
+++ b/Utils/src/Init.c	Fri May 06 14:03:37 2011 -0700
@@ -69,7 +69,7 @@ Bool Underworld_Utils_Init( int* argc, c
 	Journal_Printf( Journal_Register( DebugStream_Type, (Name)"Context"  ), "In: %s\n", __func__ ); /* DO NOT CHANGE OR REMOVE */
 	
 	Stg_ComponentRegister_Add( componentRegister, UnderworldContext_Type, (Name)"0", _UnderworldContext_DefaultNew  );
-	Stg_ComponentRegister_Add( componentRegister, PressureTemperatureOutput_Type, (Name)"0", _PressureTemperatureOutput_DefaultNew  );
+	Stg_ComponentRegister_Add( componentRegister, TracerOutput_Type, (Name)"0", _TracerOutput_DefaultNew  );
 	Stg_ComponentRegister_Add( componentRegister, Underworld_SwarmOutput_Type, (Name)"0", _Underworld_SwarmOutput_DefaultNew  );
 	Stg_ComponentRegister_Add( componentRegister, RadiogenicHeatingTerm_Type, (Name)"0", _RadiogenicHeatingTerm_DefaultNew  );
 	Stg_ComponentRegister_Add( componentRegister, StressField_Type , (Name)"0", _StressField_DefaultNew  );
@@ -85,7 +85,7 @@ Bool Underworld_Utils_Init( int* argc, c
                                    (Name)"0", _StressBC_DefaultNew );
 
 	RegisterParent( UnderworldContext_Type,       	    PICelleratorContext_Type );
-	RegisterParent( PressureTemperatureOutput_Type,     SwarmOutput_Type );
+	RegisterParent( TracerOutput_Type,     SwarmOutput_Type );
 	RegisterParent( Underworld_SwarmOutput_Type,        SwarmOutput_Type );
 	RegisterParent( RadiogenicHeatingTerm_Type,         ForceTerm_Type );
 	RegisterParent( StressField_Type,                   ParticleFeVariable_Type );
diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/PressureTemperatureOutput.c
--- a/Utils/src/PressureTemperatureOutput.c	Fri Nov 12 16:01:56 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,251 +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:
-*%		Louis Moresi - Louis.Moresi at sci.monash.edu.au
-*%
-** Contributors:
-*+		Robert Turnbull
-*+		Vincent Lemiale
-*+		Louis Moresi
-*+		David May
-*+		David Stegman
-*+		Mirko Velic
-*+		Patrick Sunter
-*+		Julian Giordani
-*+
-** $Id: PressureTemperatureOutput.c 610 2007-10-11 08:09:29Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#include <mpi.h>
-#include <StGermain/StGermain.h>
-#include <StgDomain/StgDomain.h>
-#include <StgFEM/StgFEM.h>
-#include <PICellerator/PICellerator.h>
-
-#include "types.h"
-#include "PressureTemperatureOutput.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 PressureTemperatureOutput_Type = "PressureTemperatureOutput";
-
-/*----------------------------------------------------------------------------------------------------------------------------------
-** Constructors
-*/
-PressureTemperatureOutput* PressureTemperatureOutput_New(
-		Name                                  name,
-		TimeIntegrator*                       timeIntegrator,
-		FeVariable*                           velocityField )
-{
-	PressureTemperatureOutput* self = (PressureTemperatureOutput*) _PressureTemperatureOutput_DefaultNew( name );
-
-	/* 	PressureTemperatureOutput_InitAll */
-	abort();
-
-	return self;
-}
-
-PressureTemperatureOutput* _PressureTemperatureOutput_New(  PRESSURETEMPERATUREOUTPUT_DEFARGS  )
-{
-	PressureTemperatureOutput* 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(PressureTemperatureOutput) );
-	self = (PressureTemperatureOutput*)_SwarmOutput_New(  SWARMOUTPUT_PASSARGS  );
-
-	
-	/* General info */
-
-	/* Virtual Info */
-	
-	return self;
-}
-
-void _PressureTemperatureOutput_Init( 
-		void*                                 swarmOutput,
-		FeVariable*                           pressureField,
-		FeVariable*                           temperatureField )
-{
-	PressureTemperatureOutput*   self                = (PressureTemperatureOutput*)swarmOutput;
-
-	self->pressureField      = pressureField;
-	self->temperatureField   = temperatureField;
-}
-
-
-/*------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _PressureTemperatureOutput_Delete( void* swarmOutput ) {
-	PressureTemperatureOutput* self = (PressureTemperatureOutput*)swarmOutput;
-
-	/* Delete parent */
-	_SwarmOutput_Delete( self );
-}
-
-
-void _PressureTemperatureOutput_Print( void* swarmOutput, Stream* stream ) {
-	PressureTemperatureOutput* self = (PressureTemperatureOutput*)swarmOutput;
-	
-	/* Print parent */
-	_SwarmOutput_Print( self, stream );
-}
-
-void* _PressureTemperatureOutput_Copy( void* swarmOutput, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	PressureTemperatureOutput*	self = (PressureTemperatureOutput*)swarmOutput;
-	PressureTemperatureOutput*	newPressureTemperatureOutput;
-	
-	newPressureTemperatureOutput = (PressureTemperatureOutput*)_SwarmOutput_Copy( self, dest, deep, nameExt, ptrMap );
-	
-	return (void*)newPressureTemperatureOutput;
-}
-
-void* _PressureTemperatureOutput_DefaultNew( Name name ) {
-	/* Variables set in this function */
-	SizeT                                              _sizeOfSelf = sizeof(PressureTemperatureOutput);
-	Type                                                      type = PressureTemperatureOutput_Type;
-	Stg_Class_DeleteFunction*                              _delete = _PressureTemperatureOutput_Delete;
-	Stg_Class_PrintFunction*                                _print = _PressureTemperatureOutput_Print;
-	Stg_Class_CopyFunction*                                  _copy = _PressureTemperatureOutput_Copy;
-	Stg_Component_DefaultConstructorFunction*  _defaultConstructor = _PressureTemperatureOutput_DefaultNew;
-	Stg_Component_ConstructFunction*                    _construct = _PressureTemperatureOutput_AssignFromXML;
-	Stg_Component_BuildFunction*                            _build = _PressureTemperatureOutput_Build;
-	Stg_Component_InitialiseFunction*                  _initialise = _PressureTemperatureOutput_Initialise;
-	Stg_Component_ExecuteFunction*                        _execute = _PressureTemperatureOutput_Execute;
-	Stg_Component_DestroyFunction*                        _destroy = _PressureTemperatureOutput_Destroy;
-	SwarmOutput_PrintHeaderFunction*                  _printHeader = _PressureTemperatureOutput_PrintHeader;
-	SwarmOutput_PrintDataFunction*                      _printData = _PressureTemperatureOutput_PrintData;
-
-	/* 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*) _PressureTemperatureOutput_New(  PRESSURETEMPERATUREOUTPUT_PASSARGS  );
-}
-
-
-void _PressureTemperatureOutput_AssignFromXML( void* swarmOutput, Stg_ComponentFactory* cf, void* data ) {
-	PressureTemperatureOutput*  self          = (PressureTemperatureOutput*) swarmOutput;
-	FeVariable*                 pressureField;
-	FeVariable*                 temperatureField;
-
-	_SwarmOutput_AssignFromXML( self, cf, data );
-
-	pressureField    = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"PressureField", FeVariable, True, data  ) ;
-	temperatureField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"TemperatureField", FeVariable, True, data  ) ;
-
-	_PressureTemperatureOutput_Init( self, pressureField, temperatureField );
-
-}
-
-void _PressureTemperatureOutput_Build( void* swarmOutput, void* data ) {
-	PressureTemperatureOutput*	self = (PressureTemperatureOutput*) swarmOutput;
-
-	Stg_Component_Build( self->pressureField, data, False );
-	Stg_Component_Build( self->temperatureField, data, False );
-
-	_SwarmOutput_Build( self, data );
-}
-void _PressureTemperatureOutput_Initialise( void* swarmOutput, void* data ) {
-	PressureTemperatureOutput*	self = (PressureTemperatureOutput*) swarmOutput;
-
-	Stg_Component_Initialise( self->pressureField, data, False );
-	Stg_Component_Initialise( self->temperatureField, data, False );
-	
-	_SwarmOutput_Initialise( self, data );
-}
-void _PressureTemperatureOutput_Execute( void* swarmOutput, void* data ) {
-	PressureTemperatureOutput*	self = (PressureTemperatureOutput*)swarmOutput;
-	
-	_SwarmOutput_Execute( self, data );
-}
-void _PressureTemperatureOutput_Destroy( void* swarmOutput, void* data ) {
-	PressureTemperatureOutput*	self = (PressureTemperatureOutput*)swarmOutput;
-
-	Stg_Component_Destroy( self->pressureField, data, False );
-	Stg_Component_Destroy( self->temperatureField, data, False );
-	
-	_SwarmOutput_Destroy( self, data );
-}
-
-void _PressureTemperatureOutput_PrintHeader( void* swarmOutput, Stream* stream, Particle_Index lParticle_I, void* context ){
-	PressureTemperatureOutput*	self = (PressureTemperatureOutput*)swarmOutput;
-	
-	_SwarmOutput_PrintHeader( self, stream, lParticle_I, context );
-	
-	SwarmOutput_PrintString( self, stream, "Pressure" );
-	SwarmOutput_PrintString( self, stream, "Temperature" );
-}
-
-void _PressureTemperatureOutput_PrintData( void* swarmOutput, Stream* stream, Particle_Index lParticle_I, void* context ){
-	PressureTemperatureOutput*	self                = (PressureTemperatureOutput*)swarmOutput;
-         FiniteElementContext*          fe_context          = (FiniteElementContext*) context;
-	Swarm*                      swarm               = self->swarm;
-	GlobalParticle*           particle            = (GlobalParticle*)Swarm_ParticleAt( swarm, lParticle_I );
-	double*                     coord               = particle->coord;
-        HydrostaticTerm *hydrostaticTerm;
-	double                      pressure;
-	double                      temperature;
-
-       hydrostaticTerm =
-       (HydrostaticTerm*)LiveComponentRegister_Get(fe_context->CF->LCRegister,"hydrostaticTerm" );
-
-	Journal_Firewall(
-		swarm->particleLayout->coordSystem == GlobalCoordSystem,
-		Journal_MyStream( Error_Type, self ),
-		"Swarm is not using global coord system! Modify this code to use both systems\n" );
-
-	_SwarmOutput_PrintData( self, stream, lParticle_I, context );
-
-	FieldVariable_InterpolateValueAt( self->pressureField,    coord, &pressure );
-	FieldVariable_InterpolateValueAt( self->temperatureField, coord, &temperature );
-                 if(hydrostaticTerm){
-                          pressure+=HydrostaticTerm_Pressure(hydrostaticTerm,coord);
-                    }
-	
-	SwarmOutput_PrintValue( self, stream, pressure );
-	SwarmOutput_PrintValue( self, stream, temperature );
-}
-
-/*-------------------------------------------------------------------------------------------------------------------------
-** Private Functions
-*/
-/*---------------------------------------------------------------------------------------------------------------------
-** Entry Point Hooks
-*/
-
-/*-------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-
-
diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/PressureTemperatureOutput.h
--- a/Utils/src/PressureTemperatureOutput.h	Fri Nov 12 16:01:56 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +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:
-*%		Louis Moresi - Louis.Moresi at sci.monash.edu.au
-*%
-** Contributors:
-*+		Robert Turnbull
-*+		Vincent Lemiale
-*+		Louis Moresi
-*+		David May
-*+		David Stegman
-*+		Mirko Velic
-*+		Patrick Sunter
-*+		Julian Giordani
-*+
-** $Id: PressureTemperatureOutput.h 354 2006-10-12 08:19:27Z SteveQuenette $
-** 
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-
-
-#ifndef __Underworld_Utils_PressureTemperatureOutput_h__
-#define __Underworld_Utils_PressureTemperatureOutput_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 */
-	extern const Type PressureTemperatureOutput_Type;
-
-	/* PressureTemperatureOutput information */
-	#define __PressureTemperatureOutput \
-		/* Macro defining parent goes here - This means you can cast this class as its parent */ \
-		__SwarmOutput \
-		/* Virtual Info */\
-		FeVariable*                                       pressureField;                \
-		FeVariable*                                       temperatureField;             \
-
-	struct PressureTemperatureOutput { __PressureTemperatureOutput };
-	
-	/*---------------------------------------------------------------------------------------------------------------------
-	** Constructors
-	*/
-	
-	#ifndef ZERO
-	#define ZERO 0
-	#endif
-
-	#define PRESSURETEMPERATUREOUTPUT_DEFARGS \
-                SWARMOUTPUT_DEFARGS
-
-	#define PRESSURETEMPERATUREOUTPUT_PASSARGS \
-                SWARMOUTPUT_PASSARGS
-
-	PressureTemperatureOutput* _PressureTemperatureOutput_New(  PRESSURETEMPERATUREOUTPUT_DEFARGS  );
-
-	/* Stg_Class_Delete PressureTemperatureOutput implementation */
-	void _PressureTemperatureOutput_Delete( void* swarmOutput );
-	void _PressureTemperatureOutput_Print( void* swarmOutput, Stream* stream );
-	#define PressureTemperatureOutput_Copy( self ) \
-		(PressureTemperatureOutput*) Stg_Class_Copy( self, NULL, False, NULL, NULL )
-	#define PressureTemperatureOutput_DeepCopy( self ) \
-		(PressureTemperatureOutput*) Stg_Class_Copy( self, NULL, True, NULL, NULL )
-	void* _PressureTemperatureOutput_Copy( void* swarmOutput, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
-	
-	void* _PressureTemperatureOutput_DefaultNew( Name name ) ;
-void _PressureTemperatureOutput_AssignFromXML( void* shape, Stg_ComponentFactory* cf, void* data ) ;
-	void _PressureTemperatureOutput_Build( void* swarmOutput, void* data ) ;
-	void _PressureTemperatureOutput_Initialise( void* swarmOutput, void* data ) ;
-	void _PressureTemperatureOutput_Execute( void* swarmOutput, void* data );
-	void _PressureTemperatureOutput_Destroy( void* swarmOutput, void* data ) ;
-	
-	void _PressureTemperatureOutput_PrintHeader( void* swarmOutput, Stream* stream, Particle_Index lParticle_I, void* context );
-	void _PressureTemperatureOutput_PrintData( void* swarmOutput, Stream* stream, Particle_Index lParticle_I, void* context );
-		
-	/*---------------------------------------------------------------------------------------------------------------------
-	** Private functions
-	*/
-	
-	/*---------------------------------------------------------------------------------------------------------------------
-	** Entry Point Hooks
-	*/
-	
-	/*---------------------------------------------------------------------------------------------------------------------
-	** Public functions
-	*/
-	
-#endif 
-
diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/PressureTemperatureOutput.meta
--- a/Utils/src/PressureTemperatureOutput.meta	Fri Nov 12 16:01:56 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
-<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
-
-<param name="Name">PressureTemperatureOutput</param>
-<param name="Author">...</param>
-<param name="Organisation">MCC</param>
-<param name="Project">Underworld</param>
-<param name="Location">./Underworld/Utils/src/</param>
-<param name="Project Web">http://www.mcc.monash.edu.au/Software/Underworld</param>
-<param name="Copyright">Copyright (c) 2005, Monash Cluster Computing</param>
-<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
-<param name="Parent">SwarmOutput</param>
-<param name="Reference">...</param>
-<param name="Summary">...</param>
-<param name="Description">This component prints out the temperature and pressure values on a swarm</param>
-
-<!--Now the interesting stuff-->
-
-<list name="Params">
-
-</list>
-
-<list name="Dependencies">
-	<struct>
-		<param name="Essential">True</param>
-		<param name="Name">PressureField</param>
-		<param name="Type">FeVariable</param>
-		<param name="Description">The pressure field whose value will be evaluated at swarm points</param>
-	</struct>
-
-	<struct>
-		<param name="Essential">True</param>
-		<param name="Name">TemperatureField</param>
-		<param name="Type">FeVariable</param>
-		<param name="Description">The temperature field whose value will be evaluated at swarm points</param>
-	</struct>
-
-</list>
-<!-- Add an exmaple XML if possible -->
-<param name="Example">
-<![CDATA[
-	<struct name="swarmOutput">
-		<param name="Type">PressureTemperatureOutput</param>
-		<param name="Swarm">swarm</param>
-		<param name="PressureField">PressureField</param>
-		<param name="TemperatureField">TemperatureField</param>
-	</struct>
-]]>
-</param>
-
-</StGermainData>
diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/TracerOutput.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/src/TracerOutput.c	Fri May 06 14:03:37 2011 -0700
@@ -0,0 +1,290 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** 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:
+*%		Louis Moresi - Louis.Moresi at sci.monash.edu.au
+*%
+** Contributors:
+*+		Robert Turnbull
+*+		Vincent Lemiale
+*+		Louis Moresi
+*+		David May
+*+		David Stegman
+*+		Mirko Velic
+*+		Patrick Sunter
+*+		Julian Giordani
+*+
+** $Id: TracerOutput.c 610 2007-10-11 08:09:29Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgDomain/StgDomain.h>
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/PICellerator.h>
+
+#include "types.h"
+#include "TracerOutput.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 TracerOutput_Type = "TracerOutput";
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+TracerOutput* TracerOutput_New(Name name,
+                               TimeIntegrator* timeIntegrator,
+                               FeVariable* velocityField )
+{
+  TracerOutput* self = (TracerOutput*) _TracerOutput_DefaultNew( name );
+
+  /* 	TracerOutput_InitAll */
+  abort();
+
+  return self;
+}
+
+TracerOutput* _TracerOutput_New(  TRACEROUTPUT_DEFARGS  )
+{
+  TracerOutput* 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(TracerOutput) );
+  self = (TracerOutput*)_SwarmOutput_New(  SWARMOUTPUT_PASSARGS  );
+
+  /* General info */
+
+  /* Virtual Info */
+	
+  return self;
+}
+
+void _TracerOutput_Init(void*                                 swarmOutput,
+                        FeVariable*                           pressureField,
+                        FeVariable**                           fields,
+                        unsigned int num_fields)
+{
+  TracerOutput*   self                = (TracerOutput*)swarmOutput;
+
+  self->pressureField      = pressureField;
+  self->num_fields=num_fields;
+  self->fields=Memory_Alloc_Array( FeVariable*, num_fields, "fields" );
+  memcpy( self->fields, fields, num_fields * sizeof(FeVariable*) );
+}
+
+
+/*------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _TracerOutput_Delete( void* swarmOutput ) {
+  TracerOutput* self = (TracerOutput*)swarmOutput;
+
+  Memory_Free(self->fields);
+  _SwarmOutput_Delete( self );
+}
+
+
+void _TracerOutput_Print( void* swarmOutput, Stream* stream ) {
+  TracerOutput* self = (TracerOutput*)swarmOutput;
+	
+  /* Print parent */
+  _SwarmOutput_Print( self, stream );
+}
+
+void* _TracerOutput_Copy( void* swarmOutput, void* dest, Bool deep,
+                          Name nameExt, PtrMap* ptrMap ) {
+  TracerOutput*	self = (TracerOutput*)swarmOutput;
+  TracerOutput*	newTracerOutput;
+	
+  newTracerOutput = (TracerOutput*)_SwarmOutput_Copy( self, dest, deep, nameExt, ptrMap );
+  memcpy(newTracerOutput->fields, self->fields,
+         self->num_fields * sizeof(FeVariable*) );
+  newTracerOutput->num_fields = self->num_fields;
+	
+  return (void*)newTracerOutput;
+}
+
+void* _TracerOutput_DefaultNew( Name name ) {
+  /* Variables set in this function */
+  SizeT _sizeOfSelf = sizeof(TracerOutput);
+  Type type = TracerOutput_Type;
+  Stg_Class_DeleteFunction* _delete = _TracerOutput_Delete;
+  Stg_Class_PrintFunction* _print = _TracerOutput_Print;
+  Stg_Class_CopyFunction* _copy = _TracerOutput_Copy;
+  Stg_Component_DefaultConstructorFunction* _defaultConstructor
+    = _TracerOutput_DefaultNew;
+  Stg_Component_ConstructFunction* _construct = _TracerOutput_AssignFromXML;
+  Stg_Component_BuildFunction* _build = _TracerOutput_Build;
+  Stg_Component_InitialiseFunction* _initialise = _TracerOutput_Initialise;
+  Stg_Component_ExecuteFunction* _execute = _TracerOutput_Execute;
+  Stg_Component_DestroyFunction* _destroy = _TracerOutput_Destroy;
+  SwarmOutput_PrintHeaderFunction* _printHeader = _TracerOutput_PrintHeader;
+  SwarmOutput_PrintDataFunction* _printData = _TracerOutput_PrintData;
+
+  /* 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*) _TracerOutput_New(  TRACEROUTPUT_PASSARGS  );
+}
+
+
+void _TracerOutput_AssignFromXML( void* swarmOutput,
+                                  Stg_ComponentFactory* cf, void* data ) {
+  TracerOutput*  self          = (TracerOutput*) swarmOutput;
+  FeVariable*                 pressureField;
+  FeVariable**                 fields;
+  unsigned int num_fields;
+
+  _SwarmOutput_AssignFromXML( self, cf, data );
+
+  pressureField =
+    Stg_ComponentFactory_ConstructByKey(cf, self->name,
+                                        (Dictionary_Entry_Key)"PressureField",
+                                        FeVariable, False, data) ;
+  
+  fields=Stg_ComponentFactory_ConstructByList(cf,self->name,
+                                              (Dictionary_Entry_Key)"Fields",
+                                              Stg_ComponentFactory_Unlimited,
+                                              FeVariable,False,&num_fields,data);
+
+  _TracerOutput_Init(self,pressureField,fields,num_fields);
+
+  Memory_Free(fields);
+}
+
+void _TracerOutput_Build( void* swarmOutput, void* data ) {
+  int i;
+  TracerOutput*	self = (TracerOutput*) swarmOutput;
+
+  Stg_Component_Build( self->pressureField, data, False );
+  for(i=0;i<self->num_fields;++i)
+    Stg_Component_Build( self->fields[i], data, False );
+
+  _SwarmOutput_Build( self, data );
+}
+void _TracerOutput_Initialise( void* swarmOutput, void* data ) {
+  int i;
+  TracerOutput*	self = (TracerOutput*) swarmOutput;
+
+  Stg_Component_Initialise( self->pressureField, data, False );
+  for(i=0;i<self->num_fields;++i)
+    Stg_Component_Initialise( self->fields[i], data, False );
+	
+  _SwarmOutput_Initialise( self, data );
+}
+void _TracerOutput_Execute( void* swarmOutput, void* data ) {
+  TracerOutput*	self = (TracerOutput*)swarmOutput;
+	
+  _SwarmOutput_Execute( self, data );
+}
+void _TracerOutput_Destroy( void* swarmOutput, void* data ) {
+  int i;
+  TracerOutput*	self = (TracerOutput*)swarmOutput;
+
+  Stg_Component_Destroy( self->pressureField, data, False );
+  for(i=0;i<self->num_fields;++i)
+    Stg_Component_Destroy( self->fields[i], data, False );
+	
+  _SwarmOutput_Destroy( self, data );
+}
+
+void _TracerOutput_PrintHeader( void* swarmOutput, Stream* stream,
+                                Particle_Index lParticle_I, void* context ){
+  int i;
+  char name[32];
+  TracerOutput*	self = (TracerOutput*)swarmOutput;
+	
+  Stream_Enable(stream,True);
+  _SwarmOutput_PrintHeader( self, stream, lParticle_I, context );
+	
+  SwarmOutput_PrintString( self, stream, "Pressure" );
+  for(i=0;i<self->num_fields;++i)
+    {
+      sprintf(name,"Field%d",i);
+      SwarmOutput_PrintString( self, stream, name );
+    }
+}
+
+void _TracerOutput_PrintData( void* swarmOutput, Stream* stream,
+                              Particle_Index lParticle_I, void* context ){
+  TracerOutput*	self = (TracerOutput*)swarmOutput;
+  FiniteElementContext* fe_context = (FiniteElementContext*) context;
+  Swarm* swarm = self->swarm;
+  GlobalParticle* particle = (GlobalParticle*)Swarm_ParticleAt(swarm,
+                                                               lParticle_I);
+  double* coord = particle->coord;
+  HydrostaticTerm *hydrostaticTerm;
+  double pressure, field;
+  int i;
+
+  hydrostaticTerm =
+    (HydrostaticTerm*)LiveComponentRegister_Get(fe_context->CF->LCRegister,
+                                                "hydrostaticTerm" );
+
+  Journal_Firewall(swarm->particleLayout->coordSystem == GlobalCoordSystem,
+                   Journal_MyStream( Error_Type, self ),
+                   "Swarm is not using global coord system! Modify this code to use both systems\n" );
+
+  _SwarmOutput_PrintData( self, stream, lParticle_I, context );
+
+  FieldVariable_InterpolateValueAt(self->pressureField,coord,&pressure );
+  if(hydrostaticTerm){
+    pressure+=HydrostaticTerm_Pressure(hydrostaticTerm,coord);
+  }
+  SwarmOutput_PrintValue( self, stream, pressure );
+
+  for(i=0;i<self->num_fields;++i)
+    {
+      FieldVariable_InterpolateValueAt(self->fields[i],coord,&field);
+      SwarmOutput_PrintValue( self, stream, field );
+    }
+}
+
+/*-------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
+/*---------------------------------------------------------------------------------------------------------------------
+** Entry Point Hooks
+*/
+
+/*-------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+
+
diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/TracerOutput.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/src/TracerOutput.h	Fri May 06 14:03:37 2011 -0700
@@ -0,0 +1,111 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+** 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:
+*%		Louis Moresi - Louis.Moresi at sci.monash.edu.au
+*%
+** Contributors:
+*+		Robert Turnbull
+*+		Vincent Lemiale
+*+		Louis Moresi
+*+		David May
+*+		David Stegman
+*+		Mirko Velic
+*+		Patrick Sunter
+*+		Julian Giordani
+*+
+** $Id: TracerOutput.h 354 2006-10-12 08:19:27Z SteveQuenette $
+** 
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+
+#ifndef __Underworld_Utils_TracerOutput_h__
+#define __Underworld_Utils_TracerOutput_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 */
+extern const Type TracerOutput_Type;
+
+/* TracerOutput information */
+#define __TracerOutput                                                  \
+  /* Macro defining parent goes here - This means you can cast this class as its parent */ \
+  __SwarmOutput                                                         \
+  /* Virtual Info */                                                    \
+  FeVariable* pressureField;      \
+  FeVariable** fields;   \
+  unsigned int num_fields; \
+
+struct TracerOutput { __TracerOutput };
+	
+/*---------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+	
+#ifndef ZERO
+#define ZERO 0
+#endif
+
+#define TRACEROUTPUT_DEFARGS       \
+  SWARMOUTPUT_DEFARGS
+
+#define TRACEROUTPUT_PASSARGS      \
+  SWARMOUTPUT_PASSARGS
+
+TracerOutput* _TracerOutput_New(  TRACEROUTPUT_DEFARGS  );
+
+/* Stg_Class_Delete TracerOutput implementation */
+void _TracerOutput_Delete( void* swarmOutput );
+void _TracerOutput_Print( void* swarmOutput, Stream* stream );
+#define TracerOutput_Copy( self )                                       \
+  (TracerOutput*) Stg_Class_Copy( self, NULL, False, NULL, NULL )
+#define TracerOutput_DeepCopy( self )                                   \
+  (TracerOutput*) Stg_Class_Copy( self, NULL, True, NULL, NULL )
+void* _TracerOutput_Copy( void* swarmOutput, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
+	
+void* _TracerOutput_DefaultNew( Name name ) ;
+void _TracerOutput_AssignFromXML( void* shape, Stg_ComponentFactory* cf, void* data ) ;
+void _TracerOutput_Build( void* swarmOutput, void* data ) ;
+void _TracerOutput_Initialise( void* swarmOutput, void* data ) ;
+void _TracerOutput_Execute( void* swarmOutput, void* data );
+void _TracerOutput_Destroy( void* swarmOutput, void* data ) ;
+	
+void _TracerOutput_PrintHeader( void* swarmOutput, Stream* stream, Particle_Index lParticle_I, void* context );
+void _TracerOutput_PrintData( void* swarmOutput, Stream* stream, Particle_Index lParticle_I, void* context );
+		
+/*---------------------------------------------------------------------------------------------------------------------
+** Private functions
+*/
+	
+/*---------------------------------------------------------------------------------------------------------------------
+** Entry Point Hooks
+*/
+	
+/*---------------------------------------------------------------------------------------------------------------------
+** Public functions
+*/
+	
+#endif 
+
diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/TracerOutput.meta
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/src/TracerOutput.meta	Fri May 06 14:03:37 2011 -0700
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">TracerOutput</param>
+<param name="Author">...</param>
+<param name="Organisation">MCC</param>
+<param name="Project">Underworld</param>
+<param name="Location">./Underworld/Utils/src/</param>
+<param name="Project Web">http://www.mcc.monash.edu.au/Software/Underworld</param>
+<param name="Copyright">Copyright (c) 2005, Monash Cluster Computing</param>
+<param name="License">http://www.opensource.org/licenses/bsd-license.php</param>
+<param name="Parent">SwarmOutput</param>
+<param name="Reference">...</param>
+<param name="Summary">...</param>
+<param name="Description">This component prints out the field values on a swarm</param>
+
+<!--Now the interesting stuff-->
+
+<list name="Params">
+
+</list>
+
+<list name="Dependencies">
+</list>
+<!-- Add an exmaple XML if possible -->
+<param name="Example">
+<![CDATA[
+	<struct name="swarmOutput">
+		<param name="Type">TracerOutput</param>
+		<param name="Swarm">swarm</param>
+		<param name="Field1">PressureField</param>
+		<param name="Field2">TemperatureField</param>
+	</struct>
+]]>
+</param>
+
+</StGermainData>
diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/Utils.h
--- a/Utils/src/Utils.h	Fri Nov 12 16:01:56 2010 -0800
+++ b/Utils/src/Utils.h	Fri May 06 14:03:37 2011 -0700
@@ -55,7 +55,7 @@
 	#include "DensityField.h"
 	#include "DivergenceForce.h"
         #include "MixedStabiliserTerm.h"
-	#include "PressureTemperatureOutput.h"
+	#include "TracerOutput.h"
 	#include "Underworld_SwarmOutput.h"
 	#include "RadiogenicHeatingTerm.h"
 	#include "XDMFGenerator.h"
diff -r 03b4056e9d81 -r d795d40fd164 Utils/src/types.h
--- a/Utils/src/types.h	Fri Nov 12 16:01:56 2010 -0800
+++ b/Utils/src/types.h	Fri May 06 14:03:37 2011 -0700
@@ -47,7 +47,7 @@
 #define __Underworld_Utils_types_h__
 	
 	typedef struct UnderworldContext		UnderworldContext;
-	typedef struct PressureTemperatureOutput     PressureTemperatureOutput;
+	typedef struct TracerOutput     TracerOutput;
 	typedef struct Underworld_SwarmOutput              Underworld_SwarmOutput;
 	typedef struct RadiogenicHeatingTerm         RadiogenicHeatingTerm;
 	typedef struct StressField                   StressField;
diff -r 03b4056e9d81 -r d795d40fd164 Utils/tests/testPressureTemperatureOutput.0of1.sh
--- a/Utils/tests/testPressureTemperatureOutput.0of1.sh	Fri Nov 12 16:01:56 2010 -0800
+++ b/Utils/tests/testPressureTemperatureOutput.0of1.sh	Fri May 06 14:03:37 2011 -0700
@@ -6,4 +6,4 @@ done
 done
 . ${TEST_SCRIPT}
 
-runAndHandleSystemTestStdLocations "Underworld testPressureTemperatureOutput.xml" "$0" "$@"
+runAndHandleSystemTestStdLocations "Underworld testTracerOutput.xml" "$0" "$@"
diff -r 03b4056e9d81 -r d795d40fd164 Utils/tests/testPressureTemperatureOutput.0of2.sh
--- a/Utils/tests/testPressureTemperatureOutput.0of2.sh	Fri Nov 12 16:01:56 2010 -0800
+++ b/Utils/tests/testPressureTemperatureOutput.0of2.sh	Fri May 06 14:03:37 2011 -0700
@@ -6,4 +6,4 @@ done
 done
 . ${TEST_SCRIPT}
 
-runAndHandleSystemTestStdLocations "Underworld testPressureTemperatureOutput.xml" "$0" "$@"
+runAndHandleSystemTestStdLocations "Underworld testTracerOutput.xml" "$0" "$@"
diff -r 03b4056e9d81 -r d795d40fd164 Utils/tests/testPressureTemperatureOutput.xml
--- a/Utils/tests/testPressureTemperatureOutput.xml	Fri Nov 12 16:01:56 2010 -0800
+++ b/Utils/tests/testPressureTemperatureOutput.xml	Fri May 06 14:03:37 2011 -0700
@@ -22,7 +22,7 @@
 			<param name="totalInitialParticles">5</param>
 		</struct>
 		<struct name="swarmOutput">
-			<param name="Type">PressureTemperatureOutput</param>
+			<param name="Type">TracerOutput</param>
 			<param name="Swarm">swarm</param>
 			<param name="PressureField">PressureField</param>
 			<param name="TemperatureField">TemperatureField</param>



More information about the CIG-COMMITS mailing list