[cig-commits] commit:

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


changeset:   124:446c4ae3aefe
user:        LukeHodkinson
date:        Tue Jul 29 14:18:43 2008 +0000
files:       Utils/src/ContactVC.c Utils/src/ContactVC.h Utils/src/ContactVC.meta Utils/src/Init.c Utils/src/RegularMeshUtils.c Utils/src/RegularMeshUtils.h Utils/src/Utils.h Utils/src/types.h
description:
Adding a VC for allowing proper contact
friction boundary layers.


diff -r b356d36e9e3d -r 446c4ae3aefe Utils/src/ContactVC.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/src/ContactVC.c	Tue Jul 29 14:18:43 2008 +0000
@@ -0,0 +1,391 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+** $Id: ContactVC.c 4153 2007-07-26 02:25:22Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <mpi.h>
+#include <StGermain/StGermain.h>
+
+#include <StgDomain/Geometry/Geometry.h>
+#include <StgDomain/Shape/Shape.h>
+#include <StgDomain/Mesh/Mesh.h>
+
+#include "types.h"
+#include "WallVC.h"
+#include "ContactVC.h"
+#include "RegularMeshUtils.h"
+
+#include <string.h>
+#include <assert.h>
+
+
+const Type ContactVC_Type = "ContactVC";
+const Name defaultContactVCName = "defaultContactVCName";
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+VariableCondition* ContactVC_Factory(
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*			conFunc_Register, 
+	Dictionary*					dictionary,
+	void*						data )
+{
+	return (VariableCondition*)ContactVC_New( defaultContactVCName, NULL, variable_Register, conFunc_Register, dictionary, (Mesh*)data );
+}
+
+
+ContactVC*	ContactVC_DefaultNew( Name name )
+{
+	return _ContactVC_New(
+		sizeof(ContactVC), 
+		ContactVC_Type, 
+		_ContactVC_Delete, 
+		_WallVC_Print, 
+		_WallVC_Copy,
+		(Stg_Component_DefaultConstructorFunction*)ContactVC_DefaultNew,
+		_ContactVC_Construct,	
+		_ContactVC_Build,
+		_VariableCondition_Initialise,
+		_VariableCondition_Execute,
+		_VariableCondition_Destroy,
+		name,
+		False,
+		_WallVC_BuildSelf, 
+		_WallVC_PrintConcise,
+		_ContactVC_ReadDictionary,
+		_ContactVC_GetSet, 
+		_WallVC_GetVariableCount, 
+		_WallVC_GetVariableIndex, 
+		_WallVC_GetValueIndex, 
+		_WallVC_GetValueCount, 
+		_WallVC_GetValue,
+		_VariableCondition_Apply, 
+		NULL,
+		NULL, 
+		NULL, 
+		NULL, 
+		NULL);
+}
+
+ContactVC*	ContactVC_New(
+	Name						name,
+	Name						_dictionaryEntryName, 
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*			conFunc_Register, 
+	Dictionary*					dictionary,
+	void*						_mesh )
+{
+	return _ContactVC_New(
+		sizeof(ContactVC), 
+		ContactVC_Type, 
+		_ContactVC_Delete, 
+		_WallVC_Print, 
+		_WallVC_Copy,
+		(Stg_Component_DefaultConstructorFunction*)ContactVC_DefaultNew,
+		_ContactVC_Construct,	
+		_ContactVC_Build,
+		_VariableCondition_Initialise,
+		_VariableCondition_Execute,
+		_VariableCondition_Destroy,
+		name,
+		True,
+		_WallVC_BuildSelf, 
+		_WallVC_PrintConcise,
+		_ContactVC_ReadDictionary,
+		_ContactVC_GetSet, 
+		_WallVC_GetVariableCount, 
+		_WallVC_GetVariableIndex, 
+		_WallVC_GetValueIndex, 
+		_WallVC_GetValueCount, 
+		_WallVC_GetValue,
+		_VariableCondition_Apply, 
+		_dictionaryEntryName,
+		variable_Register, 
+		conFunc_Register, 
+		dictionary, 
+		_mesh );
+}
+
+
+ContactVC* _ContactVC_New( 
+	SizeT						_sizeOfSelf, 
+	Type						type,
+	Stg_Class_DeleteFunction*				_delete,
+	Stg_Class_PrintFunction*				_print,
+	Stg_Class_CopyFunction*				_copy, 
+	Stg_Component_DefaultConstructorFunction*	_defaultConstructor,
+	Stg_Component_ConstructFunction*			_construct,
+	Stg_Component_BuildFunction*			_build,
+	Stg_Component_InitialiseFunction*			_initialise,
+	Stg_Component_ExecuteFunction*			_execute,
+	Stg_Component_DestroyFunction*			_destroy,
+	Name								name, 
+	Bool								initFlag,
+	VariableCondition_BuildSelfFunc*		_buildSelf, 
+	VariableCondition_PrintConciseFunc*		_printConcise,
+	VariableCondition_ReadDictionaryFunc*		_readDictionary,
+	VariableCondition_GetSetFunc*			_getSet,
+	VariableCondition_GetVariableCountFunc*		_getVariableCount,
+	VariableCondition_GetVariableIndexFunc*		_getVariableIndex,
+	VariableCondition_GetValueIndexFunc*		_getValueIndex,
+	VariableCondition_GetValueCountFunc*		_getValueCount,
+	VariableCondition_GetValueFunc*			_getValue,
+	VariableCondition_ApplyFunc*			_apply, 
+	Name						_dictionaryEntryName, 
+	Variable_Register*				variable_Register, 
+	ConditionFunction_Register*			conFunc_Register, 
+	Dictionary*					dictionary,
+	void*						_mesh)
+{
+	ContactVC*	self;
+	
+	/* Allocate memory/General info */
+	assert(_sizeOfSelf >= sizeof(ContactVC));
+	self = (ContactVC*)_WallVC_New(
+		_sizeOfSelf, 
+		type, 
+		_delete, 
+		_print,
+		_copy,
+		_defaultConstructor,
+		_construct,	
+		_build,
+		_initialise,
+		_execute,
+		_destroy,
+		name,
+		initFlag,
+		_buildSelf, 
+		_printConcise,	
+		_readDictionary,
+		_getSet, 
+		_getVariableCount, 
+		_getVariableIndex, 
+		_getValueIndex, 
+		_getValueCount, 
+		_getValue, 
+		_apply, 
+		_dictionaryEntryName,
+		variable_Register, 
+		conFunc_Register,
+		dictionary,
+		_mesh );
+	
+	/* Virtual info */
+	
+	/* Stg_Class info */
+	if( initFlag ){
+		_ContactVC_Init( self, _dictionaryEntryName, _mesh );
+	}
+	
+	return self;
+}
+
+
+void _ContactVC_Init(
+	void*						wallVC, 
+	Name						_dictionaryEntryName, 
+	void*						_mesh )
+{
+	ContactVC*			self = (ContactVC*)wallVC;
+
+	self->depth = 0;
+	self->includeTop = False;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _ContactVC_ReadDictionary( void* variableCondition, void* dictionary ) {
+	ContactVC* self = (ContactVC*)variableCondition;
+	Dictionary_Entry_Value *vcDictVal, _vcDictVal, *entryVal;
+
+	_WallVC_ReadDictionary( variableCondition, dictionary );
+
+	/* Find dictionary entry */
+	if (self->_dictionaryEntryName)
+		vcDictVal = Dictionary_Get(dictionary, self->_dictionaryEntryName);
+	else
+	{
+		vcDictVal = &_vcDictVal;
+		Dictionary_Entry_Value_InitFromStruct(vcDictVal, dictionary);
+	}
+
+	if (vcDictVal) {
+	   self->depth = Dictionary_Entry_Value_AsInt(
+	      Dictionary_Entry_Value_GetMember( vcDictVal, "depth" ) );
+	   entryVal = Dictionary_Entry_Value_GetMember( vcDictVal, "includeTop" );
+	   if( entryVal )
+	      self->includeTop = Dictionary_Entry_Value_AsBool( entryVal );
+	}
+	else {
+	   self->depth = 0;
+	   self->includeTop = False;
+	}
+}
+
+
+void _ContactVC_Delete(void* wallVC)
+{
+	ContactVC*	self = (ContactVC*)wallVC;
+	
+	/* Stg_Class_Delete parent */
+	_WallVC_Delete(self);
+}
+
+void _ContactVC_Build(  void* wallVC, void* data ) {
+	ContactVC*			self = (ContactVC*)wallVC;
+	
+	_WallVC_Build( self, data );
+}
+	
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _ContactVC_Construct( void* wallVC, Stg_ComponentFactory* cf, void* data )
+{
+	
+}
+
+IndexSet* _ContactVC_GetSet(void* variableCondition) {
+	ContactVC*		self = (ContactVC*)variableCondition;
+	IndexSet*	set = NULL;
+	Stream*		warningStr = Journal_Register( Error_Type, self->type );
+	unsigned	nDims;
+	Grid*		vertGrid;
+
+	nDims = Mesh_GetDimSize( self->_mesh );
+	vertGrid = *(Grid**)ExtensionManager_Get( self->_mesh->info, self->_mesh, 
+						  ExtensionManager_GetHandle( self->_mesh->info, 
+									      "vertexGrid" ) );
+	
+	switch (self->_wall) {
+	case WallVC_Wall_Front:
+		if ( nDims < 3 || !vertGrid->sizes[2] ) {
+			Journal_Printf( warningStr, "Warning - in %s: Can't build a %s wall VC "
+					"when mesh has no elements in the %s axis. Returning an empty set.\n", __func__,
+					WallVC_WallEnumToStr[self->_wall], "K" );
+			set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+		}
+		else {
+		   abort();
+		   /*set = RegularMeshUtils_CreateContactFrontSet( self->_mesh );*/
+		}
+		break;
+			
+	case WallVC_Wall_Back:
+		if ( nDims < 3 || !vertGrid->sizes[2] ) {
+			Journal_Printf( warningStr, "Warning - in %s: Can't build a %s wall VC "
+					"when mesh has no elements in the %s axis. Returning an empty set.\n", __func__,
+					WallVC_WallEnumToStr[self->_wall], "K" );
+			set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+		}
+		else {
+		   abort();
+		   /*set = RegularMeshUtils_CreateContactBackSet( self->_mesh );*/
+		}	
+		break;
+			
+	case WallVC_Wall_Top:
+		if ( nDims < 2 || !vertGrid->sizes[1] ) {
+			Journal_Printf( warningStr, "Warning - in %s: Can't build a %s wall VC "
+					"when mesh has no elements in the %s axis. Returning an empty set.\n", __func__,
+					WallVC_WallEnumToStr[self->_wall], "J" );
+			set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+		}
+		else {
+		   abort();
+		   /*set = RegularMeshUtils_CreateContactTopSet(self->_mesh);*/
+		}	
+		break;
+			
+	case WallVC_Wall_Bottom:
+		if ( nDims < 2 || !vertGrid->sizes[1] ) {
+			Journal_Printf( warningStr, "Warning - in %s: Can't build a %s wall VC "
+					"when mesh has no elements in the %s axis. Returning an empty set.\n", __func__,
+					WallVC_WallEnumToStr[self->_wall], "J" );
+			set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+		}
+		else {
+		   set = RegularMeshUtils_CreateContactBottomSet(self->_mesh, self->depth);
+		}	
+		break;
+			
+	case WallVC_Wall_Left:
+		if ( nDims < 1 ) {
+			Journal_Printf( warningStr, "Warning - in %s: Can't build a %s wall VC "
+					"when mesh has no elements in the %s axis. Returning an empty set.\n", __func__,
+					WallVC_WallEnumToStr[self->_wall], "I" );
+			set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+		}
+		else {
+		   set = RegularMeshUtils_CreateContactLeftSet(self->_mesh, self->depth, self->includeTop);
+		}	
+		break;
+			
+	case WallVC_Wall_Right:
+		if( nDims < 1 ) {
+			Journal_Printf( warningStr, "Warning - in %s: Can't build a %s wall VC "
+					"when mesh has no elements in the %s axis. Returning an empty set.\n", __func__,
+					WallVC_WallEnumToStr[self->_wall], "I" );
+			set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+		}
+		else {
+		   set = RegularMeshUtils_CreateContactRightSet(self->_mesh, self->depth, self->includeTop);
+		}
+		break;
+			
+	case WallVC_Wall_Size:
+	default:
+		assert(0);
+		break;
+	}
+	
+	return set;
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
diff -r b356d36e9e3d -r 446c4ae3aefe Utils/src/ContactVC.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/src/ContactVC.h	Tue Jul 29 14:18:43 2008 +0000
@@ -0,0 +1,168 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+**	Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+**	Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+**	Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+**	Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+**	Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+**	Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+**  This library is free software; you can redistribute it and/or
+**  modify it under the terms of the GNU Lesser General Public
+**  License as published by the Free Software Foundation; either
+**  version 2.1 of the License, or (at your option) any later version.
+**
+**  This library is distributed in the hope that it will be useful,
+**  but WITHOUT ANY WARRANTY; without even the implied warranty of
+**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+**  Lesser General Public License for more details.
+**
+**  You should have received a copy of the GNU Lesser General Public
+**  License along with this library; if not, write to the Free Software
+**  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+**
+*/
+/** \file
+**  Role: Allows variable conditions to be defined on the walls of a regular mesh.
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: ContactVC.h 4153 2007-07-26 02:25:22Z LukeHodkinson $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __Domain_Utils_ContactVC_h__
+#define __Domain_Utils_ContactVC_h__
+	
+
+	extern const Type ContactVC_Type;
+	
+	
+	#define __ContactVC \
+		/* General info */ \
+		__WallVC \
+		\
+		/* Virtual info */ \
+		\
+		/* Stg_Class info */ \
+		int depth; \
+		Bool includeTop;
+
+	struct _ContactVC { __ContactVC };
+	
+	
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Constructor
+	*/
+	
+	VariableCondition*	ContactVC_Factory(
+						Variable_Register*				variable_Register, 
+						ConditionFunction_Register*			conFunc_Register, 
+						Dictionary*					dictionary,
+						void*						data );
+	
+	ContactVC*				ContactVC_DefaultNew( Name name );
+
+	ContactVC*				ContactVC_New(
+						Name						name,
+						Name						_dictionaryEntryName, 
+						Variable_Register*				variable_Register, 
+						ConditionFunction_Register*			conFunc_Register, 
+						Dictionary*					dictionary,
+						void*						_mesh );
+	
+	void				ContactVC_Init(
+						ContactVC*						self,
+						Name						name,
+						Name						_dictionaryEntryName, 
+						Variable_Register*				variable_Register, 
+						ConditionFunction_Register*			conFunc_Register, 
+						Dictionary*					dictionary,
+						void*						_mesh );
+	
+	ContactVC*				_ContactVC_New( 
+						SizeT						_sizeOfSelf, 
+						Type						type,
+						Stg_Class_DeleteFunction*				_delete,
+						Stg_Class_PrintFunction*				_print,
+						Stg_Class_CopyFunction*				_copy,
+						Stg_Component_DefaultConstructorFunction*	_defaultConstructor,
+						Stg_Component_ConstructFunction*			_construct,
+						Stg_Component_BuildFunction*			_build,
+						Stg_Component_InitialiseFunction*			_initialise,
+						Stg_Component_ExecuteFunction*			_execute,
+						Stg_Component_DestroyFunction*			_destroy,
+						Name						name, 
+						Bool						initFlag,
+						VariableCondition_BuildSelfFunc*		_buildSelf, 
+						VariableCondition_PrintConciseFunc*		_printConcise,
+						VariableCondition_ReadDictionaryFunc*		_readDictionary,
+						VariableCondition_GetSetFunc*			_getSet,
+						VariableCondition_GetVariableCountFunc*		_getVariableCount,
+						VariableCondition_GetVariableIndexFunc*		_getVariableIndex,
+						VariableCondition_GetValueIndexFunc*		_getValueIndex,
+						VariableCondition_GetValueCountFunc*		_getValueCount,
+						VariableCondition_GetValueFunc*			_getValue,
+						VariableCondition_ApplyFunc*			_apply, 
+						Name						_dictionaryEntryName, 
+						Variable_Register*				variable_Register, 
+						ConditionFunction_Register*			conFunc_Register, 
+						Dictionary*					dictionary,
+						void*						_mesh );
+	
+	void				_ContactVC_Init(
+						void*						wallVC, 
+						Name						_dictionaryEntryName, 
+						void*						_mesh );
+	
+	
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** General virtual functions
+	*/
+	
+	void				_ContactVC_Delete( void* wallVC );
+	
+	void				_ContactVC_Print( void* wallVC, Stream* stream );
+	
+	/* Copy */
+	#define ContactVC_Copy( self ) \
+		(VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
+	#define ContactVC_Copy( self ) \
+		(VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
+	
+	void* _ContactVC_Copy( void* wallVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap );
+	
+	void				_ContactVC_Build(  void* wallVC, void* data );
+	
+	
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Macros
+	*/
+	
+	
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Virtual functions
+	*/
+	
+	void				_ContactVC_Construct( void* wallVC, Stg_ComponentFactory* cf, void* data );
+	
+	void				_ContactVC_ReadDictionary( void* variableCondition, void* dictionary );
+	
+	IndexSet*			_ContactVC_GetSet( void* variableCondition );
+	
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Build functions
+	*/
+	
+	
+	/*--------------------------------------------------------------------------------------------------------------------------
+	** Functions
+	*/
+
+	
+#endif /* __Domain_Utils_ContactVC_h__ */
diff -r b356d36e9e3d -r 446c4ae3aefe Utils/src/ContactVC.meta
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Utils/src/ContactVC.meta	Tue Jul 29 14:18:43 2008 +0000
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">ContactVC</param>
+<param name="Author">...</param>
+<param name="Organisation">VPAC</param>
+<param name="Project">StgDomain</param>
+<param name="Location">./StgDomain/Discretisation/Utils/src/</param>
+<param name="Project Web">http://www.stgermainproject.org/StgDomain.html</param>
+<param name="Copyright">StGermain Framework. Copyright (C) 2003-2005 VPAC.</param>
+<param name="License">The Gnu Lesser General Public License http://www.gnu.org/licenses/lgpl.html</param>
+<param name="Parent">VariableCondition</param>
+<param name="Reference">...</param>
+<param name="Summary">...</param>
+<param name="Description">...</param>
+
+<!--Now the interesting stuff-->
+
+
+<list name="Params">
+
+</list>
+
+<list name="Dependencies">
+
+</list>
+<!-- Add an exmaple XML if possible -->
+<param name="Example">...</param>
+
+</StGermainData>
diff -r b356d36e9e3d -r 446c4ae3aefe Utils/src/Init.c
--- a/Utils/src/Init.c	Thu Jul 24 02:57:18 2008 +0000
+++ b/Utils/src/Init.c	Tue Jul 29 14:18:43 2008 +0000
@@ -45,6 +45,7 @@ Bool StgDomainUtils_Init( int* argc, cha
 	VariableCondition_Register_Add( variableCondition_Register, AllElementsVC_Type, AllElementsVC_Factory );
 	VariableCondition_Register_Add( variableCondition_Register, AllNodesVC_Type, AllNodesVC_Factory );
 	VariableCondition_Register_Add( variableCondition_Register, WallVC_Type, WallVC_Factory );
+	VariableCondition_Register_Add( variableCondition_Register, ContactVC_Type, ContactVC_Factory );
 	VariableCondition_Register_Add( variableCondition_Register, CornerVC_Type, CornerVC_Factory );
 	VariableCondition_Register_Add( variableCondition_Register, InnerWallVC_Type, InnerWallVC_Factory );
 	VariableCondition_Register_Add( variableCondition_Register, MeshShapeVC_Type, MeshShapeVC_Factory );
@@ -61,6 +62,8 @@ Bool StgDomainUtils_Init( int* argc, cha
 				   "0", (void* (*)(Name))OperatorFieldVariable_DefaultNew );
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), WallVC_Type, 
 				   "0", (void* (*)(Name))WallVC_DefaultNew );
+	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), ContactVC_Type, 
+				   "0", (void* (*)(Name))ContactVC_DefaultNew );
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), CornerVC_Type, 
 				   "0", (void* (*)(Name))CornerVC_DefaultNew );
 	Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), InnerWallVC_Type, 
