[cig-commits] r6002 - in long/3D/Gale/trunk: . src/Gale/src
src/Underworld/plugins/Output
src/Underworld/plugins/Output/VTKOutput
walter at geodynamics.org
walter at geodynamics.org
Sun Feb 11 00:50:46 PST 2007
Author: walter
Date: 2007-02-11 00:50:46 -0800 (Sun, 11 Feb 2007)
New Revision: 6002
Added:
long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/
long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/SConscript
long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c
long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.h
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/src/Gale/src/main.c
long/3D/Gale/trunk/src/Underworld/plugins/Output/SConscript
Log:
r1543 at earth: boo | 2007-02-09 12:45:36 -0800
Add in VTKOutput plugin which only does vtk output
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1540
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1543
Modified: long/3D/Gale/trunk/src/Gale/src/main.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/src/main.c 2007-02-11 03:37:45 UTC (rev 6001)
+++ long/3D/Gale/trunk/src/Gale/src/main.c 2007-02-11 08:50:46 UTC (rev 6002)
@@ -73,9 +73,10 @@
Index _Underworld_EulerDeform_Register( PluginsManager* pluginsManager );
Index StgFEM_PrintFeVariableDiscreteValues_Register( PluginsManager* pluginsManager );
Index Underworld_DumpSwarm_Register( PluginsManager* pluginsManager );
+Index Underworld_VTKOutput_Register( PluginsManager* pluginsManager );
Index _Gale_SurfaceProcess_Register( PluginsManager* pluginsManager );
-int nPlugins = 9;
+int nPlugins = 10;
char* pluginNames[] = {"StgFEM_FrequentOutput",
"StgFEM_StandardConditionFunctions",
"StgFEM_CPUTime",
@@ -84,6 +85,7 @@
"Underworld_EulerDeform",
"StgFEM_PrintFeVariableDiscreteValues",
"Underworld_DumpSwarm",
+ "Underworld_VTKOutput",
"Gale_SurfaceProcess"};
StaticPluginEntry pluginLst[] = {{StgFEM_FrequentOutput_Register, NULL, NULL, NULL},
{StgFEM_StandardConditionFunctions_Register, NULL, NULL, NULL},
@@ -93,6 +95,7 @@
{_Underworld_EulerDeform_Register},
{StgFEM_PrintFeVariableDiscreteValues_Register},
{Underworld_DumpSwarm_Register},
+ {Underworld_VTKOutput_Register},
{_Gale_SurfaceProcess_Register}};
/* END STATIC PLUGINS */
Modified: long/3D/Gale/trunk/src/Underworld/plugins/Output/SConscript
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/SConscript 2007-02-11 03:37:45 UTC (rev 6001)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/SConscript 2007-02-11 08:50:46 UTC (rev 6002)
@@ -21,4 +21,5 @@
SConscript('Nusselt/SConscript')
SConscript('Vrms/SConscript')
SConscript('DumpSwarm/SConscript')
+SConscript('VTKOutput/SConscript')
Added: long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/SConscript
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/SConscript 2007-02-11 03:37:45 UTC (rev 6001)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/SConscript 2007-02-11 08:50:46 UTC (rev 6002)
@@ -0,0 +1,30 @@
+# Copyright 2006 California Institute of Technology
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+
+Import('env','shared_lib_objects','Underworld_static_objects','header_groups')
+
+local_env=env.Copy()
+local_env.Append(CPPFLAGS=["-DCURR_MODULE_NAME=\\\"Underworld_VTKOutput\\\""])
+
+header_groups['Underworld/plugins/Output/VTKOutput']=Split("""VTKOutput.h""")
+
+c_files=Split("""VTKOutput.c""")
+
+shared_lib_objects+=[local_env.SharedLibrary('Underworld_VTKOutputmodule',
+ c_files,SHLIBPREFIX='')]
+Underworld_static_objects+=[local_env.StaticObject(c_files)]
+
Added: long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c 2007-02-11 03:37:45 UTC (rev 6001)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.c 2007-02-11 08:50:46 UTC (rev 6002)
@@ -0,0 +1,207 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+** Melbourne, 3053, Australia.
+**
+** Primary Contributing Organisations:
+** Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+** Australian Computational Earth Systems Simulator - http://www.access.edu.au
+** Monash Cluster Computing - http://www.mcc.monash.edu.au
+** Computational Infrastructure for Geodynamics - http://www.geodynamics.org
+**
+** Contributors:
+** Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+** Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+** David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+** Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+** Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+** Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+** Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+** Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** This library is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with this library; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+**
+** $Id: /cig/src/StgFEM/plugins/Output/PrintFeVariableDiscreteValues/Plugin.c 21 2006-04-07T21:29:57.251207Z walter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+#include <StgFEM/StgFEM.h>
+#include <PICellerator/PICellerator.h>
+#include <Underworld/Underworld.h>
+#include "VTKOutput.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+const Type Underworld_VTKOutput_Type = "Underworld_VTKOutput";
+
+void _Underworld_VTKOutput_Construct( void* component, Stg_ComponentFactory* cf, void *data ) {
+ UnderworldContext* context;
+
+ context = (UnderworldContext*)Stg_ComponentFactory_ConstructByName( cf, "context", UnderworldContext, True, data );
+
+ ContextEP_Append( context, AbstractContext_EP_Dump,
+ VTKOutput );
+}
+
+void* _Underworld_VTKOutput_DefaultNew( Name name ) {
+ return Codelet_New(
+ Underworld_VTKOutput_Type,
+ _Underworld_VTKOutput_DefaultNew,
+ _Underworld_VTKOutput_Construct,
+ _Codelet_Build,
+ _Codelet_Initialise,
+ _Codelet_Execute,
+ _Codelet_Destroy,
+ name );
+}
+
+Index Underworld_VTKOutput_Register( PluginsManager* pluginsManager ) {
+ Journal_DPrintf( StgFEM_Debug, "In: %s( void* )\n", __func__ );
+
+ return PluginsManager_Submit( pluginsManager, Underworld_VTKOutput_Type, "0", _Underworld_VTKOutput_DefaultNew );
+}
+
+void VTKOutput_particles(IntegrationPointsSwarm* picswarm, int stepping,
+ char *outputPath, int timeStep, int dim);
+
+void VTKOutput( void* _context ) {
+ UnderworldContext* context = (UnderworldContext*)_context;
+ Dictionary* dictionary = context->dictionary;
+
+ /* Only dump if at the right time step. */
+ if(context->timeStep % context->dumpEvery != 0)
+ return;
+
+ /* Write the particles and then all of the fields. */
+
+ VTKOutput_particles(context->picIntegrationPoints,
+ Dictionary_GetInt_WithDefault
+ (dictionary,"particleStepping",1),
+ context->outputPath, context->timeStep,
+ context->dim);
+/* VTKOutput_fields(); */
+}
+
+void VTKOutput_particles(IntegrationPointsSwarm* picswarm, int stepping,
+ char *outputPath, int timeStep, int dim) {
+ double *coord;
+ int iteration;
+ Particle_Index num_particles = picswarm->particleLocalCount;
+ Particle_Index lParticle_I;
+
+ RheologyMaterial* material;
+ MaterialPointsSwarm* materialSwarm;
+ MaterialPoint* materialparticle;
+
+ Rheology_Register* rheology_register;
+
+ Name filename;
+ Stream* stream;
+
+ Rheology_Index rheology_I;
+ Rheology_Index rheologyCount;
+ YieldRheology* rheology;
+
+ stream = Journal_Register( MPIStream_Type, Swarm_Type );
+ Stg_asprintf( &filename, "%s/particles.%05d.vtk", outputPath,
+ timeStep);
+ Stream_RedirectFile( stream, filename );
+
+ /* Write a header */
+ Journal_Printf(stream,"# vtk DataFile Version 2.0\nGale\nASCII\nDATASET UNSTRUCTURED_GRID\nPOINTS %d float\n",(num_particles-1)/stepping+1);
+
+ /* We need three iterations, because the values are written
+ separately from the coordinates. */
+ for(iteration=0; iteration<3; ++iteration)
+ {
+ /* Loop over all of the particles */
+ for ( lParticle_I = 0 ; lParticle_I < num_particles ;
+ ++lParticle_I ){
+ double yielding, viscosity;
+
+ IntegrationPoint* integrationparticle = (IntegrationPoint*)Swarm_ParticleAt( picswarm, lParticle_I );
+
+ material = (RheologyMaterial*) IntegrationPointsSwarm_GetMaterialOn( picswarm, integrationparticle );
+ materialparticle = OneToOneMapper_GetMaterialPoint( picswarm->mapper, integrationparticle, &materialSwarm );
+
+ rheology_register=(Rheology_Register*)material->rheology_Register;
+
+ rheologyCount = Rheology_Register_GetCount( rheology_register );
+
+ coord = materialparticle->coord;
+ yielding=0;
+ viscosity=0;
+
+ /* First print out only the coordinates. */
+ if(iteration==0)
+ {
+ if (dim == 2) {
+ Journal_Printf(stream,"%lf %lf 0.0 ",(double)coord[0],
+ (double)coord[1]);
+ } else {
+ Journal_Printf(stream,"%lf %lf %lf ", (double)coord[0],
+ (double)coord[1], (double)coord[2]);
+ }
+ }
+ else
+ {
+ /* Loop over all of the rheologies for a particle. */
+
+ for( rheology_I = 0; rheology_I < rheologyCount ; rheology_I++ ) {
+ rheology = (YieldRheology*)Rheology_Register_GetByIndex( rheology_register, rheology_I );
+
+ /* Get yielding information */
+ if(!strcmp(rheology->name,"yielding"))
+ {
+ yielding=StrainWeakening_CalcRatio(rheology->strainWeakening,
+ materialparticle);
+ }
+ /* Get viscosity */
+ else if(!strcmp(rheology->name,"storeViscosity"))
+ {
+ StoreVisc* self = (StoreVisc*) rheology;
+ StoreVisc_ParticleExt* particleExt;
+ particleExt=
+ ExtensionManager_Get( materialSwarm->particleExtensionMgr, materialparticle, self->particleExtHandle );
+ viscosity=particleExt->effVisc;
+ }
+ }
+ if(iteration==1)
+ Journal_Printf(stream,"%lf ",viscosity);
+ if(iteration==2)
+ Journal_Printf(stream,"%lf ",yielding);
+ }
+ }
+ switch(iteration)
+ {
+ case 0:
+ Journal_Printf(stream,"POINT_DATA %d\nSCALARS Viscosity float 1\nLOOKUP_TABLE default\n",
+ (num_particles-1)/stepping+1);
+ break;
+ case 1:
+ Journal_Printf(stream,"\nSCALARS Yielding_fraction float 1\nLOOKUP_TABLE default\n");
+ break;
+ case 2:
+ Journal_Printf(stream,"\n");
+ }
+ }
+ Stream_CloseFile( stream );
+ Memory_Free( filename );
+}
Added: long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.h
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.h 2007-02-11 03:37:45 UTC (rev 6001)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/VTKOutput/VTKOutput.h 2007-02-11 08:50:46 UTC (rev 6002)
@@ -0,0 +1,63 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003-2006, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street,
+** Melbourne, 3053, Australia.
+**
+** Primary Contributing Organisations:
+** Victorian Partnership for Advanced Computing Ltd, Computational Software Development - http://csd.vpac.org
+** Australian Computational Earth Systems Simulator - http://www.access.edu.au
+** Monash Cluster Computing - http://www.mcc.monash.edu.au
+** Computational Infrastructure for Geodynamics - http://www.geodynamics.org
+**
+** Contributors:
+** Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+** Robert Turnbull, Research Assistant, Monash University. (robert.turnbull at sci.monash.edu.au)
+** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+** David May, PhD Student, Monash University (david.may at sci.monash.edu.au)
+** Louis Moresi, Associate Professor, Monash University. (louis.moresi at sci.monash.edu.au)
+** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+** Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+** Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+** Julian Giordani, Research Assistant, Monash University. (julian.giordani at sci.monash.edu.au)
+** Vincent Lemiale, Postdoctoral Fellow, Monash University. (vincent.lemiale at sci.monash.edu.au)
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** This library is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with this library; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+**
+*/
+/** \file
+** Role:
+** This plugin simply prints out the discrete values of a list of feVariables that the user requests.
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __Underworld_VTKOutput_h__
+#define __Underworld_VTKOutput_h__
+
+ extern const Type Underworld_VTKOutput_Type;
+
+ typedef struct {
+ __Codelet
+ } Underworld_VTKOutput;
+
+ Index _Underworld_VTKOutput_Register( PluginsManager* pluginsManager );
+ void VTKOutput( void* _context );
+
+#endif
More information about the cig-commits
mailing list