[cig-commits] commit:

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


changeset:   142:19a4ff478938
user:        LukeHodkinson
date:        Tue Aug 26 17:59:11 2008 +0000
files:       Utils/src/ContactVC.c Utils/src/RegularMeshUtils.c Utils/src/RegularMeshUtils.h
description:
Updating the contact variable conditions to
be a bit more useful for the Geomod benchmarks.


diff -r 70f99741dd90 -r 19a4ff478938 Utils/src/ContactVC.c
--- a/Utils/src/ContactVC.c	Tue Aug 26 17:12:55 2008 +0000
+++ b/Utils/src/ContactVC.c	Tue Aug 26 17:59:11 2008 +0000
@@ -241,6 +241,7 @@ void _ContactVC_ReadDictionary( void* va
       Dictionary_Entry_Value_InitFromStruct(vcDictVal, dictionary);
    }
 
+#if 0
    if (vcDictVal) {
       self->depth = Dictionary_Entry_Value_AsInt(
          Dictionary_Entry_Value_GetMember( vcDictVal, "depth" ) );
@@ -252,6 +253,7 @@ void _ContactVC_ReadDictionary( void* va
       self->depth = 0;
       self->includeTop = False;
    }
+#endif
 }
 
 
@@ -290,8 +292,12 @@ IndexSet* _ContactVC_GetSet(void* variab
    Stream*		warningStr = Journal_Register( Error_Type, self->type );
    unsigned	nDims;
    Grid*		vertGrid;
+   CartesianGenerator* gen;
 
    nDims = Mesh_GetDimSize( self->_mesh );
+   gen = self->_mesh->generator;
+   if( strcmp( gen->type, CartesianGenerator_Type ) )
+      abort();
    vertGrid = *(Grid**)ExtensionManager_Get( self->_mesh->info, self->_mesh, 
                                              ExtensionManager_GetHandle( self->_mesh->info, 
                                                                          "vertexGrid" ) );
@@ -331,8 +337,7 @@ IndexSet* _ContactVC_GetSet(void* variab
             set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
          }
          else {
-            abort();
-            /*set = RegularMeshUtils_CreateContactTopSet(self->_mesh);*/
+            set = RegularMeshUtils_CreateContactTopSet(self->_mesh, gen->contactDepth[0][0], gen->contactDepth[0][1]);
          }	
          break;
 			
@@ -344,7 +349,7 @@ IndexSet* _ContactVC_GetSet(void* variab
             set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
          }
          else {
-            set = RegularMeshUtils_CreateContactBottomSet(self->_mesh, self->depth);
+            set = RegularMeshUtils_CreateContactBottomSet(self->_mesh, gen->contactDepth[0][0], gen->contactDepth[0][1]);
          }	
          break;
 			
@@ -356,7 +361,7 @@ IndexSet* _ContactVC_GetSet(void* variab
             set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
          }
          else {
-            set = RegularMeshUtils_CreateContactLeftSet(self->_mesh, self->depth, self->includeTop);
+            set = RegularMeshUtils_CreateContactLeftSet(self->_mesh, gen->contactDepth[1][0], gen->contactDepth[1][1]);
          }	
          break;
 			
@@ -368,7 +373,7 @@ IndexSet* _ContactVC_GetSet(void* variab
             set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
          }
          else {
-            set = RegularMeshUtils_CreateContactRightSet(self->_mesh, self->depth, self->includeTop);
+            set = RegularMeshUtils_CreateContactRightSet(self->_mesh, gen->contactDepth[1][0], gen->contactDepth[1][1]);
          }
          break;
 			
diff -r 70f99741dd90 -r 19a4ff478938 Utils/src/RegularMeshUtils.c
--- a/Utils/src/RegularMeshUtils.c	Tue Aug 26 17:12:55 2008 +0000
+++ b/Utils/src/RegularMeshUtils.c	Tue Aug 26 17:59:11 2008 +0000
@@ -831,7 +831,7 @@ IndexSet* RegularMeshUtils_CreateLocalIn
 	return set;
 }
 