@@ -92,6 +95,7 @@ Bool StgDomainUtils_Init( int* argc, cha
 	RegisterParent( AllElementsVC_Type,            VariableCondition_Type );
 	RegisterParent( AllNodesVC_Type,               VariableCondition_Type );
 	RegisterParent( WallVC_Type,                   VariableCondition_Type );
+	RegisterParent( ContactVC_Type,                   WallVC_Type );
 	RegisterParent( CornerVC_Type,		       VariableCondition_Type );
 	RegisterParent( InnerWallVC_Type,	       VariableCondition_Type );
 	RegisterParent( MeshShapeVC_Type,                  VariableCondition_Type );
diff -r b356d36e9e3d -r 446c4ae3aefe Utils/src/RegularMeshUtils.c
--- a/Utils/src/RegularMeshUtils.c	Thu Jul 24 02:57:18 2008 +0000
+++ b/Utils/src/RegularMeshUtils.c	Tue Jul 29 14:18:43 2008 +0000
@@ -831,6 +831,95 @@ IndexSet* RegularMeshUtils_CreateLocalIn
 	return set;
 }
 
+IndexSet* RegularMeshUtils_CreateContactBottomSet( void* _mesh, int depth ) {
+   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 );
+   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;
+   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 depth, Bool includeTop ) {
+   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 );
+   assert( depth > 0 );
+
+   grid = *Mesh_GetExtension( mesh, Grid**, "vertexGrid" );
+   nNodes = Mesh_GetDomainSize( mesh, 0 );
+   set = IndexSet_New( nNodes );
+
+   left = 1;
+   right = depth;
+   bottom = depth + 1;
+   top = grid->sizes[1] - 2;
+   if( includeTop ) top++;
+   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_CreateContactRightSet( void* _mesh, int depth, Bool includeTop ) {
+   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 );
+   assert( depth > 0 );
+
+   grid = *Mesh_GetExtension( mesh, Grid**, "vertexGrid" );
+   nNodes = Mesh_GetDomainSize( mesh, 0 );
+   set = IndexSet_New( nNodes );
+
+   left = grid->sizes[0] - depth - 1;
+   right = grid->sizes[0] - 2;
+   bottom = depth + 1;
+   top = grid->sizes[1] - 2;
+   if( includeTop ) top++;
+   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;
+}
+
 Node_DomainIndex RegularMeshUtils_GetDiagOppositeAcrossElementNodeIndex( void* _mesh, 
 									 Element_DomainIndex refElement_dI, 
 									 Node_DomainIndex refNode_dI )
