[cig-commits] r5582 - in long/3D/Gale/trunk: .
src/Underworld/plugins/Output/DumpSwarm
walter at geodynamics.org
walter at geodynamics.org
Mon Dec 11 03:00:50 PST 2006
Author: walter
Date: 2006-12-11 03:00:50 -0800 (Mon, 11 Dec 2006)
New Revision: 5582
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/src/Underworld/plugins/Output/DumpSwarm/DumpSwarm.c
Log:
r1217 at earth: boo | 2006-12-11 02:56:06 -0800
Implement vtk output
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1216
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1217
Modified: long/3D/Gale/trunk/src/Underworld/plugins/Output/DumpSwarm/DumpSwarm.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/Output/DumpSwarm/DumpSwarm.c 2006-12-11 11:00:36 UTC (rev 5581)
+++ long/3D/Gale/trunk/src/Underworld/plugins/Output/DumpSwarm/DumpSwarm.c 2006-12-11 11:00:50 UTC (rev 5582)
@@ -110,6 +110,8 @@
double *coord;
char *format;
+ int stepping, iteration, num_iterations=1;
+ int num_particles=0;
char separator[2];
separator[0]='\0';
@@ -118,6 +120,7 @@
return;
format=Dictionary_GetString_WithDefault(dictionary,"outputFormat","txt");
+ stepping=Dictionary_GetInt_WithDefault(dictionary,"particleStepping",1);
if(!strcmp(format,"csv"))
strcpy(separator,",");
@@ -126,56 +129,111 @@
context->timeStep, format );
Stream_RedirectFile( stream, filename );
- /* Loop over all of the particles */
- for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ;
- ++lParticle_I ){
-
- 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 );
-
- /* 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 );
-
- /* We are only interested in whether a particle has
- yielded, so we only look at yielding rheologies */
- if(!strcmp(rheology->name,"yielding"))
- {
- Journal_Printf(stream,"%d%s ",rheology_I,separator);
+ if(!strcmp(format,"vtk"))
+ {
+ num_iterations=2;
- coord = materialparticle->coord;
+ for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ;
+ ++lParticle_I ){
+
+ 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 );
+
+ /* 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 );
- if (context->dim == 2) {
- Journal_Printf(stream,"%lf%s %lf%s 0.0%s ",(double)coord[0],
- separator,(double)coord[1],separator,separator);
- } else {
- Journal_Printf(stream,"%lf%s %lf%s %lf%s ",
- (double)coord[0],separator,
- (double)coord[1],separator,
- (double)coord[2],separator);
- }
- if ( (rheology)->hasYieldedParticleExtHandle == (ExtensionInfo_Index) -1 )
+ /* We are only interested in whether a particle has
+ yielded, so we only look at yielding rheologies */
+ if(!strcmp(rheology->name,"yielding"))
+ ++num_particles;
+ }
+ }
+ Journal_Printf(stream,"# vtk DataFile Version 2.0\nGale\nASCII\nDATASET UNSTRUCTURED_GRID\nPOINTS %d float\n",(num_particles-1)/stepping+1);
+ }
+
+ for(iteration=0; iteration<num_iterations; ++iteration)
+ {
+ /* Loop over all of the particles */
+ for ( lParticle_I = 0 ; lParticle_I < particleLocalCount ;
+ ++lParticle_I ){
+
+ 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 );
+
+ /* 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 );
+
+ /* We are only interested in whether a particle has
+ yielded, so we only look at yielding rheologies */
+ if(!strcmp(rheology->name,"yielding"))
{
- Journal_Printf(stream,"No particle yield extension\n");
+ if(strcmp(format,"vtk"))
+ Journal_Printf(stream,"%d%s ",rheology_I,separator);
+
+ coord = materialparticle->coord;
+
+ if(iteration==0)
+ {
+ if (context->dim == 2) {
+ Journal_Printf(stream,"%lf%s %lf%s 0.0%s ",(double)coord[0],
+ separator,(double)coord[1],separator,separator);
+ } else {
+ Journal_Printf(stream,"%lf%s %lf%s %lf%s ",
+ (double)coord[0],separator,
+ (double)coord[1],separator,
+ (double)coord[2],separator);
+ }
+ }
+ if(iteration==1 || strcmp(format,"vtk"))
+ {
+ char sep='\n';
+ if(iteration==1)
+ sep=' ';
+
+ if ( (rheology)->hasYieldedParticleExtHandle == (ExtensionInfo_Index) -1 )
+ {
+ Journal_Printf(stream,"No particle yield extension\n");
+ }
+ else
+ {
+ Journal_Printf
+ (stream,"%lf%c",
+ StrainWeakening_CalcRatio(rheology->strainWeakening,
+ materialparticle),sep);
+ }
+ }
+ else
+ Journal_Printf(stream,"\n");
}
- else
+ }
+ }
+ if(!strcmp(format,"vtk"))
+ {
+ if(iteration==0)
{
- Journal_Printf
- (stream,"%lf\n",
- StrainWeakening_CalcRatio(rheology->strainWeakening,
- materialparticle));
+ Journal_Printf(stream,"POINT_DATA %d\nSCALARS Temperature_Scalars float 1\nLOOKUP_TABLE default\n",
+ (num_particles-1)/stepping+1);
}
+ else
+ Journal_Printf(stream,"\n");
}
}
- }
-
Stream_CloseFile( stream );
Memory_Free( filename );
}
More information about the cig-commits
mailing list