[cig-commits] r13893 - in long/3D/Gale/trunk: . input/examples src/Underworld/plugins/EulerDeform

walter at geodynamics.org walter at geodynamics.org
Tue Jan 20 15:12:22 PST 2009


Author: walter
Date: 2009-01-20 15:12:21 -0800 (Tue, 20 Jan 2009)
New Revision: 13893

Modified:
   long/3D/Gale/trunk/
   long/3D/Gale/trunk/input/examples/tibet.xml
   long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/Context.h
   long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/EulerDeform.c
Log:
 r2460 at dante:  boo | 2009-01-20 14:57:10 -0800
 Replaced ugly hack with more generalized hack to reset the coordinates of the top left and right coordinates.  Does not work in 3D yet.



Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
   - 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2459
   + 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:2460

Modified: long/3D/Gale/trunk/input/examples/tibet.xml
===================================================================
--- long/3D/Gale/trunk/input/examples/tibet.xml	2009-01-20 23:12:18 UTC (rev 13892)
+++ long/3D/Gale/trunk/input/examples/tibet.xml	2009-01-20 23:12:21 UTC (rev 13893)
@@ -640,6 +640,7 @@
         <param name="staticBottom">True</param>
         <param name="staticLeftBottom">True</param>
         <param name="staticRight">True</param>
+        <param name="xRightCoord">1000000.0f</param>
         <list name="fields">
           <struct>
             <param name="field">VelocityField</param>

Modified: long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/Context.h
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/Context.h	2009-01-20 23:12:18 UTC (rev 13892)
+++ long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/Context.h	2009-01-20 23:12:21 UTC (rev 13893)
@@ -76,6 +76,8 @@
 
 		Bool		staticSides;
 		double**	sideCoords;
+                double          x_right_coord;
+                double          x_left_coord;
 	};
 
 #endif

Modified: long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/EulerDeform.c
===================================================================
--- long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/EulerDeform.c	2009-01-20 23:12:18 UTC (rev 13892)
+++ long/3D/Gale/trunk/src/Underworld/plugins/EulerDeform/EulerDeform.c	2009-01-20 23:12:21 UTC (rev 13893)
@@ -208,6 +208,17 @@
                           || sys->staticTopBack
                           || sys->staticBottomBack;
 
+
+                        if(sys->staticRight && sys->wrapTop
+                           && !sys->staticRightTop)
+                          sys->x_right_coord =
+                            Dictionary_GetDouble( sysDict, "xRightCoord");
+
+                        if(sys->staticLeft && sys->wrapTop
+                           && !sys->staticLeftTop)
+                          sys->x_left_coord =
+                            Dictionary_GetDouble( sysDict, "xLeftCoord");
+                          
 			/* Read the list of variables to interpolate. */
 			varLst = Dictionary_Entry_Value_GetMember( Dictionary_Entry_Value_GetElement( sysLst, sys_i ), "fields" );
 			if( varLst ) {
@@ -707,25 +718,86 @@
 
                         if(sys->wrapTop)
                           {
-                            if(sys->staticRight)
+                            if(sys->staticLeft && !sys->staticLeftTop)
                               {
-                                double x0,y0,x1,y1;
-                                double x_fixed, delta;
-                                int nn=Mesh_GetLocalSize( sys->mesh, MT_VERTEX )-1;
-                                x_fixed=1000000.0;
+                                if(nDims==2)
+                                  {
+                                    IJK		ijk;
+                                    unsigned n_global,n_local;
+                                    Grid *grid;
+                                    grid = *(Grid**)ExtensionManager_Get( sys->mesh->info, sys->mesh, 
+                                                                         ExtensionManager_GetHandle( sys->mesh->info, "vertexGrid" ) );
+                                    ijk[0]=0;
+                                    ijk[1]=grid->sizes[1]-1;
+                                    n_global=RegularMeshUtils_Node_3DTo1D(sys->mesh,ijk);
+                                    if(Mesh_GlobalToDomain(sys->mesh,MT_VERTEX,
+                                                           n_global,&n_local))
+                                      {
+                                        double x0,y0,x1,y1;
+                                        double delta;
 
-                                x0=sys->mesh->verts[nn-1][0];
-                                y0=sys->mesh->verts[nn-1][1];
-                                x1=sys->mesh->verts[nn][0];
-                                y1=sys->mesh->verts[nn][1];
+                                        x0=sys->mesh->verts[n_local][0];
+                                        y0=sys->mesh->verts[n_local][1];
+                                        x1=sys->mesh->verts[n_local+1][0];
+                                        y1=sys->mesh->verts[n_local+1][1];
+                                        
+                                        if(x0>sys->x_left_coord)
+                                          {
+                                            printf("The right side is moving in the wrong direction: %g %g\n",
+                                                   x0,sys->x_left_coord);
+                                            abort();
+                                          }
+                                        sys->mesh->verts[n_local][0]=
+                                          sys->x_left_coord;
+                                        delta=(x1-sys->x_left_coord)/(x1-x0);
+                                        sys->mesh->verts[n_local][1]=y0*delta + y1*(1-delta);
+                                      }
+                                  }
+                                else if(nDims==3)
+                                  {
+                                    printf("fixed top right not implemented\n");
+                                    abort();
+                                  }
+                              }
+                            if(sys->staticRight && !sys->staticRightTop)
+                              {
+                                if(nDims==2)
+                                  {
+                                    IJK		ijk;
+                                    unsigned n_global,n_local;
+                                    Grid *grid;
+                                    grid = *(Grid**)ExtensionManager_Get( sys->mesh->info, sys->mesh, 
+                                                                         ExtensionManager_GetHandle( sys->mesh->info, "vertexGrid" ) );
+                                    ijk[0]=grid->sizes[0]-1;
+                                    ijk[1]=grid->sizes[1]-1;
+                                    n_global=RegularMeshUtils_Node_3DTo1D(sys->mesh,ijk);
+                                    if(Mesh_GlobalToDomain(sys->mesh,MT_VERTEX,
+                                                           n_global,&n_local))
+                                      {
+                                        double x0,y0,x1,y1;
+                                        double delta;
 
-                                sys->mesh->verts[nn][0]=x_fixed;
-                                delta=(x1-x_fixed)/(x1-x0);
-                                sys->mesh->verts[nn][1]=y0*delta + y1*(1-delta);
-
-                                printf("Remesh %d %g %g %g %g %g %g %g\n",
-                                       nn,x0,y0,x1,y1,x_fixed,delta,
-                                       sys->mesh->verts[nn][1]);
+                                        x0=sys->mesh->verts[n_local-1][0];
+                                        y0=sys->mesh->verts[n_local-1][1];
+                                        x1=sys->mesh->verts[n_local][0];
+                                        y1=sys->mesh->verts[n_local][1];
+                                        
+                                        if(x1<sys->x_right_coord)
+                                          {
+                                            printf("The right side is moving in the wrong direction: %g %g\n",
+                                                   x1,sys->x_right_coord);
+                                            abort();
+                                          }
+                                        sys->mesh->verts[n_local][0]=sys->x_right_coord;
+                                        delta=(x1-sys->x_right_coord)/(x1-x0);
+                                        sys->mesh->verts[n_local][1]=y0*delta + y1*(1-delta);
+                                      }
+                                  }
+                                else if(nDims==3)
+                                  {
+                                    printf("fixed top right not implemented\n");
+                                    abort();
+                                  }
                               }
                           }
                           



More information about the CIG-COMMITS mailing list