diff -r b356d36e9e3d -r 446c4ae3aefe Utils/src/RegularMeshUtils.h
--- a/Utils/src/RegularMeshUtils.h	Thu Jul 24 02:57:18 2008 +0000
+++ b/Utils/src/RegularMeshUtils.h	Tue Jul 29 14:18:43 2008 +0000
@@ -137,6 +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 );
+
 	Node_DomainIndex RegularMeshUtils_GetDiagOppositeAcrossElementNodeIndex( void* _mesh, 
 										 Element_DomainIndex refElement_dI, 
 										 Node_DomainIndex refNode_dI );
diff -r b356d36e9e3d -r 446c4ae3aefe Utils/src/Utils.h
--- a/Utils/src/Utils.h	Thu Jul 24 02:57:18 2008 +0000
+++ b/Utils/src/Utils.h	Tue Jul 29 14:18:43 2008 +0000
@@ -48,6 +48,7 @@
 	#include "AllElementsVC.h"
 	#include "AllNodesVC.h"
 	#include "WallVC.h"
+	#include "ContactVC.h"
 	#include "CornerVC.h"
 	#include "InnerWallVC.h"
 	#include "MeshShapeVC.h"
diff -r b356d36e9e3d -r 446c4ae3aefe Utils/src/types.h
--- a/Utils/src/types.h	Thu Jul 24 02:57:18 2008 +0000
+++ b/Utils/src/types.h	Tue Jul 29 14:18:43 2008 +0000
@@ -50,6 +50,7 @@ typedef struct RegularRemesherCmpt Regul
 	typedef struct _AllElementsVC			AllElementsVC;
 	typedef struct _AllNodesVC			AllNodesVC;
 	typedef struct _WallVC				WallVC;
+	typedef struct _ContactVC ContactVC;
 	typedef struct _InnerWallVC			InnerWallVC;
 	typedef struct _CornerVC			CornerVC;
 	typedef struct MeshShapeVC				MeshShapeVC;



More information about the CIG-COMMITS mailing list