-IndexSet* RegularMeshUtils_CreateContactBottomSet( void* _mesh, int depth ) {
+IndexSet* RegularMeshUtils_CreateContactTopSet( void* _mesh, int lowDepth, int uppDepth ) {
    Mesh* mesh = (Mesh*)_mesh;
    Grid* grid;
    int nNodes;
@@ -841,7 +841,6 @@ IndexSet* RegularMeshUtils_CreateContact
 
    assert( mesh );
    assert( Mesh_GetDimSize( mesh ) == 2 );
-   assert( depth > 0 );
 
    grid = *Mesh_GetExtension( mesh, Grid**, "vertexGrid" );
    nNodes = Mesh_GetDomainSize( mesh, 0 );
@@ -853,10 +852,10 @@ IndexSet* RegularMeshUtils_CreateContact
    bottom = 1;
    top = depth;
 */
-   left = 0;
-   right = grid->sizes[0] - 1;
-   bottom = 1;
-   top = depth;
+   left = lowDepth;
+   right = grid->sizes[0] - 1 - uppDepth;
+   bottom = grid->sizes[1] - 1;
+   top = grid->sizes[1] - 1;
    for( ii = 0; ii < nNodes; ii++ ) {
       Grid_Lift( grid, Mesh_DomainToGlobal( mesh, 0, ii ), ijk );
       if( ijk[0] >= left && ijk[0] <= right && ijk[1] >= bottom && ijk[1] <= top )
@@ -866,7 +865,7 @@ IndexSet* RegularMeshUtils_CreateContact
    return set;
 }
 
-IndexSet* RegularMeshUtils_CreateContactLeftSet( void* _mesh, int depth, Bool includeTop ) {
+IndexSet* RegularMeshUtils_CreateContactBottomSet( void* _mesh, int lowDepth, int uppDepth ) {
    Mesh* mesh = (Mesh*)_mesh;
    Grid* grid;
    int nNodes;
@@ -876,7 +875,40 @@ IndexSet* RegularMeshUtils_CreateContact
 
    assert( mesh );
    assert( Mesh_GetDimSize( mesh ) == 2 );
-   assert( depth > 0 );
+
+   grid = *Mesh_GetExtension( mesh, Grid**, "vertexGrid" );
+   nNodes = Mesh_GetDomainSize( mesh, 0 );
+   set = IndexSet_New( nNodes );
+
+/*
+   left = depth + 1;
+   right = grid->sizes[0] - (depth + 1) - 1;
+   bottom = 1;
+   top = depth;
+*/
+   left = lowDepth;
+   right = grid->sizes[0] - 1 - uppDepth;
+   bottom = 0;
+   top = 0;
+   for( ii = 0; ii < nNodes; ii++ ) {
+      Grid_Lift( grid, Mesh_DomainToGlobal( mesh, 0, ii ), ijk );
+      if( ijk[0] >= left && ijk[0] <= right && ijk[1] >= bottom && ijk[1] <= top )
+	 IndexSet_Add( set, ii );
+   }
+
+   return set;
+}
+
+IndexSet* RegularMeshUtils_CreateContactLeftSet( void* _mesh, int lowDepth, int uppDepth ) {
+   Mesh* mesh = (Mesh*)_mesh;
+   Grid* grid;
+   int nNodes;
+   IndexSet* set;
+   int ijk[2], left, right, bottom, top;
+   int ii;
+
+   assert( mesh );
+   assert( Mesh_GetDimSize( mesh ) == 2 );
 
    grid = *Mesh_GetExtension( mesh, Grid**, "vertexGrid" );
    nNodes = Mesh_GetDomainSize( mesh, 0 );
@@ -888,11 +920,10 @@ IndexSet* RegularMeshUtils_CreateContact
    bottom = depth + 1;
    top = grid->sizes[1] - 2;
 */
-   left = 1;
-   right = depth;
-   bottom = 1;
-   top = grid->sizes[1] - 2;
-   if( includeTop ) top++;
+   left = 0;
+   right = 0;
+   bottom = lowDepth;
+   top = grid->sizes[1] - 1 - uppDepth;
    for( ii = 0; ii < nNodes; ii++ ) {
       Grid_Lift( grid, Mesh_DomainToGlobal( mesh, 0, ii ), ijk );
       if( ijk[0] >= left && ijk[0] <= right && ijk[1] >= bottom && ijk[1] <= top )
@@ -902,7 +933,7 @@ IndexSet* RegularMeshUtils_CreateContact
    return set;
 }
 
-IndexSet* RegularMeshUtils_CreateContactRightSet( void* _mesh, int depth, Bool includeTop ) {
+IndexSet* RegularMeshUtils_CreateContactRightSet( void* _mesh, int lowDepth, int uppDepth ) {
    Mesh* mesh = (Mesh*)_mesh;
    Grid* grid;
    int nNodes;
@@ -912,7 +943,6 @@ IndexSet* RegularMeshUtils_CreateContact
 
    assert( mesh );
    assert( Mesh_GetDimSize( mesh ) == 2 );
-   assert( depth > 0 );
 
    grid = *Mesh_GetExtension( mesh, Grid**, "vertexGrid" );
    nNodes = Mesh_GetDomainSize( mesh, 0 );
@@ -924,11 +954,10 @@ IndexSet* RegularMeshUtils_CreateContact
    bottom = depth + 1;
    top = grid->sizes[1] - 2;
 */
-   left = grid->sizes[0] - depth - 1;
-   right = grid->sizes[0] - 2;
-   bottom = 1;
-   top = grid->sizes[1] - 2;
-   if( includeTop ) top++;
+   left = grid->sizes[0] - 1;
+   right = grid->sizes[0] - 1;
+   bottom = lowDepth;
+   top = grid->sizes[1] - uppDepth - 1;
    for( ii = 0; ii < nNodes; ii++ ) {
       Grid_Lift( grid, Mesh_DomainToGlobal( mesh, 0, ii ), ijk );
       if( ijk[0] >= left && ijk[0] <= right && ijk[1] >= bottom && ijk[1] <= top )
diff -r 70f99741dd90 -r 19a4ff478938 Utils/src/RegularMeshUtils.h
--- a/Utils/src/RegularMeshUtils.h	Tue Aug 26 17:12:55 2008 +0000
+++ b/Utils/src/RegularMeshUtils.h	Tue Aug 26 17:59:11 2008 +0000
@@ -137,9 +137,10 @@
 	/** Create a new set, based on node indices, of nodes on the back of the local regular mesh */
 	IndexSet* RegularMeshUtils_CreateLocalInGlobalBackSet( void* _mesh );
 
-IndexSet* RegularMeshUtils_CreateContactBottomSet( void* _mesh, int depth );
-IndexSet* RegularMeshUtils_CreateContactLeftSet( void* _mesh, int depth, Bool includeTop );
-IndexSet* RegularMeshUtils_CreateContactRightSet( void* _mesh, int depth, Bool includeTop );
+IndexSet* RegularMeshUtils_CreateContactTopSet( void* _mesh, int lowDepth, int uppDepth );
+IndexSet* RegularMeshUtils_CreateContactBottomSet( void* _mesh, int lowDepth, int uppDepth );
+IndexSet* RegularMeshUtils_CreateContactLeftSet( void* _mesh, int lowDepth, int uppDepth );
+IndexSet* RegularMeshUtils_CreateContactRightSet( void* _mesh, int lowDepth, int uppDepth );
 
 	Node_DomainIndex RegularMeshUtils_GetDiagOppositeAcrossElementNodeIndex( void* _mesh, 
 										 Element_DomainIndex refElement_dI, 



More information about the CIG-COMMITS mailing list