[cig-commits] r8312 - in long/3D/Gale/trunk: .
src/StGermain/Discretisation/Mesh/src
walter at geodynamics.org
walter at geodynamics.org
Wed Nov 21 12:53:30 PST 2007
Author: walter
Date: 2007-11-21 12:53:30 -0800 (Wed, 21 Nov 2007)
New Revision: 8312
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.h
Log:
r1987 at earth: boo | 2007-11-21 12:47:03 -0800
Add hard coded, hacked support for using topographic data as an initial surface.
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1975
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1987
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.c 2007-11-21 18:43:15 UTC (rev 8311)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.c 2007-11-21 20:53:30 UTC (rev 8312)
@@ -159,6 +159,24 @@
self->info.plateau.z4 = Stg_ComponentFactory_GetDouble( cf, self->name, "z4", 0.0 );
self->info.plateau.height = Stg_ComponentFactory_GetDouble( cf, self->name, "height", 0.0 );
}
+ else if( !strcmp( surfaceType, "topo_data" ) ) {
+ FILE *fp;
+ int i,j,ii,jj,h,nx,ny;
+ nx = Stg_ComponentFactory_GetInt( cf, self->name, "nx", 0 );
+ ny = Stg_ComponentFactory_GetInt( cf, self->name, "ny", 0 );
+ self->info.topo_data.nx=nx;
+ self->info.topo_data.ny=ny;
+ self->info.topo_data.heights=malloc(sizeof(int)*nx*ny);
+ self->surfaceType = SurfaceAdaptor_SurfaceType_Topo_Data;
+ fp=fopen("/home/boo/cig/gale/viz/tibet_topo/ascii_topo","r");
+ for(i=0;i<nx;++i)
+ for(j=0;j<ny;++j)
+ {
+ fscanf(fp,"%d %d %d",&ii,&jj,&h);
+ self->info.topo_data.heights[ii+nx*jj]=h;
+ }
+ fclose(fp);
+ }
else if( !strcmp( surfaceType, "sine" ) || !strcmp( surfaceType, "cosine" ) ) {
Dictionary_Entry_Value* originList;
@@ -231,6 +249,9 @@
case SurfaceAdaptor_SurfaceType_Plateau:
deformFunc = SurfaceAdaptor_Plateau;
break;
+ case SurfaceAdaptor_SurfaceType_Topo_Data:
+ deformFunc = SurfaceAdaptor_Topo_Data;
+ break;
case SurfaceAdaptor_SurfaceType_Sine:
deformFunc = SurfaceAdaptor_Sine;
break;
@@ -335,6 +356,18 @@
return x_factor*z_factor;
}
+double SurfaceAdaptor_Topo_Data( SurfaceAdaptor* self, Mesh* mesh,
+ unsigned* globalSize, unsigned vertex,
+ unsigned* vertexInds )
+{
+ int i,j,k;
+
+ /* Awful hard coded hack */
+ i=mesh->verts[vertex][0]/1001;
+ j=mesh->verts[vertex][2]/1001;
+ return (double)(self->info.topo_data.heights[i+self->info.topo_data.nx*j]);
+}
+
double SurfaceAdaptor_Sine( SurfaceAdaptor* self, Mesh* mesh,
unsigned* globalSize, unsigned vertex, unsigned* vertexInds )
{
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.h 2007-11-21 18:43:15 UTC (rev 8311)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/SurfaceAdaptor.h 2007-11-21 20:53:30 UTC (rev 8312)
@@ -50,6 +50,7 @@
typedef enum {
SurfaceAdaptor_SurfaceType_Wedge,
SurfaceAdaptor_SurfaceType_Plateau,
+ SurfaceAdaptor_SurfaceType_Topo_Data,
SurfaceAdaptor_SurfaceType_Sine,
SurfaceAdaptor_SurfaceType_Cosine,
SurfaceAdaptor_SurfaceType_Invalid
@@ -65,6 +66,11 @@
} SurfaceAdaptor_PlateauInfo;
typedef struct {
+ int nx,ny;
+ short int *heights;
+ } SurfaceAdaptor_Topo_DataInfo;
+
+ typedef struct {
double origin[2];
double amp;
double freq;
@@ -73,6 +79,7 @@
typedef union {
SurfaceAdaptor_WedgeInfo wedge;
SurfaceAdaptor_PlateauInfo plateau;
+ SurfaceAdaptor_Topo_DataInfo topo_data;
SurfaceAdaptor_TrigInfo trig;
} SurfaceAdaptor_SurfaceInfo;
@@ -128,6 +135,8 @@
unsigned* globalSize, unsigned vertex, unsigned* vertexInds );
double SurfaceAdaptor_Plateau( SurfaceAdaptor* self, Mesh* mesh,
unsigned* globalSize, unsigned vertex, unsigned* vertexInds );
+ double SurfaceAdaptor_Topo_Data( SurfaceAdaptor* self, Mesh* mesh,
+ unsigned* globalSize, unsigned vertex, unsigned* vertexInds );
double SurfaceAdaptor_Sine( SurfaceAdaptor* self, Mesh* mesh,
unsigned* globalSize, unsigned vertex, unsigned* vertexInds );
double SurfaceAdaptor_Cosine( SurfaceAdaptor* self, Mesh* mesh,
More information about the cig-commits
mailing list