[cig-commits] commit:

Mercurial hg at geodynamics.org
Mon Nov 24 11:59:27 PST 2008


changeset:   140:e6bfd8ab9c35
user:        LukeHodkinson
date:        Tue Aug 26 17:11:50 2008 +0000
files:       Mesh/src/CartesianGenerator.c Mesh/src/CartesianGenerator.h
description:
Fixing some code to initialise the mesh with
bunched up nodes at the boundary.


diff -r 051354da7ab6 -r e6bfd8ab9c35 Mesh/src/CartesianGenerator.c
--- a/Mesh/src/CartesianGenerator.c	Mon Aug 18 13:58:24 2008 +0000
+++ b/Mesh/src/CartesianGenerator.c	Tue Aug 26 17:11:50 2008 +0000
@@ -264,6 +264,17 @@ void _CartesianGenerator_Construct( void
 
 	/* Initial setup. */
 	CartesianGenerator_SetTopologyParams( self, size, maxDecompDims, minDecomp, maxDecomp );
+
+        /* Contact stuff. */
+        self->contactDepth[0][0] = Stg_ComponentFactory_GetInt( cf, self->name, "contactDepth-left", 0 );
+        self->contactDepth[0][1] = Stg_ComponentFactory_GetInt( cf, self->name, "contactDepth-right", 0 );
+        self->contactDepth[1][0] = Stg_ComponentFactory_GetInt( cf, self->name, "contactDepth-bottom", 0 );
+        self->contactDepth[1][1] = Stg_ComponentFactory_GetInt( cf, self->name, "contactDepth-top", 0 );
+        self->contactDepth[2][0] = Stg_ComponentFactory_GetInt( cf, self->name, "contactDepth-back", 0 );
+        self->contactDepth[2][1] = Stg_ComponentFactory_GetInt( cf, self->name, "contactDepth-front", 0 );
+        self->contactGeom[0] = Stg_ComponentFactory_GetDouble( cf, self->name, "contactGeometry-x", 0.0 );
+        self->contactGeom[1] = Stg_ComponentFactory_GetDouble( cf, self->name, "contactGeometry-y", 0.0 );
+        self->contactGeom[2] = Stg_ComponentFactory_GetDouble( cf, self->name, "contactGeometry-z", 0.0 );
 
 	/* Read geometry. */
 	minList = Dictionary_Get( dict, "minCoord" );
@@ -2291,8 +2302,29 @@ void CartesianGenerator_CalcGeom( Cartes
 
 		/* Calculate coordinate. */
 		for( d_i = 0; d_i < mesh->topo->nDims; d_i++ ) {
-			vert[d_i] = self->crdMin[d_i] + 
-				((double)inds[d_i] / (double)(grid->sizes[d_i] - 1)) * steps[d_i];
+                   if( inds[d_i] <= self->contactDepth[d_i][0] ) {
+                      mesh->verts[n_i][d_i] = self->crdMin[d_i];
+                      if( self->contactDepth[d_i][0] ) {
+                         mesh->verts[n_i][d_i] +=
+                            ((double)inds[d_i] / (double)self->contactDepth[d_i][0]) *
+                            self->contactGeom[d_i];
+                      }
+                   }
+                   else if( inds[d_i] >= grid->sizes[d_i] - self->contactDepth[d_i][1] - 1 ) {
+                      mesh->verts[n_i][d_i] = self->crdMax[d_i];
+                      if( self->contactDepth[d_i][1] ) {
+                         mesh->verts[n_i][d_i] -=
+                            ((double)(grid->sizes[d_i] - 1 - inds[d_i]) /
+                             (double)self->contactDepth[d_i][1]) *
+                            self->contactGeom[d_i];
+                      }
+                   }
+                   else {
+                      vert[d_i] = self->crdMin[d_i] + self->contactGeom[d_i] +
+                         ((double)(inds[d_i] - self->contactDepth[d_i][0]) / 
+                          (double)(grid->sizes[d_i] - (self->contactDepth[d_i][0] + self->contactDepth[d_i][1]) - 1)) *
+                         (steps[d_i] - 2.0 * self->contactGeom[d_i]);
+                   }
 		}
 	}
 }
diff -r 051354da7ab6 -r e6bfd8ab9c35 Mesh/src/CartesianGenerator.h
--- a/Mesh/src/CartesianGenerator.h	Mon Aug 18 13:58:24 2008 +0000
+++ b/Mesh/src/CartesianGenerator.h	Tue Aug 26 17:11:50 2008 +0000
@@ -95,7 +95,9 @@
 		unsigned*	origin;								\
 		unsigned*	range;								\
 		unsigned*	vertOrigin;							\
-		unsigned*	vertRange;
+		unsigned*	vertRange;                              \
+                int             contactDepth[3][2];                     \
+                double          contactGeom[3];
 
 	struct CartesianGenerator { __CartesianGenerator };
 



More information about the CIG-COMMITS mailing list