[cig-commits] r7645 - in long/3D/Gale/trunk: . input
src/Gale/Utils/src src/StGermain/Discretisation/Utils/src
walter at geodynamics.org
walter at geodynamics.org
Wed Jul 11 14:02:44 PDT 2007
Author: walter
Date: 2007-07-11 14:02:44 -0700 (Wed, 11 Jul 2007)
New Revision: 7645
Added:
long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c
long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h
long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta
Removed:
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.h
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.meta
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.h
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.meta
Modified:
long/3D/Gale/trunk/
long/3D/Gale/trunk/input/extension.xml
long/3D/Gale/trunk/src/Gale/Utils/src/Init.c
long/3D/Gale/trunk/src/Gale/Utils/src/SConscript
long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h
long/3D/Gale/trunk/src/Gale/Utils/src/types.h
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Init.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SConscript
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Utils.h
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/types.h
Log:
r1861 at earth: boo | 2007-07-11 13:58:02 -0700
Lots of cleanup. Make FrictionVC read the friction coefficient from the input file. Remove SplitFrictionWallVC. Move FrictionVC to Gale/Utils/src.
Property changes on: long/3D/Gale/trunk
___________________________________________________________________
Name: svk:merge
- 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1860
+ 3a629746-de10-0410-b17b-fd6ecaaa963e:/cig:1861
Modified: long/3D/Gale/trunk/input/extension.xml
===================================================================
--- long/3D/Gale/trunk/input/extension.xml 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/input/extension.xml 2007-07-11 21:02:44 UTC (rev 7645)
@@ -552,6 +552,7 @@
<struct>
<param name="type">FrictionVC</param>
<param name="wall">bottom</param>
+ <param name="StaticFriction">0.1</param>
<list name="variables">
<struct>
<param name="name">vx</param>
Added: long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.c 2007-07-11 21:02:44 UTC (rev 7645)
@@ -0,0 +1,781 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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 file may be distributed under the terms of the VPAC Public License
+** as defined by VPAC of Australia and appearing in the file
+** LICENSE.VPL included in the packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** $Id: FrictionVC.c 3310 2005-10-26 07:10:18Z RobertTurnbull $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* Modified 2006 Walter Landry to implement Friction VC's */
+
+#include <mpi.h>
+
+#include <StGermain/StGermain.h>
+#include <StgFEM/StgFEM.h>
+
+#include "types.h"
+#include "FrictionVC.h"
+
+#include <string.h>
+#include <assert.h>
+
+
+const Type FrictionVC_Type = "FrictionVC";
+const Name defaultFrictionVCName = "defaultFrictionVCName";
+
+const char* FrictionVC_WallEnumToStr[FrictionVC_Wall_Size] = {
+ "back",
+ "left",
+ "bottom",
+ "right",
+ "top",
+ "front" };
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Constructor
+*/
+
+VariableCondition* FrictionVC_Factory(
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* data )
+{
+ return (VariableCondition*)FrictionVC_New( defaultFrictionVCName, NULL, variable_Register, conFunc_Register, dictionary, (Mesh*)data );
+}
+
+
+FrictionVC* FrictionVC_DefaultNew( Name name )
+{
+ return _FrictionVC_New(
+ sizeof(FrictionVC),
+ FrictionVC_Type,
+ _FrictionVC_Delete,
+ _FrictionVC_Print,
+ _FrictionVC_Copy,
+ (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew,
+ _FrictionVC_Construct,
+ _FrictionVC_Build,
+ _VariableCondition_Initialise,
+ _VariableCondition_Execute,
+ _VariableCondition_Destroy,
+ name,
+ False,
+ _FrictionVC_BuildSelf,
+ _FrictionVC_PrintConcise,
+ _FrictionVC_ReadDictionary,
+ _FrictionVC_GetSet,
+ _FrictionVC_GetVariableCount,
+ _FrictionVC_GetVariableIndex,
+ _FrictionVC_GetValueIndex,
+ _FrictionVC_GetValueCount,
+ _FrictionVC_GetValue,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+}
+
+FrictionVC* FrictionVC_New(
+ Name name,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh )
+{
+ return _FrictionVC_New(
+ sizeof(FrictionVC),
+ FrictionVC_Type,
+ _FrictionVC_Delete,
+ _FrictionVC_Print,
+ _FrictionVC_Copy,
+ (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew,
+ _FrictionVC_Construct,
+ _FrictionVC_Build,
+ _VariableCondition_Initialise,
+ _VariableCondition_Execute,
+ _VariableCondition_Destroy,
+ name,
+ True,
+ _FrictionVC_BuildSelf,
+ _FrictionVC_PrintConcise,
+ _FrictionVC_ReadDictionary,
+ _FrictionVC_GetSet,
+ _FrictionVC_GetVariableCount,
+ _FrictionVC_GetVariableIndex,
+ _FrictionVC_GetValueIndex,
+ _FrictionVC_GetValueCount,
+ _FrictionVC_GetValue,
+ _dictionaryEntryName,
+ variable_Register,
+ conFunc_Register,
+ dictionary,
+ _mesh );
+}
+
+
+void FrictionVC_Init(
+ FrictionVC* self,
+ Name name,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh )
+{
+ /* General info */
+ self->type = FrictionVC_Type;
+ self->_sizeOfSelf = sizeof(FrictionVC);
+ self->_deleteSelf = False;
+
+ /* Virtual info */
+ self->_delete = _FrictionVC_Delete;
+ self->_print = _FrictionVC_Print;
+ self->_copy = _FrictionVC_Copy;
+ self->_defaultConstructor = (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew;
+ self->_construct = _FrictionVC_Construct;
+ self->_build = _FrictionVC_Build;
+ self->_initialise = _VariableCondition_Initialise;
+ self->_execute = _VariableCondition_Execute;
+ self->_destroy = _VariableCondition_Destroy;
+ self->_buildSelf = _FrictionVC_BuildSelf;
+ self->_printConcise = _FrictionVC_PrintConcise;
+ self->_readDictionary = _FrictionVC_ReadDictionary;
+ self->_getSet = _FrictionVC_GetSet;
+ self->_getVariableCount = _FrictionVC_GetVariableCount;
+ self->_getVariableIndex = _FrictionVC_GetVariableIndex;
+ self->_getValueIndex = _FrictionVC_GetValueIndex;
+ self->_getValueCount = _FrictionVC_GetValueCount;
+ self->_getValue = _FrictionVC_GetValue;
+
+ _Stg_Class_Init( (Stg_Class*)self );
+ _Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
+ _Stg_Component_Init( (Stg_Component*)self );
+ _VariableCondition_Init( (VariableCondition*)self, variable_Register, conFunc_Register, dictionary );
+
+ /* Stg_Class info */
+ _FrictionVC_Init( self, _dictionaryEntryName, _mesh );
+}
+
+
+FrictionVC* _FrictionVC_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,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh)
+{
+ FrictionVC* self;
+
+ /* Allocate memory/General info */
+ assert(_sizeOfSelf >= sizeof(FrictionVC));
+ self = (FrictionVC*)_VariableCondition_New(
+ _sizeOfSelf,
+ type,
+ _delete,
+ _print,
+ _copy,
+ _defaultConstructor,
+ _construct,
+ _build,
+ _initialise,
+ _execute,
+ _destroy,
+ name,
+ initFlag,
+ _buildSelf,
+ _printConcise,
+ _readDictionary,
+ _getSet,
+ _getVariableCount,
+ _getVariableIndex,
+ _getValueIndex,
+ _getValueCount,
+ _getValue,
+ variable_Register,
+ conFunc_Register,
+ dictionary );
+
+ /* Virtual info */
+
+ /* Stg_Class info */
+ if( initFlag ){
+ _FrictionVC_Init( self, _dictionaryEntryName, _mesh );
+ }
+
+ return self;
+}
+
+
+void _FrictionVC_Init(
+ void* frictionVC,
+ Name _dictionaryEntryName,
+ void* _mesh )
+{
+ FrictionVC* self = (FrictionVC*)frictionVC;
+
+ self->isConstructed = True;
+ self->_dictionaryEntryName = _dictionaryEntryName;
+ self->_mesh = (Mesh*)_mesh;
+ self->_wall = FrictionVC_Wall_Size;
+ self->_entryTbl = 0;
+ self->_entryCount = 0;
+ self->context=NULL;
+ self->pressure=NULL;
+ self->deviatoric_stress=NULL;
+ self->friction=0;
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** General virtual functions
+*/
+
+void _FrictionVC_ReadDictionary( void* variableCondition, void* dictionary ) {
+ FrictionVC* self = (FrictionVC*)variableCondition;
+ Dictionary_Entry_Value* vcDictVal;
+ Dictionary_Entry_Value _vcDictVal;
+ Dictionary_Entry_Value* varsVal;
+ FrictionVC_Entry_Index entry_I;
+
+ /* Find dictionary entry */
+ if (self->_dictionaryEntryName)
+ vcDictVal = Dictionary_Get(dictionary, self->_dictionaryEntryName);
+ else
+ {
+ vcDictVal = &_vcDictVal;
+ Dictionary_Entry_Value_InitFromStruct(vcDictVal, dictionary);
+ }
+
+ if (vcDictVal)
+ {
+ char* wallStr;
+
+ /* Obtain which wall */
+ wallStr = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcDictVal, "wall" ));
+ if (!strcasecmp(wallStr, "back"))
+ self->_wall = FrictionVC_Wall_Back;
+ else if (!strcasecmp(wallStr, "left"))
+ self->_wall = FrictionVC_Wall_Left;
+ else if (!strcasecmp(wallStr, "bottom"))
+ self->_wall = FrictionVC_Wall_Bottom;
+ else if (!strcasecmp(wallStr, "right"))
+ self->_wall = FrictionVC_Wall_Right;
+ else if (!strcasecmp(wallStr, "top"))
+ self->_wall = FrictionVC_Wall_Top;
+ else if (!strcasecmp(wallStr, "front"))
+ self->_wall = FrictionVC_Wall_Front;
+ else {
+ assert( 0 );
+ self->_wall = FrictionVC_Wall_Size; /* invalid entry */
+ }
+
+ /* Obtain the variable entries */
+ self->_entryCount = Dictionary_Entry_Value_GetCount(Dictionary_Entry_Value_GetMember(vcDictVal, "variables"));
+ self->_entryTbl = Memory_Alloc_Array( FrictionVC_Entry, self->_entryCount, "FrictionVC->_entryTbl" );
+ varsVal = Dictionary_Entry_Value_GetMember(vcDictVal, "variables");
+
+ self->friction = Dictionary_Entry_Value_AsDouble(Dictionary_Entry_Value_GetMember(vcDictVal, "StaticFriction"));
+
+ for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
+ {
+ char* valType;
+ Dictionary_Entry_Value* valueEntry;
+ Dictionary_Entry_Value* varDictListVal;
+
+ varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
+ valueEntry = Dictionary_Entry_Value_GetMember(varDictListVal, "value");
+
+ self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
+ Dictionary_Entry_Value_GetMember(varDictListVal, "name"));
+
+ valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(varDictListVal, "type"));
+ if (0 == strcasecmp(valType, "func"))
+ {
+ char* funcName = Dictionary_Entry_Value_AsString(valueEntry);
+ Index cfIndex;
+
+ self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
+ cfIndex = ConditionFunction_Register_GetIndex( self->conFunc_Register, funcName);
+ if ( cfIndex == (unsigned)-1 ) {
+ Stream* errorStr = Journal_Register( Error_Type, self->type );
+
+ Journal_Printf( errorStr, "Error- in %s: While parsing "
+ "definition of frictionVC \"%s\" (applies to wall \"%s\"), the cond. func. applied to "
+ "variable \"%s\" - \"%s\" - wasn't found in the c.f. register.\n",
+ __func__, self->_dictionaryEntryName, FrictionVC_WallEnumToStr[self->_wall],
+ self->_entryTbl[entry_I].varName, funcName );
+ Journal_Printf( errorStr, "(Available functions in the C.F. register are: ");
+ ConditionFunction_Register_PrintNameOfEachFunc( self->conFunc_Register, errorStr );
+ Journal_Printf( errorStr, ")\n");
+ assert(0);
+ }
+ self->_entryTbl[entry_I].value.as.typeCFIndex = cfIndex;
+ }
+ else if (0 == strcasecmp(valType, "array"))
+ {
+ Dictionary_Entry_Value* valueElement;
+ Index i;
+
+ self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
+ self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
+ self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
+ self->_entryTbl[entry_I].value.as.typeArray.size, "FrictionVC->_entryTbl[].value.as.typeArray.array" );
+
+ for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
+ {
+ valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
+ self->_entryTbl[entry_I].value.as.typeArray.array[i] =
+ Dictionary_Entry_Value_AsDouble(valueElement);
+ }
+ }
+ else if( 0 == strcasecmp( valType, "double" ) || 0 == strcasecmp( valType, "d" ) ||
+ 0 == strcasecmp( valType, "float" ) || 0 == strcasecmp( valType, "f" ) )
+ {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
+ self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+ }
+ else if( 0 == strcasecmp( valType, "integer" ) || 0 == strcasecmp( valType, "int" ) || 0 == strcasecmp( valType, "i" ) ) {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
+ self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+ }
+ else if( 0 == strcasecmp( valType, "short" ) || 0 == strcasecmp( valType, "s" ) ) {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
+ self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+ }
+ else if( 0 == strcasecmp( valType, "char" ) || 0 == strcasecmp( valType, "c" ) ) {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
+ self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
+ }
+ else if( 0 == strcasecmp( valType, "pointer" ) || 0 == strcasecmp( valType, "ptr" ) || 0 == strcasecmp( valType, "p" ) ) {
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
+ self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
+ }
+ else {
+ /* Assume double */
+ Journal_DPrintf(
+ Journal_Register( InfoStream_Type, "myStream" ),
+ "Type to variable on variable condition not given, assuming double\n" );
+ self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
+ self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
+ }
+ }
+ }
+ else
+ {
+ self->_wall = FrictionVC_Wall_Size;
+ self->_entryCount = 0;
+ self->_entryTbl = NULL;
+ self->context=NULL;
+ self->pressure=NULL;
+ self->deviatoric_stress=NULL;
+ self->friction=0;
+ }
+}
+
+
+void _FrictionVC_Delete(void* frictionVC)
+{
+ FrictionVC* self = (FrictionVC*)frictionVC;
+
+ if (self->_entryTbl) Memory_Free(self->_entryTbl);
+
+ /* Stg_Class_Delete parent */
+ _VariableCondition_Delete(self);
+}
+
+
+void _FrictionVC_Print(void* frictionVC, Stream* stream)
+{
+ FrictionVC* self = (FrictionVC*)frictionVC;
+ FrictionVC_Entry_Index entry_I;
+ Index i;
+
+ /* Set the Journal for printing informations */
+ Stream* info = stream;
+
+ /* General info */
+ Journal_Printf( info, "FrictionVC (ptr): %p\n", self);
+
+ /* Virtual info */
+
+ /* Stg_Class info */
+ Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
+ Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
+ if (self->_dictionaryEntryName)
+ Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
+ Journal_Printf( info, "\t_wall: %s\n", self->_wall == FrictionVC_Wall_Front ? "Front" :
+ self->_wall == FrictionVC_Wall_Back ? "Back" : self->_wall == FrictionVC_Wall_Left ? "Left" :
+ self->_wall == FrictionVC_Wall_Right ? "Right" : self->_wall == FrictionVC_Wall_Top ? "Top" :
+ self->_wall == FrictionVC_Wall_Bottom ? "Bottom" : "None");
+ Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
+ Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
+ if (self->_entryTbl)
+ for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
+ {
+ Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
+ Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
+ if (self->_entryTbl[entry_I].varName)
+ Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
+ Journal_Printf( info, "\t\t\tvalue:\n");
+ switch (self->_entryTbl[entry_I].value.type)
+ {
+ case VC_ValueType_Double:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
+ Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
+ break;
+
+ case VC_ValueType_Int:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
+ Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
+ break;
+
+ case VC_ValueType_Short:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
+ Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
+ break;
+
+ case VC_ValueType_Char:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
+ Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
+ break;
+
+ case VC_ValueType_Ptr:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
+ Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
+ break;
+
+ case VC_ValueType_DoubleArray:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
+ Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
+ Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n",
+ self->_entryTbl[entry_I].value.as.typeArray.array);
+ if (self->_entryTbl[entry_I].value.as.typeArray.array)
+ for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
+ Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
+ self->_entryTbl[entry_I].value.as.typeArray.array[i]);
+ break;
+
+ case VC_ValueType_CFIndex:
+ Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
+ Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
+ break;
+ }
+ }
+ Journal_Printf( info, "\t_mesh (ptr): %p\n", self->_mesh);
+
+ /* Print parent */
+ _VariableCondition_Print(self);
+}
+
+
+void* _FrictionVC_Copy( void* frictionVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
+ FrictionVC* self = (FrictionVC*)frictionVC;
+ FrictionVC* newFrictionVC;
+ PtrMap* map = ptrMap;
+ Bool ownMap = False;
+
+ if( !map ) {
+ map = PtrMap_New( 10 );
+ ownMap = True;
+ }
+
+ newFrictionVC = (FrictionVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
+
+ newFrictionVC->_dictionaryEntryName = self->_dictionaryEntryName;
+ newFrictionVC->_wall = self->_wall;
+ newFrictionVC->_entryCount = self->_entryCount;
+ newFrictionVC->context = self->context;
+ newFrictionVC->pressure = self->pressure;
+ newFrictionVC->deviatoric_stress = self->deviatoric_stress;
+ newFrictionVC->friction = self->friction;
+
+ if( deep ) {
+ newFrictionVC->_mesh = (Mesh*)Stg_Class_Copy( self->_mesh, NULL, deep, nameExt, map );
+
+ if( (newFrictionVC->_entryTbl = PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
+ newFrictionVC->_entryTbl = Memory_Alloc_Array( FrictionVC_Entry, newFrictionVC->_entryCount, "FrictionVC->_entryTbl");
+ memcpy( newFrictionVC->_entryTbl, self->_entryTbl, sizeof(FrictionVC_Entry) * newFrictionVC->_entryCount );
+ PtrMap_Append( map, newFrictionVC->_entryTbl, self->_entryTbl );
+ }
+ }
+ else {
+ newFrictionVC->_mesh = self->_mesh;
+ newFrictionVC->_entryTbl = self->_entryTbl;
+ }
+
+ if( ownMap ) {
+ Stg_Class_Delete( map );
+ }
+
+ return (void*)newFrictionVC;
+}
+
+
+void _FrictionVC_Build( void* frictionVC, void* data ) {
+ FrictionVC* self = (FrictionVC*)frictionVC;
+
+ _FrictionVC_BuildSelf( self, data );
+
+ _VariableCondition_Build( self, data );
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Macros
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _FrictionVC_Construct( void* frictionVC, Stg_ComponentFactory* cf, void* data )
+{
+
+}
+
+void _FrictionVC_BuildSelf( void* frictionVC, void* data ) {
+ FrictionVC* self = (FrictionVC*)frictionVC;
+
+ self->context=(FiniteElementContext *)data;
+ if( self->_mesh ) {
+ Build( self->_mesh, data, False );
+ }
+}
+
+
+IndexSet* _FrictionVC_GetSet(void* variableCondition)
+{
+ FrictionVC* self = (FrictionVC*)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" ) );
+ /* We get the stress and pressure here. It requires that you
+ name your pressure and stress as PressureField and
+ StressField. I could not figure out how to get it to work
+ by reading the dictionary, because things are not built
+ when the dictionary is read. */
+ if(!self->deviatoric_stress)
+ self->deviatoric_stress = (FeVariable*)FieldVariable_Register_GetByName
+ ( self->context->fieldVariable_Register, "StressField" );
+ if(!self->pressure)
+ self->pressure = (FeVariable*)FieldVariable_Register_GetByName
+ ( self->context->fieldVariable_Register, "PressureField" );
+
+ switch (self->_wall) {
+ case FrictionVC_Wall_Front:
+ if ( nDims < 3 || !vertGrid->sizes[2] ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalFrontSet( self->_mesh );
+ }
+ break;
+
+ case FrictionVC_Wall_Back:
+ if ( nDims < 3 || !vertGrid->sizes[2] ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalBackSet( self->_mesh );
+ }
+ break;
+
+ case FrictionVC_Wall_Top:
+ if ( nDims < 2 || !vertGrid->sizes[1] ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalTopSet(self->_mesh);
+ }
+ break;
+
+ case FrictionVC_Wall_Bottom:
+ if ( nDims < 2 || !vertGrid->sizes[1] ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ if(self->deviatoric_stress!=NULL && self->deviatoric_stress->dofLayout!=NULL)
+ {
+ Node_LocalIndex n_i;
+ unsigned nNodes;
+ IJK ijk;
+
+ nNodes = Mesh_GetDomainSize( self->_mesh, MT_VERTEX );
+ set = IndexSet_New( nNodes );
+ for( n_i = 0; n_i < nNodes; n_i++ ) {
+ RegularMeshUtils_Node_1DTo3D( self->_mesh, Mesh_DomainToGlobal( self->_mesh, MT_VERTEX, n_i ), ijk );
+ if(ijk[1]==0)
+ {
+ double str[6], p;
+ FeVariable_GetValueAtNode(self->deviatoric_stress,n_i,str);
+ FeVariable_GetValueAtNode(self->pressure,n_i,&p);
+
+ /* For now, assume that the bottom is flat
+ and not inclined.*/
+
+ /* The ordering for components of stress
+ is: xx, yy, zz, xy, xz, zz */
+
+ if((nDims==2
+ && (str[2]==0 ||
+ self->friction*(p-str[1])>fabs(str[2])))
+ || (nDims==3
+ && ((str[3]==0 && str[4]==0)
+ || self->friction*(p-str[1])>sqrt(str[3]*str[3] + str[4]*str[4]))))
+ IndexSet_Add(set,n_i);
+ }
+ }
+ }
+ else
+ {
+ set = RegularMeshUtils_CreateGlobalBottomSet(self->_mesh);
+ }
+ }
+ break;
+
+ case FrictionVC_Wall_Left:
+ if ( nDims < 1 ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalLeftSet(self->_mesh);
+ }
+ break;
+
+ case FrictionVC_Wall_Right:
+ if( nDims < 1 ) {
+ set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
+ }
+ else {
+ set = RegularMeshUtils_CreateGlobalRightSet(self->_mesh);
+ }
+ break;
+
+ case FrictionVC_Wall_Size:
+ default:
+ assert(0);
+ break;
+ }
+
+ return set;
+}
+
+
+VariableCondition_VariableIndex _FrictionVC_GetVariableCount(void* variableCondition, Index globalIndex)
+{
+ FrictionVC* self = (FrictionVC*)variableCondition;
+
+ return self->_entryCount;
+}
+
+
+Variable_Index _FrictionVC_GetVariableIndex(void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex)
+{
+ FrictionVC* self = (FrictionVC*)variableCondition;
+ Variable_Index searchedIndex = 0;
+ Stream* errorStr = Journal_Register( Error_Type, self->type );
+ Name varName;
+
+ varName = self->_entryTbl[varIndex].varName;
+ searchedIndex = Variable_Register_GetIndex(self->variable_Register, varName );
+
+ Journal_Firewall( ( searchedIndex < self->variable_Register->count ), errorStr, "Error- in %s: searching for index of "
+ "varIndex %u (\"%s\") at global node number %u failed - register returned index %u, greater than "
+ "count %u.\n", __func__, varIndex, varName, globalIndex, searchedIndex, self->variable_Register->count );
+
+ return searchedIndex;
+}
+
+
+VariableCondition_ValueIndex _FrictionVC_GetValueIndex(
+ void* variableCondition,
+ Index globalIndex,
+ VariableCondition_VariableIndex varIndex)
+{
+ return varIndex;
+}
+
+
+VariableCondition_ValueIndex _FrictionVC_GetValueCount(void* variableCondition)
+{
+ FrictionVC* self = (FrictionVC*)variableCondition;
+
+ return self->_entryCount;
+}
+
+
+VariableCondition_Value _FrictionVC_GetValue(void* variableCondition, VariableCondition_ValueIndex valIndex)
+{
+ FrictionVC* self = (FrictionVC*)variableCondition;
+
+ return self->_entryTbl[valIndex].value;
+}
+
+void _FrictionVC_PrintConcise( void* variableCondition, Stream* stream ) {
+ FrictionVC* self = (FrictionVC*)variableCondition;
+
+ Journal_Printf( stream, "\ttype: %s, set: ", self->type );
+ Journal_Printf( stream, "%s\n",
+ self->_wall == FrictionVC_Wall_Front ? "Front" :
+ self->_wall == FrictionVC_Wall_Back ? "Back" :
+ self->_wall == FrictionVC_Wall_Left ? "Left" :
+ self->_wall == FrictionVC_Wall_Right ? "Right" :
+ self->_wall == FrictionVC_Wall_Top ? "Top" :
+ self->_wall == FrictionVC_Wall_Bottom ? "Bottom" : "None" );
+}
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Build functions
+*/
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Functions
+*/
Added: long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.h 2007-07-11 21:02:44 UTC (rev 7645)
@@ -0,0 +1,198 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** 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 file may be distributed under the terms of the VPAC Public License
+** as defined by VPAC of Australia and appearing in the file
+** LICENSE.VPL included in the packaging of this file.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+*/
+/** \file
+** Role:
+**
+** Assumptions:
+**
+** Comments:
+**
+** $Id: FrictionVC.h 3291 2005-10-18 00:05:33Z AlanLo $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+/* Modified 2006 Walter Landry to implement Friction VC's */
+
+#ifndef __Gale_BoundaryConditions_FrictionVC_h__
+#define __Gale_BoundaryConditions_FrictionVC_h__
+
+
+ extern const Type FrictionVC_Type;
+
+ extern const char* FrictionVC_WallEnumToStr[FrictionVC_Wall_Size];
+
+ #define __FrictionVC_Entry \
+ Name varName; \
+ VariableCondition_Value value; \
+
+ struct _FrictionVC_Entry { __FrictionVC_Entry };
+
+
+ #define __FrictionVC \
+ /* General info */ \
+ __VariableCondition \
+ \
+ /* Virtual info */ \
+ \
+ /* Stg_Class info */ \
+ Name _dictionaryEntryName; \
+ FrictionVC_Wall _wall; \
+ FrictionVC_Entry_Index _entryCount; \
+ FrictionVC_Entry* _entryTbl; \
+ Mesh* _mesh; \
+ /* I would like to make this a FiniteElementContext*, but */ \
+ /* then there are problems compiling because this is in */ \
+ /* StGermain, and we do not have access to StgFEM yet. */ \
+ FiniteElementContext* context; \
+ FeVariable *deviatoric_stress, *pressure; \
+ double friction;
+
+ struct _FrictionVC { __FrictionVC };
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Constructor
+ */
+
+ VariableCondition* FrictionVC_Factory(
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* data );
+
+ FrictionVC* FrictionVC_DefaultNew( Name name );
+
+ FrictionVC* FrictionVC_New(
+ Name name,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh );
+
+ void FrictionVC_Init(
+ FrictionVC* self,
+ Name name,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh );
+
+ FrictionVC* _FrictionVC_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,
+ Name _dictionaryEntryName,
+ Variable_Register* variable_Register,
+ ConditionFunction_Register* conFunc_Register,
+ Dictionary* dictionary,
+ void* _mesh );
+
+ void _FrictionVC_Init(
+ void* frictionVC,
+ Name _dictionaryEntryName,
+ void* _mesh );
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** General virtual functions
+ */
+
+ void _FrictionVC_Delete( void* frictionVC );
+
+ void _FrictionVC_Print( void* frictionVC, Stream* stream );
+
+ /* Copy */
+ #define FrictionVC_Copy( self ) \
+ (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
+ #define FrictionVC_Copy( self ) \
+ (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
+
+ void* _FrictionVC_Copy( void* frictionVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap );
+
+ void _FrictionVC_Build( void* frictionVC, void* data );
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Macros
+ */
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Virtual functions
+ */
+
+ void _FrictionVC_Construct( void* frictionVC, Stg_ComponentFactory* cf, void* data );
+
+ void _FrictionVC_BuildSelf( void* frictionVC, void* data );
+
+ void _FrictionVC_ReadDictionary( void* variableCondition, void* dictionary );
+
+ IndexSet* _FrictionVC_GetSet( void* variableCondition );
+
+ VariableCondition_VariableIndex _FrictionVC_GetVariableCount( void* variableCondition, Index globalIndex );
+
+ Variable_Index _FrictionVC_GetVariableIndex(
+ void* variableCondition,
+ Index globalIndex,
+ VariableCondition_VariableIndex varIndex );
+
+ VariableCondition_ValueIndex _FrictionVC_GetValueIndex(
+ void* variableCondition,
+ Index globalIndex,
+ VariableCondition_VariableIndex varIndex );
+
+ VariableCondition_ValueIndex _FrictionVC_GetValueCount( void* variableCondition );
+
+ VariableCondition_Value _FrictionVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex );
+
+ void _FrictionVC_PrintConcise( void* variableCondition, Stream* stream );
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Build functions
+ */
+
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Functions
+ */
+
+
+#endif /* __Discretisation_Utils_FrictionVC_h__ */
Added: long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/FrictionVC.meta 2007-07-11 21:02:44 UTC (rev 7645)
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
+<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
+
+<param name="Name">FrictionVC</param>
+<param name="Author">...</param>
+<param name="Organisation">CIG</param>
+<param name="Project">Gale</param>
+<param name="Location">./Gale/BoundaryConditions/src/</param>
+<param name="Project Web">http://geodynamics.org</param>
+<param name="Copyright">StGermain Framework. Copyright (C) 2003-2005 VPAC. Copyright (c) 2006 California Institute of Technology</param>
+<param name="License">https://csd.vpac.org/twiki/bin/view/Stgermain/SoftwareLicense</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">
+ <struct>
+ <param name="Essential">True</param>
+ <param name="Type">RheologyMaterial</param>
+ <param name="Description">Determines the frictional parameters of the wall.</param>
+ </struct>
+
+
+</list>
+<!-- Add an exmaple XML if possible -->
+<param name="Example">...</param>
+
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/Init.c 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/Init.c 2007-07-11 21:02:44 UTC (rev 7645)
@@ -60,5 +60,10 @@
Stg_ComponentRegister_Add( componentRegister, GaleContext_Type, "0", GaleContext_DefaultNew );
RegisterParent( GaleContext_Type, UnderworldContext_Type );
+ VariableCondition_Register_Add( variableCondition_Register, FrictionVC_Type, FrictionVC_Factory );
+ Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), FrictionVC_Type,
+ "0", (void* (*)(Name))FrictionVC_DefaultNew );
+ RegisterParent( FrictionVC_Type, VariableCondition_Type );
+
return True;
}
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/SConscript
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/SConscript 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/SConscript 2007-07-11 21:02:44 UTC (rev 7645)
@@ -21,6 +21,7 @@
header_groups['Gale/Utils']=Split("""GaleContext.h
Finalise.h
+FrictionVC.h
Init.h
types.h
Utils.h""")
@@ -28,10 +29,11 @@
c_files=Split("""GaleContext.c
Finalise.c
+FrictionVC.c
Init.c""")
-meta_files=Split("""GaleContext.meta""")
+meta_files=Split("""GaleContext.meta FrictionVC.meta""")
c_files+=[local_env.Meta(meta_files)]
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/Utils.h 2007-07-11 21:02:44 UTC (rev 7645)
@@ -50,5 +50,6 @@
#include "GaleContext.h"
#include "Init.h"
#include "Finalise.h"
+ #include "FrictionVC.h"
#endif
Modified: long/3D/Gale/trunk/src/Gale/Utils/src/types.h
===================================================================
--- long/3D/Gale/trunk/src/Gale/Utils/src/types.h 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/Gale/Utils/src/types.h 2007-07-11 21:02:44 UTC (rev 7645)
@@ -47,5 +47,21 @@
#define __Gale_Utils_types_h__
typedef struct GaleContext GaleContext;
+ typedef struct _FrictionVC FrictionVC;
+ /* FrictionVC types */
+ typedef enum
+ {
+ FrictionVC_Wall_Back,
+ FrictionVC_Wall_Left,
+ FrictionVC_Wall_Bottom,
+ FrictionVC_Wall_Right,
+ FrictionVC_Wall_Top,
+ FrictionVC_Wall_Front,
+ FrictionVC_Wall_Size
+ } FrictionVC_Wall;
+
+ typedef struct _FrictionVC_Entry FrictionVC_Entry;
+ typedef Index FrictionVC_Entry_Index;
+
#endif
Deleted: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.c 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.c 2007-07-11 21:02:44 UTC (rev 7645)
@@ -1,762 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** 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 file may be distributed under the terms of the VPAC Public License
-** as defined by VPAC of Australia and appearing in the file
-** LICENSE.VPL included in the packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** $Id: FrictionVC.c 3310 2005-10-26 07:10:18Z RobertTurnbull $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Modified 2006 Walter Landry to implement Friction VC's */
-
-#include <mpi.h>
-#include "Base/Base.h"
-
-#include "Discretisation/Geometry/Geometry.h"
-#include "Discretisation/Shape/Shape.h"
-#include "Discretisation/Mesh/Mesh.h"
-
-#include "types.h"
-#include "FrictionVC.h"
-#include "RegularMeshUtils.h"
-#include <StGermain/StGermain.h>
-#include <StgFEM/StgFEM.h>
-
-#include <string.h>
-#include <assert.h>
-
-
-const Type FrictionVC_Type = "FrictionVC";
-const Name defaultFrictionVCName = "defaultFrictionVCName";
-
-const char* FrictionVC_WallEnumToStr[FrictionVC_Wall_Size] = {
- "back",
- "left",
- "bottom",
- "right",
- "top",
- "front" };
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-VariableCondition* FrictionVC_Factory(
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* data )
-{
- return (VariableCondition*)FrictionVC_New( defaultFrictionVCName, NULL, variable_Register, conFunc_Register, dictionary, (Mesh*)data );
-}
-
-
-FrictionVC* FrictionVC_DefaultNew( Name name )
-{
- return _FrictionVC_New(
- sizeof(FrictionVC),
- FrictionVC_Type,
- _FrictionVC_Delete,
- _FrictionVC_Print,
- _FrictionVC_Copy,
- (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew,
- _FrictionVC_Construct,
- _FrictionVC_Build,
- _VariableCondition_Initialise,
- _VariableCondition_Execute,
- _VariableCondition_Destroy,
- name,
- False,
- _FrictionVC_BuildSelf,
- _FrictionVC_PrintConcise,
- _FrictionVC_ReadDictionary,
- _FrictionVC_GetSet,
- _FrictionVC_GetVariableCount,
- _FrictionVC_GetVariableIndex,
- _FrictionVC_GetValueIndex,
- _FrictionVC_GetValueCount,
- _FrictionVC_GetValue,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL);
-}
-
-FrictionVC* FrictionVC_New(
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh )
-{
- return _FrictionVC_New(
- sizeof(FrictionVC),
- FrictionVC_Type,
- _FrictionVC_Delete,
- _FrictionVC_Print,
- _FrictionVC_Copy,
- (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew,
- _FrictionVC_Construct,
- _FrictionVC_Build,
- _VariableCondition_Initialise,
- _VariableCondition_Execute,
- _VariableCondition_Destroy,
- name,
- True,
- _FrictionVC_BuildSelf,
- _FrictionVC_PrintConcise,
- _FrictionVC_ReadDictionary,
- _FrictionVC_GetSet,
- _FrictionVC_GetVariableCount,
- _FrictionVC_GetVariableIndex,
- _FrictionVC_GetValueIndex,
- _FrictionVC_GetValueCount,
- _FrictionVC_GetValue,
- _dictionaryEntryName,
- variable_Register,
- conFunc_Register,
- dictionary,
- _mesh );
-}
-
-
-void FrictionVC_Init(
- FrictionVC* self,
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh )
-{
- /* General info */
- self->type = FrictionVC_Type;
- self->_sizeOfSelf = sizeof(FrictionVC);
- self->_deleteSelf = False;
-
- /* Virtual info */
- self->_delete = _FrictionVC_Delete;
- self->_print = _FrictionVC_Print;
- self->_copy = _FrictionVC_Copy;
- self->_defaultConstructor = (Stg_Component_DefaultConstructorFunction*)FrictionVC_DefaultNew;
- self->_construct = _FrictionVC_Construct;
- self->_build = _FrictionVC_Build;
- self->_initialise = _VariableCondition_Initialise;
- self->_execute = _VariableCondition_Execute;
- self->_destroy = _VariableCondition_Destroy;
- self->_buildSelf = _FrictionVC_BuildSelf;
- self->_printConcise = _FrictionVC_PrintConcise;
- self->_readDictionary = _FrictionVC_ReadDictionary;
- self->_getSet = _FrictionVC_GetSet;
- self->_getVariableCount = _FrictionVC_GetVariableCount;
- self->_getVariableIndex = _FrictionVC_GetVariableIndex;
- self->_getValueIndex = _FrictionVC_GetValueIndex;
- self->_getValueCount = _FrictionVC_GetValueCount;
- self->_getValue = _FrictionVC_GetValue;
-
- _Stg_Class_Init( (Stg_Class*)self );
- _Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
- _Stg_Component_Init( (Stg_Component*)self );
- _VariableCondition_Init( (VariableCondition*)self, variable_Register, conFunc_Register, dictionary );
-
- /* Stg_Class info */
- _FrictionVC_Init( self, _dictionaryEntryName, _mesh );
-}
-
-
-FrictionVC* _FrictionVC_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,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh)
-{
- FrictionVC* self;
-
- /* Allocate memory/General info */
- assert(_sizeOfSelf >= sizeof(FrictionVC));
- self = (FrictionVC*)_VariableCondition_New(
- _sizeOfSelf,
- type,
- _delete,
- _print,
- _copy,
- _defaultConstructor,
- _construct,
- _build,
- _initialise,
- _execute,
- _destroy,
- name,
- initFlag,
- _buildSelf,
- _printConcise,
- _readDictionary,
- _getSet,
- _getVariableCount,
- _getVariableIndex,
- _getValueIndex,
- _getValueCount,
- _getValue,
- variable_Register,
- conFunc_Register,
- dictionary );
-
- /* Virtual info */
-
- /* Stg_Class info */
- if( initFlag ){
- _FrictionVC_Init( self, _dictionaryEntryName, _mesh );
- }
-
- return self;
-}
-
-
-void _FrictionVC_Init(
- void* wallVC,
- Name _dictionaryEntryName,
- void* _mesh )
-{
- FrictionVC* self = (FrictionVC*)wallVC;
-
- self->isConstructed = True;
- self->_dictionaryEntryName = _dictionaryEntryName;
- self->_mesh = (Mesh*)_mesh;
- self->_wall = FrictionVC_Wall_Size;
- self->_entryTbl = 0;
- self->_entryCount = 0;
- self->context=NULL;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _FrictionVC_ReadDictionary( void* variableCondition, void* dictionary ) {
- FrictionVC* self = (FrictionVC*)variableCondition;
- Dictionary_Entry_Value* vcDictVal;
- Dictionary_Entry_Value _vcDictVal;
- Dictionary_Entry_Value* varsVal;
- FrictionVC_Entry_Index entry_I;
-
- /* Find dictionary entry */
- if (self->_dictionaryEntryName)
- vcDictVal = Dictionary_Get(dictionary, self->_dictionaryEntryName);
- else
- {
- vcDictVal = &_vcDictVal;
- Dictionary_Entry_Value_InitFromStruct(vcDictVal, dictionary);
- }
-
- if (vcDictVal)
- {
- char* wallStr;
-
- /* Obtain which wall */
- wallStr = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcDictVal, "wall" ));
- if (!strcasecmp(wallStr, "back"))
- self->_wall = FrictionVC_Wall_Back;
- else if (!strcasecmp(wallStr, "left"))
- self->_wall = FrictionVC_Wall_Left;
- else if (!strcasecmp(wallStr, "bottom"))
- self->_wall = FrictionVC_Wall_Bottom;
- else if (!strcasecmp(wallStr, "right"))
- self->_wall = FrictionVC_Wall_Right;
- else if (!strcasecmp(wallStr, "top"))
- self->_wall = FrictionVC_Wall_Top;
- else if (!strcasecmp(wallStr, "front"))
- self->_wall = FrictionVC_Wall_Front;
- else {
- assert( 0 );
- self->_wall = FrictionVC_Wall_Size; /* invalid entry */
- }
-
- /* Obtain the variable entries */
- self->_entryCount = Dictionary_Entry_Value_GetCount(Dictionary_Entry_Value_GetMember(vcDictVal, "variables"));
- self->_entryTbl = Memory_Alloc_Array( FrictionVC_Entry, self->_entryCount, "FrictionVC->_entryTbl" );
- varsVal = Dictionary_Entry_Value_GetMember(vcDictVal, "variables");
-
- for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
- {
- char* valType;
- Dictionary_Entry_Value* valueEntry;
- Dictionary_Entry_Value* varDictListVal;
-
- varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
- valueEntry = Dictionary_Entry_Value_GetMember(varDictListVal, "value");
-
- self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
- Dictionary_Entry_Value_GetMember(varDictListVal, "name"));
-
- valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(varDictListVal, "type"));
- if (0 == strcasecmp(valType, "func"))
- {
- char* funcName = Dictionary_Entry_Value_AsString(valueEntry);
- Index cfIndex;
-
- self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
- cfIndex = ConditionFunction_Register_GetIndex( self->conFunc_Register, funcName);
- if ( cfIndex == (unsigned)-1 ) {
- Stream* errorStr = Journal_Register( Error_Type, self->type );
-
- Journal_Printf( errorStr, "Error- in %s: While parsing "
- "definition of wallVC \"%s\" (applies to wall \"%s\"), the cond. func. applied to "
- "variable \"%s\" - \"%s\" - wasn't found in the c.f. register.\n",
- __func__, self->_dictionaryEntryName, FrictionVC_WallEnumToStr[self->_wall],
- self->_entryTbl[entry_I].varName, funcName );
- Journal_Printf( errorStr, "(Available functions in the C.F. register are: ");
- ConditionFunction_Register_PrintNameOfEachFunc( self->conFunc_Register, errorStr );
- Journal_Printf( errorStr, ")\n");
- assert(0);
- }
- self->_entryTbl[entry_I].value.as.typeCFIndex = cfIndex;
- }
- else if (0 == strcasecmp(valType, "array"))
- {
- Dictionary_Entry_Value* valueElement;
- Index i;
-
- self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
- self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
- self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
- self->_entryTbl[entry_I].value.as.typeArray.size, "FrictionVC->_entryTbl[].value.as.typeArray.array" );
-
- for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
- {
- valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
- self->_entryTbl[entry_I].value.as.typeArray.array[i] =
- Dictionary_Entry_Value_AsDouble(valueElement);
- }
- }
- else if( 0 == strcasecmp( valType, "double" ) || 0 == strcasecmp( valType, "d" ) ||
- 0 == strcasecmp( valType, "float" ) || 0 == strcasecmp( valType, "f" ) )
- {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
- self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "integer" ) || 0 == strcasecmp( valType, "int" ) || 0 == strcasecmp( valType, "i" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
- self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "short" ) || 0 == strcasecmp( valType, "s" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
- self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "char" ) || 0 == strcasecmp( valType, "c" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
- self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "pointer" ) || 0 == strcasecmp( valType, "ptr" ) || 0 == strcasecmp( valType, "p" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
- self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
- }
- else {
- /* Assume double */
- Journal_DPrintf(
- Journal_Register( InfoStream_Type, "myStream" ),
- "Type to variable on variable condition not given, assuming double\n" );
- self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
- self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
- }
- }
- }
- else
- {
- self->_wall = FrictionVC_Wall_Size;
- self->_entryCount = 0;
- self->_entryTbl = NULL;
- self->context=NULL;
- }
-}
-
-
-void _FrictionVC_Delete(void* wallVC)
-{
- FrictionVC* self = (FrictionVC*)wallVC;
-
- if (self->_entryTbl) Memory_Free(self->_entryTbl);
-
- /* Stg_Class_Delete parent */
- _VariableCondition_Delete(self);
-}
-
-
-void _FrictionVC_Print(void* wallVC, Stream* stream)
-{
- FrictionVC* self = (FrictionVC*)wallVC;
- FrictionVC_Entry_Index entry_I;
- Index i;
-
- /* Set the Journal for printing informations */
- Stream* info = stream;
-
- /* General info */
- Journal_Printf( info, "FrictionVC (ptr): %p\n", self);
-
- /* Virtual info */
-
- /* Stg_Class info */
- Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
- Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
- if (self->_dictionaryEntryName)
- Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
- Journal_Printf( info, "\t_wall: %s\n", self->_wall == FrictionVC_Wall_Front ? "Front" :
- self->_wall == FrictionVC_Wall_Back ? "Back" : self->_wall == FrictionVC_Wall_Left ? "Left" :
- self->_wall == FrictionVC_Wall_Right ? "Right" : self->_wall == FrictionVC_Wall_Top ? "Top" :
- self->_wall == FrictionVC_Wall_Bottom ? "Bottom" : "None");
- Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
- Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
- if (self->_entryTbl)
- for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
- {
- Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
- Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
- if (self->_entryTbl[entry_I].varName)
- Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
- Journal_Printf( info, "\t\t\tvalue:\n");
- switch (self->_entryTbl[entry_I].value.type)
- {
- case VC_ValueType_Double:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
- Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
- break;
-
- case VC_ValueType_Int:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
- Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
- break;
-
- case VC_ValueType_Short:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
- Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
- break;
-
- case VC_ValueType_Char:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
- Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
- break;
-
- case VC_ValueType_Ptr:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
- Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
- break;
-
- case VC_ValueType_DoubleArray:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
- Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
- Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n",
- self->_entryTbl[entry_I].value.as.typeArray.array);
- if (self->_entryTbl[entry_I].value.as.typeArray.array)
- for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
- Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
- self->_entryTbl[entry_I].value.as.typeArray.array[i]);
- break;
-
- case VC_ValueType_CFIndex:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
- Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
- break;
- }
- }
- Journal_Printf( info, "\t_mesh (ptr): %p\n", self->_mesh);
-
- /* Print parent */
- _VariableCondition_Print(self);
-}
-
-
-void* _FrictionVC_Copy( void* wallVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
- FrictionVC* self = (FrictionVC*)wallVC;
- FrictionVC* newFrictionVC;
- PtrMap* map = ptrMap;
- Bool ownMap = False;
-
- if( !map ) {
- map = PtrMap_New( 10 );
- ownMap = True;
- }
-
- newFrictionVC = (FrictionVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
-
- newFrictionVC->_dictionaryEntryName = self->_dictionaryEntryName;
- newFrictionVC->_wall = self->_wall;
- newFrictionVC->_entryCount = self->_entryCount;
- newFrictionVC->context = self->context;
-
- if( deep ) {
- newFrictionVC->_mesh = (Mesh*)Stg_Class_Copy( self->_mesh, NULL, deep, nameExt, map );
-
- if( (newFrictionVC->_entryTbl = PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
- newFrictionVC->_entryTbl = Memory_Alloc_Array( FrictionVC_Entry, newFrictionVC->_entryCount, "FrictionVC->_entryTbl");
- memcpy( newFrictionVC->_entryTbl, self->_entryTbl, sizeof(FrictionVC_Entry) * newFrictionVC->_entryCount );
- PtrMap_Append( map, newFrictionVC->_entryTbl, self->_entryTbl );
- }
- }
- else {
- newFrictionVC->_mesh = self->_mesh;
- newFrictionVC->_entryTbl = self->_entryTbl;
- }
-
- if( ownMap ) {
- Stg_Class_Delete( map );
- }
-
- return (void*)newFrictionVC;
-}
-
-
-void _FrictionVC_Build( void* wallVC, void* data ) {
- FrictionVC* self = (FrictionVC*)wallVC;
-
- _FrictionVC_BuildSelf( self, data );
-
- _VariableCondition_Build( self, data );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _FrictionVC_Construct( void* wallVC, Stg_ComponentFactory* cf, void* data )
-{
-
-}
-
-void _FrictionVC_BuildSelf( void* wallVC, void* data ) {
- FrictionVC* self = (FrictionVC*)wallVC;
-
- self->context=(FiniteElementContext *)data;
- if( self->_mesh ) {
- Build( self->_mesh, data, False );
- }
-}
-
-
-IndexSet* _FrictionVC_GetSet(void* variableCondition)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
- IndexSet *set = NULL;
- Stream* warningStr = Journal_Register( Error_Type, self->type );
- unsigned nDims;
- Grid* vertGrid;
- FiniteElementContext * context = self->context;
- FeVariable* deviatoric_stress = NULL;
- FeVariable* pressure = NULL;
-
- deviatoric_stress = (FeVariable*)FieldVariable_Register_GetByName( context->fieldVariable_Register, "StressField" );
- pressure = (FeVariable*)FieldVariable_Register_GetByName( context->fieldVariable_Register, "PressureField" );
-
- nDims = Mesh_GetDimSize( self->_mesh );
- vertGrid = *(Grid**)ExtensionManager_Get( self->_mesh->info, self->_mesh,
- ExtensionManager_GetHandle( self->_mesh->info,
- "vertexGrid" ) );
-
- switch (self->_wall) {
- case FrictionVC_Wall_Front:
- if ( nDims < 3 || !vertGrid->sizes[2] ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalFrontSet( self->_mesh );
- }
- break;
-
- case FrictionVC_Wall_Back:
- if ( nDims < 3 || !vertGrid->sizes[2] ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalBackSet( self->_mesh );
- }
- break;
-
- case FrictionVC_Wall_Top:
- if ( nDims < 2 || !vertGrid->sizes[1] ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalTopSet(self->_mesh);
- }
- break;
-
- case FrictionVC_Wall_Bottom:
- if ( nDims < 2 || !vertGrid->sizes[1] ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- if(deviatoric_stress!=NULL && deviatoric_stress->dofLayout!=NULL)
- {
- Node_LocalIndex n_i;
- unsigned nNodes;
- IJK ijk;
-
- nNodes = Mesh_GetDomainSize( self->_mesh, MT_VERTEX );
- set = IndexSet_New( nNodes );
- for( n_i = 0; n_i < nNodes; n_i++ ) {
- RegularMeshUtils_Node_1DTo3D( self->_mesh, Mesh_DomainToGlobal( self->_mesh, MT_VERTEX, n_i ), ijk );
- if(ijk[1]==0)
- {
- double str[6], p;
- double friction;
- friction=10.0;
- FeVariable_GetValueAtNode(deviatoric_stress,n_i,str);
- FeVariable_GetValueAtNode(pressure,n_i,&p);
-
- /* For now, assume that the bottom is flat and not inclined */
- if(str[1]==0 || p-str[2]>friction*fabs(str[1]))
- IndexSet_Add(set,n_i);
- }
- }
- }
- else
- {
- set = RegularMeshUtils_CreateGlobalBottomSet(self->_mesh);
- }
- }
- break;
-
- case FrictionVC_Wall_Left:
- if ( nDims < 1 ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalLeftSet(self->_mesh);
- }
- break;
-
- case FrictionVC_Wall_Right:
- if( nDims < 1 ) {
- set = IndexSet_New( Mesh_GetDomainSize( self->_mesh, MT_VERTEX ) );
- }
- else {
- set = RegularMeshUtils_CreateGlobalRightSet(self->_mesh);
- }
- break;
-
- case FrictionVC_Wall_Size:
- default:
- assert(0);
- break;
- }
-
- return set;
-}
-
-
-VariableCondition_VariableIndex _FrictionVC_GetVariableCount(void* variableCondition, Index globalIndex)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
-
- return self->_entryCount;
-}
-
-
-Variable_Index _FrictionVC_GetVariableIndex(void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
- Variable_Index searchedIndex = 0;
- Stream* errorStr = Journal_Register( Error_Type, self->type );
- Name varName;
-
- varName = self->_entryTbl[varIndex].varName;
- searchedIndex = Variable_Register_GetIndex(self->variable_Register, varName );
-
- Journal_Firewall( ( searchedIndex < self->variable_Register->count ), errorStr, "Error- in %s: searching for index of "
- "varIndex %u (\"%s\") at global node number %u failed - register returned index %u, greater than "
- "count %u.\n", __func__, varIndex, varName, globalIndex, searchedIndex, self->variable_Register->count );
-
- return searchedIndex;
-}
-
-
-VariableCondition_ValueIndex _FrictionVC_GetValueIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex)
-{
- return varIndex;
-}
-
-
-VariableCondition_ValueIndex _FrictionVC_GetValueCount(void* variableCondition)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
-
- return self->_entryCount;
-}
-
-
-VariableCondition_Value _FrictionVC_GetValue(void* variableCondition, VariableCondition_ValueIndex valIndex)
-{
- FrictionVC* self = (FrictionVC*)variableCondition;
-
- return self->_entryTbl[valIndex].value;
-}
-
-void _FrictionVC_PrintConcise( void* variableCondition, Stream* stream ) {
- FrictionVC* self = (FrictionVC*)variableCondition;
-
- Journal_Printf( stream, "\ttype: %s, set: ", self->type );
- Journal_Printf( stream, "%s\n",
- self->_wall == FrictionVC_Wall_Front ? "Front" :
- self->_wall == FrictionVC_Wall_Back ? "Back" :
- self->_wall == FrictionVC_Wall_Left ? "Left" :
- self->_wall == FrictionVC_Wall_Right ? "Right" :
- self->_wall == FrictionVC_Wall_Top ? "Top" :
- self->_wall == FrictionVC_Wall_Bottom ? "Bottom" : "None" );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
Deleted: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.h 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.h 2007-07-11 21:02:44 UTC (rev 7645)
@@ -1,196 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** 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 file may be distributed under the terms of the VPAC Public License
-** as defined by VPAC of Australia and appearing in the file
-** LICENSE.VPL included in the packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-*/
-/** \file
-** Role:
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: FrictionVC.h 3291 2005-10-18 00:05:33Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Modified 2006 Walter Landry to implement Friction VC's */
-
-#ifndef __Gale_BoundaryConditions_FrictionVC_h__
-#define __Gale_BoundaryConditions_FrictionVC_h__
-
-
- extern const Type FrictionVC_Type;
-
- extern const char* FrictionVC_WallEnumToStr[FrictionVC_Wall_Size];
-
- #define __FrictionVC_Entry \
- Name varName; \
- VariableCondition_Value value; \
-
- struct _FrictionVC_Entry { __FrictionVC_Entry };
-
-
- #define __FrictionVC \
- /* General info */ \
- __VariableCondition \
- \
- /* Virtual info */ \
- \
- /* Stg_Class info */ \
- Name _dictionaryEntryName; \
- FrictionVC_Wall _wall; \
- FrictionVC_Entry_Index _entryCount; \
- FrictionVC_Entry* _entryTbl; \
- Mesh* _mesh; \
- /* I would like to make this a FiniteElementContext*, but */ \
- /* then there are problems compiling because this is in */ \
- /* StGermain, and we do not have access to StgFEM yet. */ \
- void* context;
-
- struct _FrictionVC { __FrictionVC };
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Constructor
- */
-
- VariableCondition* FrictionVC_Factory(
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* data );
-
- FrictionVC* FrictionVC_DefaultNew( Name name );
-
- FrictionVC* FrictionVC_New(
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- void FrictionVC_Init(
- FrictionVC* self,
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- FrictionVC* _FrictionVC_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,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- void _FrictionVC_Init(
- void* wallVC,
- Name _dictionaryEntryName,
- void* _mesh );
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** General virtual functions
- */
-
- void _FrictionVC_Delete( void* wallVC );
-
- void _FrictionVC_Print( void* wallVC, Stream* stream );
-
- /* Copy */
- #define FrictionVC_Copy( self ) \
- (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
- #define FrictionVC_Copy( self ) \
- (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
-
- void* _FrictionVC_Copy( void* wallVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap );
-
- void _FrictionVC_Build( void* wallVC, void* data );
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Macros
- */
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Virtual functions
- */
-
- void _FrictionVC_Construct( void* wallVC, Stg_ComponentFactory* cf, void* data );
-
- void _FrictionVC_BuildSelf( void* wallVC, void* data );
-
- void _FrictionVC_ReadDictionary( void* variableCondition, void* dictionary );
-
- IndexSet* _FrictionVC_GetSet( void* variableCondition );
-
- VariableCondition_VariableIndex _FrictionVC_GetVariableCount( void* variableCondition, Index globalIndex );
-
- Variable_Index _FrictionVC_GetVariableIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex );
-
- VariableCondition_ValueIndex _FrictionVC_GetValueIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex );
-
- VariableCondition_ValueIndex _FrictionVC_GetValueCount( void* variableCondition );
-
- VariableCondition_Value _FrictionVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex );
-
- void _FrictionVC_PrintConcise( void* variableCondition, Stream* stream );
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Build functions
- */
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Functions
- */
-
-
-#endif /* __Discretisation_Utils_FrictionVC_h__ */
Deleted: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.meta
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.meta 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FrictionVC.meta 2007-07-11 21:02:44 UTC (rev 7645)
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
-<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
-
-<param name="Name">FrictionVC</param>
-<param name="Author">...</param>
-<param name="Organisation">CIG</param>
-<param name="Project">Gale</param>
-<param name="Location">./Gale/BoundaryConditions/src/</param>
-<param name="Project Web">http://geodynamics.org</param>
-<param name="Copyright">StGermain Framework. Copyright (C) 2003-2005 VPAC. Copyright (c) 2006 California Institute of Technology</param>
-<param name="License">https://csd.vpac.org/twiki/bin/view/Stgermain/SoftwareLicense</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">
- <struct>
- <param name="Essential">True</param>
- <param name="Type">RheologyMaterial</param>
- <param name="Description">Determines the frictional parameters of the wall.</param>
- </struct>
-
-
-</list>
-<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
-
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Init.c 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Init.c 2007-07-11 21:02:44 UTC (rev 7645)
@@ -48,8 +48,6 @@
VariableCondition_Register_Add( variableCondition_Register, CornerVC_Type, CornerVC_Factory );
VariableCondition_Register_Add( variableCondition_Register, InnerWallVC_Type, InnerWallVC_Factory );
VariableCondition_Register_Add( variableCondition_Register, ShapeVC_Type, ShapeVC_Factory );
- VariableCondition_Register_Add( variableCondition_Register, FrictionVC_Type, FrictionVC_Factory );
- VariableCondition_Register_Add( variableCondition_Register, SplitFrictionWallVC_Type, SplitFrictionWallVC_Factory );
Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), AllElementsVC_Type,
"0", (void* (*)(Name))AllElementsVC_DefaultNew );
@@ -69,10 +67,6 @@
"0", (void* (*)(Name))InnerWallVC_DefaultNew );
Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), ShapeVC_Type,
"0", (void* (*)(Name))_ShapeVC_DefaultNew );
- Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), FrictionVC_Type,
- "0", (void* (*)(Name))FrictionVC_DefaultNew );
- Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), SplitFrictionWallVC_Type,
- "0", (void* (*)(Name))SplitFrictionWallVC_DefaultNew );
Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), Remesher_Type,
"0", (void* (*)(Name))_Remesher_DefaultNew );
Stg_ComponentRegister_Add( Stg_ComponentRegister_Get_ComponentRegister(), StripRemesher_Type,
@@ -96,8 +90,6 @@
RegisterParent( CornerVC_Type, VariableCondition_Type );
RegisterParent( InnerWallVC_Type, VariableCondition_Type );
RegisterParent( ShapeVC_Type, VariableCondition_Type );
- RegisterParent( FrictionVC_Type, VariableCondition_Type );
- RegisterParent( SplitFrictionWallVC_Type, VariableCondition_Type );
RegisterParent( DofLayout_Type, Stg_Component_Type );
RegisterParent( Remesher_Type, Stg_Component_Type );
RegisterParent( StripRemesher_Type, Remesher_Type );
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SConscript
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SConscript 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SConscript 2007-07-11 21:02:44 UTC (rev 7645)
@@ -26,8 +26,6 @@
"InnerWallVC.h",
"CornerVC.h",
"ShapeVC.h",
- "FrictionVC.h",
- "SplitFrictionWallVC.h",
"DofLayout.h",
"RegularMeshUtils.h",
"FieldVariable.h",
@@ -54,8 +52,6 @@
"InnerWallVC.c",
"CornerVC.c",
"ShapeVC.c",
- "FrictionVC.c",
- "SplitFrictionWallVC.c",
"DofLayout.c",
"RegularMeshUtils.c",
"FieldVariable.c",
@@ -82,14 +78,12 @@
DiscretisationContext.meta
DofLayout.meta
FieldVariable.meta
-FrictionVC.meta
InnerWallVC.meta
OperatorFieldVariable.meta
Remesher.meta
SemiRegDeform.meta
ShapeAdvector.meta
ShapeVC.meta
-SplitFrictionWallVC.meta
StripRemesher.meta
TimeIntegratee.meta
TimeIntegrator.meta
Deleted: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.c 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.c 2007-07-11 21:02:44 UTC (rev 7645)
@@ -1,741 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** 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 file may be distributed under the terms of the VPAC Public License
-** as defined by VPAC of Australia and appearing in the file
-** LICENSE.VPL included in the packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** $Id: SplitFrictionWallVC.c 3310 2005-10-26 07:10:18Z RobertTurnbull $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Modified 2006 Walter Landry to implement Split Friction Wall VC's */
-
-#include <mpi.h>
-#include "Base/Base.h"
-
-#include "Discretisation/Geometry/Geometry.h"
-#include "Discretisation/Shape/Shape.h"
-#include "Discretisation/Mesh/Mesh.h"
-
-#include "types.h"
-#include "SplitFrictionWallVC.h"
-#include "RegularMeshUtils.h"
-
-#include <string.h>
-#include <assert.h>
-
-
-const Type SplitFrictionWallVC_Type = "SplitFrictionWallVC";
-const Name defaultSplitFrictionWallVCName = "defaultSplitFrictionWallVCName";
-
-const char* SplitFrictionWallVC_WallEnumToStr[SplitFrictionWallVC_Wall_Size] = {
- "back",
- "left",
- "bottom",
- "right",
- "top",
- "front" };
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Constructor
-*/
-
-VariableCondition* SplitFrictionWallVC_Factory(
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* data )
-{
- return (VariableCondition*)SplitFrictionWallVC_New( defaultSplitFrictionWallVCName, NULL, variable_Register, conFunc_Register, dictionary, (Mesh*)data );
-}
-
-
-SplitFrictionWallVC* SplitFrictionWallVC_DefaultNew( Name name )
-{
- return _SplitFrictionWallVC_New(
- sizeof(SplitFrictionWallVC),
- SplitFrictionWallVC_Type,
- _SplitFrictionWallVC_Delete,
- _SplitFrictionWallVC_Print,
- _SplitFrictionWallVC_Copy,
- (Stg_Component_DefaultConstructorFunction*)SplitFrictionWallVC_DefaultNew,
- _SplitFrictionWallVC_Construct,
- _SplitFrictionWallVC_Build,
- _VariableCondition_Initialise,
- _VariableCondition_Execute,
- _VariableCondition_Destroy,
- name,
- False,
- _SplitFrictionWallVC_BuildSelf,
- _SplitFrictionWallVC_PrintConcise,
- _SplitFrictionWallVC_ReadDictionary,
- _SplitFrictionWallVC_GetSet,
- _SplitFrictionWallVC_GetVariableCount,
- _SplitFrictionWallVC_GetVariableIndex,
- _SplitFrictionWallVC_GetValueIndex,
- _SplitFrictionWallVC_GetValueCount,
- _SplitFrictionWallVC_GetValue,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL);
-}
-
-SplitFrictionWallVC* SplitFrictionWallVC_New(
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh )
-{
- return _SplitFrictionWallVC_New(
- sizeof(SplitFrictionWallVC),
- SplitFrictionWallVC_Type,
- _SplitFrictionWallVC_Delete,
- _SplitFrictionWallVC_Print,
- _SplitFrictionWallVC_Copy,
- (Stg_Component_DefaultConstructorFunction*)SplitFrictionWallVC_DefaultNew,
- _SplitFrictionWallVC_Construct,
- _SplitFrictionWallVC_Build,
- _VariableCondition_Initialise,
- _VariableCondition_Execute,
- _VariableCondition_Destroy,
- name,
- True,
- _SplitFrictionWallVC_BuildSelf,
- _SplitFrictionWallVC_PrintConcise,
- _SplitFrictionWallVC_ReadDictionary,
- _SplitFrictionWallVC_GetSet,
- _SplitFrictionWallVC_GetVariableCount,
- _SplitFrictionWallVC_GetVariableIndex,
- _SplitFrictionWallVC_GetValueIndex,
- _SplitFrictionWallVC_GetValueCount,
- _SplitFrictionWallVC_GetValue,
- _dictionaryEntryName,
- variable_Register,
- conFunc_Register,
- dictionary,
- _mesh );
-}
-
-
-void SplitFrictionWallVC_Init(
- SplitFrictionWallVC* self,
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh )
-{
- /* General info */
- self->type = SplitFrictionWallVC_Type;
- self->_sizeOfSelf = sizeof(SplitFrictionWallVC);
- self->_deleteSelf = False;
-
- /* Virtual info */
- self->_delete = _SplitFrictionWallVC_Delete;
- self->_print = _SplitFrictionWallVC_Print;
- self->_copy = _SplitFrictionWallVC_Copy;
- self->_defaultConstructor = (Stg_Component_DefaultConstructorFunction*)SplitFrictionWallVC_DefaultNew;
- self->_construct = _SplitFrictionWallVC_Construct;
- self->_build = _SplitFrictionWallVC_Build;
- self->_initialise = _VariableCondition_Initialise;
- self->_execute = _VariableCondition_Execute;
- self->_destroy = _VariableCondition_Destroy;
- self->_buildSelf = _SplitFrictionWallVC_BuildSelf;
- self->_printConcise = _SplitFrictionWallVC_PrintConcise;
- self->_readDictionary = _SplitFrictionWallVC_ReadDictionary;
- self->_getSet = _SplitFrictionWallVC_GetSet;
- self->_getVariableCount = _SplitFrictionWallVC_GetVariableCount;
- self->_getVariableIndex = _SplitFrictionWallVC_GetVariableIndex;
- self->_getValueIndex = _SplitFrictionWallVC_GetValueIndex;
- self->_getValueCount = _SplitFrictionWallVC_GetValueCount;
- self->_getValue = _SplitFrictionWallVC_GetValue;
-
- _Stg_Class_Init( (Stg_Class*)self );
- _Stg_Object_Init( (Stg_Object*)self, name, NON_GLOBAL );
- _Stg_Component_Init( (Stg_Component*)self );
- _VariableCondition_Init( (VariableCondition*)self, variable_Register, conFunc_Register, dictionary );
-
- /* Stg_Class info */
- _SplitFrictionWallVC_Init( self, _dictionaryEntryName, _mesh );
-}
-
-
-SplitFrictionWallVC* _SplitFrictionWallVC_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,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh)
-{
- SplitFrictionWallVC* self;
-
- /* Allocate memory/General info */
- assert(_sizeOfSelf >= sizeof(SplitFrictionWallVC));
- self = (SplitFrictionWallVC*)_VariableCondition_New(
- _sizeOfSelf,
- type,
- _delete,
- _print,
- _copy,
- _defaultConstructor,
- _construct,
- _build,
- _initialise,
- _execute,
- _destroy,
- name,
- initFlag,
- _buildSelf,
- _printConcise,
- _readDictionary,
- _getSet,
- _getVariableCount,
- _getVariableIndex,
- _getValueIndex,
- _getValueCount,
- _getValue,
- variable_Register,
- conFunc_Register,
- dictionary );
-
- /* Virtual info */
-
- /* Stg_Class info */
- if( initFlag ){
- _SplitFrictionWallVC_Init( self, _dictionaryEntryName, _mesh );
- }
-
- return self;
-}
-
-
-void _SplitFrictionWallVC_Init(
- void* wallVC,
- Name _dictionaryEntryName,
- void* _mesh )
-{
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)wallVC;
-
- self->isConstructed = True;
- self->_dictionaryEntryName = _dictionaryEntryName;
- self->_mesh = (Mesh*)_mesh;
- self->_wall = SplitFrictionWallVC_Wall_Size;
- self->_entryTbl = 0;
- self->_entryCount = 0;
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** General virtual functions
-*/
-
-void _SplitFrictionWallVC_ReadDictionary( void* variableCondition, void* dictionary ) {
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)variableCondition;
- Dictionary_Entry_Value* vcDictVal;
- Dictionary_Entry_Value _vcDictVal;
- Dictionary_Entry_Value* varsVal;
- SplitFrictionWallVC_Entry_Index entry_I;
-
- /* Find dictionary entry */
- if (self->_dictionaryEntryName)
- vcDictVal = Dictionary_Get(dictionary, self->_dictionaryEntryName);
- else
- {
- vcDictVal = &_vcDictVal;
- Dictionary_Entry_Value_InitFromStruct(vcDictVal, dictionary);
- }
-
- if (vcDictVal)
- {
- char* wallStr;
-
- /* Obtain which wall */
- wallStr = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(vcDictVal, "wall" ));
- if (!strcasecmp(wallStr, "back"))
- self->_wall = SplitFrictionWallVC_Wall_Back;
- else if (!strcasecmp(wallStr, "left"))
- self->_wall = SplitFrictionWallVC_Wall_Left;
- else if (!strcasecmp(wallStr, "bottom"))
- self->_wall = SplitFrictionWallVC_Wall_Bottom;
- else if (!strcasecmp(wallStr, "right"))
- self->_wall = SplitFrictionWallVC_Wall_Right;
- else if (!strcasecmp(wallStr, "top"))
- self->_wall = SplitFrictionWallVC_Wall_Top;
- else if (!strcasecmp(wallStr, "front"))
- self->_wall = SplitFrictionWallVC_Wall_Front;
- else {
- assert( 0 );
- self->_wall = SplitFrictionWallVC_Wall_Size; /* invalid entry */
- }
-
- /* Obtain the variable entries */
-/* self->_entryCount = 0; */
- self->_entryCount = Dictionary_Entry_Value_GetCount(Dictionary_Entry_Value_GetMember(vcDictVal, "variables"));
- self->_entryTbl = Memory_Alloc_Array( SplitFrictionWallVC_Entry, self->_entryCount, "SplitFrictionWallVC->_entryTbl" );
- varsVal = Dictionary_Entry_Value_GetMember(vcDictVal, "variables");
-
- for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
- {
- char* valType;
- Dictionary_Entry_Value* valueEntry;
- Dictionary_Entry_Value* varDictListVal;
-
- varDictListVal = Dictionary_Entry_Value_GetElement(varsVal, entry_I);
- valueEntry = Dictionary_Entry_Value_GetMember(varDictListVal, "value");
-
- self->_entryTbl[entry_I].varName = Dictionary_Entry_Value_AsString(
- Dictionary_Entry_Value_GetMember(varDictListVal, "name"));
-
- valType = Dictionary_Entry_Value_AsString(Dictionary_Entry_Value_GetMember(varDictListVal, "type"));
- if (0 == strcasecmp(valType, "func"))
- {
- char* funcName = Dictionary_Entry_Value_AsString(valueEntry);
- Index cfIndex;
-
- self->_entryTbl[entry_I].value.type = VC_ValueType_CFIndex;
- cfIndex = ConditionFunction_Register_GetIndex( self->conFunc_Register, funcName);
- if ( cfIndex == (unsigned)-1 ) {
- Stream* errorStr = Journal_Register( Error_Type, self->type );
-
- Journal_Printf( errorStr, "Error- in %s: While parsing "
- "definition of wallVC \"%s\" (applies to wall \"%s\"), the cond. func. applied to "
- "variable \"%s\" - \"%s\" - wasn't found in the c.f. register.\n",
- __func__, self->_dictionaryEntryName, SplitFrictionWallVC_WallEnumToStr[self->_wall],
- self->_entryTbl[entry_I].varName, funcName );
- Journal_Printf( errorStr, "(Available functions in the C.F. register are: ");
- ConditionFunction_Register_PrintNameOfEachFunc( self->conFunc_Register, errorStr );
- Journal_Printf( errorStr, ")\n");
- assert(0);
- }
- self->_entryTbl[entry_I].value.as.typeCFIndex = cfIndex;
- }
- else if (0 == strcasecmp(valType, "array"))
- {
- Dictionary_Entry_Value* valueElement;
- Index i;
-
- self->_entryTbl[entry_I].value.type = VC_ValueType_DoubleArray;
- self->_entryTbl[entry_I].value.as.typeArray.size = Dictionary_Entry_Value_GetCount(valueEntry);
- self->_entryTbl[entry_I].value.as.typeArray.array = Memory_Alloc_Array( double,
- self->_entryTbl[entry_I].value.as.typeArray.size, "SplitFrictionWallVC->_entryTbl[].value.as.typeArray.array" );
-
- for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
- {
- valueElement = Dictionary_Entry_Value_GetElement(valueEntry, i);
- self->_entryTbl[entry_I].value.as.typeArray.array[i] =
- Dictionary_Entry_Value_AsDouble(valueElement);
- }
- }
- else if( 0 == strcasecmp( valType, "double" ) || 0 == strcasecmp( valType, "d" ) ||
- 0 == strcasecmp( valType, "float" ) || 0 == strcasecmp( valType, "f" ) )
- {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
- self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "integer" ) || 0 == strcasecmp( valType, "int" ) || 0 == strcasecmp( valType, "i" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Int;
- self->_entryTbl[entry_I].value.as.typeInt = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "short" ) || 0 == strcasecmp( valType, "s" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Short;
- self->_entryTbl[entry_I].value.as.typeShort = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "char" ) || 0 == strcasecmp( valType, "c" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Char;
- self->_entryTbl[entry_I].value.as.typeChar = Dictionary_Entry_Value_AsUnsignedInt( valueEntry );
- }
- else if( 0 == strcasecmp( valType, "pointer" ) || 0 == strcasecmp( valType, "ptr" ) || 0 == strcasecmp( valType, "p" ) ) {
- self->_entryTbl[entry_I].value.type = VC_ValueType_Ptr;
- self->_entryTbl[entry_I].value.as.typePtr = (void*) ( (ArithPointer)Dictionary_Entry_Value_AsUnsignedInt( valueEntry ));
- }
- else {
- /* Assume double */
- Journal_DPrintf(
- Journal_Register( InfoStream_Type, "myStream" ),
- "Type to variable on variable condition not given, assuming double\n" );
- self->_entryTbl[entry_I].value.type = VC_ValueType_Double;
- self->_entryTbl[entry_I].value.as.typeDouble = Dictionary_Entry_Value_AsDouble( valueEntry );
- }
- }
- }
- else
- {
- self->_wall = SplitFrictionWallVC_Wall_Size;
- self->_entryCount = 0;
- self->_entryTbl = NULL;
- }
-}
-
-
-void _SplitFrictionWallVC_Delete(void* wallVC)
-{
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)wallVC;
-
- if (self->_entryTbl) Memory_Free(self->_entryTbl);
-
- /* Stg_Class_Delete parent */
- _VariableCondition_Delete(self);
-}
-
-
-void _SplitFrictionWallVC_Print(void* wallVC, Stream* stream)
-{
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)wallVC;
- SplitFrictionWallVC_Entry_Index entry_I;
- Index i;
-
- /* Set the Journal for printing informations */
- Stream* info = stream;
-
- /* General info */
- Journal_Printf( info, "SplitFrictionWallVC (ptr): %p\n", self);
-
- /* Virtual info */
-
- /* Stg_Class info */
- Journal_Printf( info, "\tdictionary (ptr): %p\n", self->dictionary);
- Journal_Printf( info, "\t_dictionaryEntryName (ptr): %p\n", self->_dictionaryEntryName);
- if (self->_dictionaryEntryName)
- Journal_Printf( info, "\t\t_dictionaryEntryName: %s\n", self->_dictionaryEntryName);
- Journal_Printf( info, "\t_wall: %s\n", self->_wall == SplitFrictionWallVC_Wall_Front ? "Front" :
- self->_wall == SplitFrictionWallVC_Wall_Back ? "Back" : self->_wall == SplitFrictionWallVC_Wall_Left ? "Left" :
- self->_wall == SplitFrictionWallVC_Wall_Right ? "Right" : self->_wall == SplitFrictionWallVC_Wall_Top ? "Top" :
- self->_wall == SplitFrictionWallVC_Wall_Bottom ? "Bottom" : "None");
- Journal_Printf( info, "\t_entryCount: %u\n", self->_entryCount);
- Journal_Printf( info, "\t_entryTbl (ptr): %p\n", self->_entryTbl);
- if (self->_entryTbl)
- for (entry_I = 0; entry_I < self->_entryCount; entry_I++)
- {
- Journal_Printf( info, "\t\t_entryTbl[%u]:\n", entry_I);
- Journal_Printf( info, "\t\t\tvarName (ptr): %p\n", self->_entryTbl[entry_I].varName);
- if (self->_entryTbl[entry_I].varName)
- Journal_Printf( info, "\t\t\t\tvarName: %s\n", self->_entryTbl[entry_I].varName);
- Journal_Printf( info, "\t\t\tvalue:\n");
- switch (self->_entryTbl[entry_I].value.type)
- {
- case VC_ValueType_Double:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Double\n" );
- Journal_Printf( info, "\t\t\t\tasDouble: %g\n", self->_entryTbl[entry_I].value.as.typeDouble );
- break;
-
- case VC_ValueType_Int:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Int\n" );
- Journal_Printf( info, "\t\t\t\tasInt: %i\n", self->_entryTbl[entry_I].value.as.typeInt );
- break;
-
- case VC_ValueType_Short:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Short\n" );
- Journal_Printf( info, "\t\t\t\tasShort: %i\n", self->_entryTbl[entry_I].value.as.typeShort );
- break;
-
- case VC_ValueType_Char:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Char\n");
- Journal_Printf( info, "\t\t\t\tasChar: %c\n", self->_entryTbl[entry_I].value.as.typeChar );
- break;
-
- case VC_ValueType_Ptr:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_Ptr\n");
- Journal_Printf( info, "\t\t\t\tasPtr: %g\n", self->_entryTbl[entry_I].value.as.typePtr );
- break;
-
- case VC_ValueType_DoubleArray:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_DoubleArray\n");
- Journal_Printf( info, "\t\t\t\tarraySize: %u\n", self->_entryTbl[entry_I].value.as.typeArray.size);
- Journal_Printf( info, "\t\t\t\tasDoubleArray (ptr): %p\n",
- self->_entryTbl[entry_I].value.as.typeArray.array);
- if (self->_entryTbl[entry_I].value.as.typeArray.array)
- for (i = 0; i < self->_entryTbl[entry_I].value.as.typeArray.size; i++)
- Journal_Printf( info, "\t\t\t\tasDoubleArray[%u]: %g\n", i,
- self->_entryTbl[entry_I].value.as.typeArray.array[i]);
- break;
-
- case VC_ValueType_CFIndex:
- Journal_Printf( info, "\t\t\t\ttype: VC_ValueType_CFIndex\n");
- Journal_Printf( info, "\t\t\t\tasCFIndex: %u\n", self->_entryTbl[entry_I].value.as.typeCFIndex);
- break;
- }
- }
- Journal_Printf( info, "\t_mesh (ptr): %p\n", self->_mesh);
-
- /* Print parent */
- _VariableCondition_Print(self);
-}
-
-
-void* _SplitFrictionWallVC_Copy( void* wallVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap ) {
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)wallVC;
- SplitFrictionWallVC* newSplitFrictionWallVC;
- PtrMap* map = ptrMap;
- Bool ownMap = False;
-
- if( !map ) {
- map = PtrMap_New( 10 );
- ownMap = True;
- }
-
- newSplitFrictionWallVC = (SplitFrictionWallVC*)_VariableCondition_Copy( self, dest, deep, nameExt, map );
-
- newSplitFrictionWallVC->_dictionaryEntryName = self->_dictionaryEntryName;
- newSplitFrictionWallVC->_wall = self->_wall;
- newSplitFrictionWallVC->_entryCount = self->_entryCount;
-
- if( deep ) {
- newSplitFrictionWallVC->_mesh = (Mesh*)Stg_Class_Copy( self->_mesh, NULL, deep, nameExt, map );
-
- if( (newSplitFrictionWallVC->_entryTbl = PtrMap_Find( map, self->_entryTbl )) == NULL && self->_entryTbl ) {
- newSplitFrictionWallVC->_entryTbl = Memory_Alloc_Array( SplitFrictionWallVC_Entry, newSplitFrictionWallVC->_entryCount, "SplitFrictionWallVC->_entryTbl");
- memcpy( newSplitFrictionWallVC->_entryTbl, self->_entryTbl, sizeof(SplitFrictionWallVC_Entry) * newSplitFrictionWallVC->_entryCount );
- PtrMap_Append( map, newSplitFrictionWallVC->_entryTbl, self->_entryTbl );
- }
- }
- else {
- newSplitFrictionWallVC->_mesh = self->_mesh;
- newSplitFrictionWallVC->_entryTbl = self->_entryTbl;
- }
-
- if( ownMap ) {
- Stg_Class_Delete( map );
- }
-
- return (void*)newSplitFrictionWallVC;
-}
-
-
-void _SplitFrictionWallVC_Build( void* wallVC, void* data ) {
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)wallVC;
-
- _SplitFrictionWallVC_BuildSelf( self, data );
-
- _VariableCondition_Build( self, data );
-}
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Macros
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Virtual functions
-*/
-
-void _SplitFrictionWallVC_Construct( void* wallVC, Stg_ComponentFactory* cf, void* data )
-{
-
-}
-
-void _SplitFrictionWallVC_BuildSelf( void* wallVC, void* data ) {
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)wallVC;
-
- if( self->_mesh ) {
- Build( self->_mesh, data, False );
- }
-}
-
-
-IndexSet* _SplitFrictionWallVC_GetSet(void* variableCondition)
-{
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)variableCondition;
- IndexSet *set = NULL;
- Stream* warningStr = Journal_Register( Error_Type, self->type );
- unsigned nDims;
- unsigned* gSize;
-
- nDims = Mesh_GetDimSize( self->_mesh );
- gSize = (unsigned*)ExtensionManager_Get( self->_mesh->info, self->_mesh,
- ExtensionManager_GetHandle( self->_mesh->info,
- "cartesianGlobalSize" ) );
- switch (self->_wall) {
- case SplitFrictionWallVC_Wall_Front:
- if ( nDims < 3 || !gSize[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__,
- SplitFrictionWallVC_WallEnumToStr[self->_wall], "K" );
- set = IndexSet_New(Mesh_GetDomainSize( self->_mesh, MT_VERTEX ));
- }
- else {
- set = RegularMeshUtils_CreateGlobalFrontSet(self->_mesh);
- }
- break;
-
- case SplitFrictionWallVC_Wall_Back:
- if ( nDims < 3 || !gSize[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__,
- SplitFrictionWallVC_WallEnumToStr[self->_wall], "K" );
- set = IndexSet_New(Mesh_GetDomainSize( self->_mesh, MT_VERTEX ));
- }
- else {
- set = RegularMeshUtils_CreateGlobalBackSet(self->_mesh);
- }
- break;
-
- case SplitFrictionWallVC_Wall_Top:
- if ( nDims < 2 || !gSize[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__,
- SplitFrictionWallVC_WallEnumToStr[self->_wall], "J" );
- set = IndexSet_New(Mesh_GetDomainSize( self->_mesh, MT_VERTEX ));
- }
- else {
- set = RegularMeshUtils_CreateGlobalTopSet(self->_mesh);
- }
- break;
-
- case SplitFrictionWallVC_Wall_Bottom:
- if ( nDims < 2 || !gSize[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__,
- SplitFrictionWallVC_WallEnumToStr[self->_wall], "J" );
- set = IndexSet_New(Mesh_GetDomainSize( self->_mesh, MT_VERTEX ));
- }
- else {
- set = RegularMeshUtils_CreateGlobalBottomSet(self->_mesh);
- }
- break;
-
- case SplitFrictionWallVC_Wall_Left:
- if ( !gSize[0] ) {
- 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__,
- SplitFrictionWallVC_WallEnumToStr[self->_wall], "I" );
- set = IndexSet_New(Mesh_GetDomainSize( self->_mesh, MT_VERTEX ));
- }
- else {
- set = RegularMeshUtils_CreateGlobalLeftSet(self->_mesh);
- }
- break;
-
- case SplitFrictionWallVC_Wall_Right:
- if ( !gSize[0] ) {
- 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__,
- SplitFrictionWallVC_WallEnumToStr[self->_wall], "I" );
- set = IndexSet_New(Mesh_GetDomainSize( self->_mesh, MT_VERTEX ));
- }
- else {
- set = RegularMeshUtils_CreateGlobalRightSet(self->_mesh);
- }
- break;
-
- case SplitFrictionWallVC_Wall_Size:
- default:
- assert(0);
- break;
- }
-
- return set;
-}
-
-
-VariableCondition_VariableIndex _SplitFrictionWallVC_GetVariableCount(void* variableCondition, Index globalIndex)
-{
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)variableCondition;
-
- return self->_entryCount;
-}
-
-
-Variable_Index _SplitFrictionWallVC_GetVariableIndex(void* variableCondition, Index globalIndex, VariableCondition_VariableIndex varIndex)
-{
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)variableCondition;
- Variable_Index searchedIndex = 0;
- Stream* errorStr = Journal_Register( Error_Type, self->type );
- Name varName;
-
- varName = self->_entryTbl[varIndex].varName;
- searchedIndex = Variable_Register_GetIndex(self->variable_Register, varName );
-
- Journal_Firewall( ( searchedIndex < self->variable_Register->count ), errorStr, "Error- in %s: searching for index of "
- "varIndex %u (\"%s\") at global node number %u failed - register returned index %u, greater than "
- "count %u.\n", __func__, varIndex, varName, globalIndex, searchedIndex, self->variable_Register->count );
-
- return searchedIndex;
-}
-
-
-VariableCondition_ValueIndex _SplitFrictionWallVC_GetValueIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex)
-{
- return varIndex;
-}
-
-
-VariableCondition_ValueIndex _SplitFrictionWallVC_GetValueCount(void* variableCondition)
-{
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)variableCondition;
-
- return self->_entryCount;
-}
-
-
-VariableCondition_Value _SplitFrictionWallVC_GetValue(void* variableCondition, VariableCondition_ValueIndex valIndex)
-{
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)variableCondition;
-
- return self->_entryTbl[valIndex].value;
-}
-
-void _SplitFrictionWallVC_PrintConcise( void* variableCondition, Stream* stream ) {
- SplitFrictionWallVC* self = (SplitFrictionWallVC*)variableCondition;
-
- Journal_Printf( stream, "\ttype: %s, set: ", self->type );
- Journal_Printf( stream, "%s\n",
- self->_wall == SplitFrictionWallVC_Wall_Front ? "Front" :
- self->_wall == SplitFrictionWallVC_Wall_Back ? "Back" :
- self->_wall == SplitFrictionWallVC_Wall_Left ? "Left" :
- self->_wall == SplitFrictionWallVC_Wall_Right ? "Right" :
- self->_wall == SplitFrictionWallVC_Wall_Top ? "Top" :
- self->_wall == SplitFrictionWallVC_Wall_Bottom ? "Bottom" : "None" );
-}
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Build functions
-*/
-
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Functions
-*/
Deleted: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.h 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.h 2007-07-11 21:02:44 UTC (rev 7645)
@@ -1,192 +0,0 @@
-/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-**
-** 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 file may be distributed under the terms of the VPAC Public License
-** as defined by VPAC of Australia and appearing in the file
-** LICENSE.VPL included in the packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-*/
-/** \file
-** Role:
-**
-** Assumptions:
-**
-** Comments:
-**
-** $Id: SplitFrictionWallVC.h 3291 2005-10-18 00:05:33Z AlanLo $
-**
-**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
-/* Modified 2006 Walter Landry to implement Split Friction Wall VC's */
-
-#ifndef __Gale_BoundaryConditions_SplitFrictionWallVC_h__
-#define __Gale_BoundaryConditions_SplitFrictionWallVC_h__
-
-
- extern const Type SplitFrictionWallVC_Type;
-
- extern const char* SplitFrictionWallVC_WallEnumToStr[SplitFrictionWallVC_Wall_Size];
-
- #define __SplitFrictionWallVC_Entry \
- Name varName; \
- VariableCondition_Value value; \
-
- struct _SplitFrictionWallVC_Entry { __SplitFrictionWallVC_Entry };
-
-
- #define __SplitFrictionWallVC \
- /* General info */ \
- __VariableCondition \
- \
- /* Virtual info */ \
- \
- /* Stg_Class info */ \
- Name _dictionaryEntryName; \
- SplitFrictionWallVC_Wall _wall; \
- SplitFrictionWallVC_Entry_Index _entryCount; \
- SplitFrictionWallVC_Entry* _entryTbl; \
- Mesh* _mesh;
-
- struct SplitFrictionWallVC { __SplitFrictionWallVC };
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Constructor
- */
-
- VariableCondition* SplitFrictionWallVC_Factory(
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* data );
-
- SplitFrictionWallVC* SplitFrictionWallVC_DefaultNew( Name name );
-
- SplitFrictionWallVC* SplitFrictionWallVC_New(
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- void SplitFrictionWallVC_Init(
- SplitFrictionWallVC* self,
- Name name,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- SplitFrictionWallVC* _SplitFrictionWallVC_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,
- Name _dictionaryEntryName,
- Variable_Register* variable_Register,
- ConditionFunction_Register* conFunc_Register,
- Dictionary* dictionary,
- void* _mesh );
-
- void _SplitFrictionWallVC_Init(
- void* wallVC,
- Name _dictionaryEntryName,
- void* _mesh );
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** General virtual functions
- */
-
- void _SplitFrictionWallVC_Delete( void* wallVC );
-
- void _SplitFrictionWallVC_Print( void* wallVC, Stream* stream );
-
- /* Copy */
- #define SplitFrictionWallVC_Copy( self ) \
- (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
- #define SplitFrictionWallVC_Copy( self ) \
- (VariableCondition*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
-
- void* _SplitFrictionWallVC_Copy( void* wallVC, void* dest, Bool deep, Name nameExt, struct PtrMap* ptrMap );
-
- void _SplitFrictionWallVC_Build( void* wallVC, void* data );
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Macros
- */
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Virtual functions
- */
-
- void _SplitFrictionWallVC_Construct( void* wallVC, Stg_ComponentFactory* cf, void* data );
-
- void _SplitFrictionWallVC_BuildSelf( void* wallVC, void* data );
-
- void _SplitFrictionWallVC_ReadDictionary( void* variableCondition, void* dictionary );
-
- IndexSet* _SplitFrictionWallVC_GetSet( void* variableCondition );
-
- VariableCondition_VariableIndex _SplitFrictionWallVC_GetVariableCount( void* variableCondition, Index globalIndex );
-
- Variable_Index _SplitFrictionWallVC_GetVariableIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex );
-
- VariableCondition_ValueIndex _SplitFrictionWallVC_GetValueIndex(
- void* variableCondition,
- Index globalIndex,
- VariableCondition_VariableIndex varIndex );
-
- VariableCondition_ValueIndex _SplitFrictionWallVC_GetValueCount( void* variableCondition );
-
- VariableCondition_Value _SplitFrictionWallVC_GetValue( void* variableCondition, VariableCondition_ValueIndex valIndex );
-
- void _SplitFrictionWallVC_PrintConcise( void* variableCondition, Stream* stream );
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Build functions
- */
-
-
- /*--------------------------------------------------------------------------------------------------------------------------
- ** Functions
- */
-
-
-#endif /* __Discretisation_Utils_SplitFrictionWallVC_h__ */
Deleted: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.meta
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.meta 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/SplitFrictionWallVC.meta 2007-07-11 21:02:44 UTC (rev 7645)
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE StGermainData SYSTEM "stgermain.dtd">
-<StGermainData xmlns="http://www.vpac.org/StGermain/XML_IO_Handler/Jun2003">
-
-<param name="Name">SplitFrictionWallVC</param>
-<param name="Author">...</param>
-<param name="Organisation">CIG</param>
-<param name="Project">Gale</param>
-<param name="Location">./Gale/BoundaryConditions/src/</param>
-<param name="Project Web">http://geodynamics.org</param>
-<param name="Copyright">StGermain Framework. Copyright (C) 2003-2005 VPAC. Copyright (c) 2006 California Institute of Technology</param>
-<param name="License">https://csd.vpac.org/twiki/bin/view/Stgermain/SoftwareLicense</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">
-<!-- <struct> -->
-<!-- <param name="Essential">True</param> -->
-<!-- <param name="Name">vx_left</param> -->
-<!-- <param name="Type">double</param> -->
-<!-- <param name="Description">Velocity of the the left part</param> -->
-<!-- </struct> -->
-<!-- <struct> -->
-<!-- <param name="Essential">True</param> -->
-<!-- <param name="Name">vx_right</param> -->
-<!-- <param name="Type"></param> -->
-<!-- <param name="Description">Velocity of the right part</param> -->
-<!-- </struct> -->
-<!-- <struct> -->
-<!-- <param name="Essential">True</param> -->
-<!-- <param name="Name">middle</param> -->
-<!-- <param name="Type">double</param> -->
-<!-- <param name="Description">Where the two parts join.</param> -->
-<!-- </struct> -->
-
-</list>
-
-<!-- <list name="Dependencies"> -->
-<!-- <struct> -->
-<!-- <param name="Essential">True</param> -->
-<!-- <param name="Type">RheologyMaterial</param> -->
-<!-- <param name="Description">Determines the frictional parameters of the wall.</param> -->
-<!-- </struct> -->
-
- <!--/list-->
-<!-- Add an exmaple XML if possible -->
-<param name="Example">...</param>
-
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Utils.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Utils.h 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Utils.h 2007-07-11 21:02:44 UTC (rev 7645)
@@ -50,8 +50,6 @@
#include "CornerVC.h"
#include "InnerWallVC.h"
#include "ShapeVC.h"
- #include "FrictionVC.h"
- #include "SplitFrictionWallVC.h"
#include "DofLayout.h"
#include "Operator.h"
#include "FieldVariable_Register.h"
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/types.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/types.h 2007-07-11 21:02:00 UTC (rev 7644)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/types.h 2007-07-11 21:02:44 UTC (rev 7645)
@@ -49,8 +49,6 @@
typedef struct _InnerWallVC InnerWallVC;
typedef struct _CornerVC CornerVC;
typedef struct ShapeVC ShapeVC;
- typedef struct _FrictionVC FrictionVC;
- typedef struct SplitFrictionWallVC SplitFrictionWallVC;
typedef struct _DofLayout DofLayout;
typedef struct _EmbeddedSurface EmbeddedSurface;
typedef struct Operator Operator;
@@ -72,36 +70,7 @@
/* Degrees of Freedom */
typedef unsigned int Dof;
typedef Index Bit_Index;
-
- /* FrictionVC types */
- typedef enum
- {
- FrictionVC_Wall_Back,
- FrictionVC_Wall_Left,
- FrictionVC_Wall_Bottom,
- FrictionVC_Wall_Right,
- FrictionVC_Wall_Top,
- FrictionVC_Wall_Front,
- FrictionVC_Wall_Size
- } FrictionVC_Wall;
- typedef struct _FrictionVC_Entry FrictionVC_Entry;
- typedef Index FrictionVC_Entry_Index;
- /* SplitFrictionWallVC types */
- typedef enum
- {
- SplitFrictionWallVC_Wall_Back,
- SplitFrictionWallVC_Wall_Left,
- SplitFrictionWallVC_Wall_Bottom,
- SplitFrictionWallVC_Wall_Right,
- SplitFrictionWallVC_Wall_Top,
- SplitFrictionWallVC_Wall_Front,
- SplitFrictionWallVC_Wall_Size
- } SplitFrictionWallVC_Wall;
-
- typedef struct _SplitFrictionWallVC_Entry SplitFrictionWallVC_Entry;
- typedef Index SplitFrictionWallVC_Entry_Index;
-
/* WallVC types */
typedef enum
{
More information about the cig-commits
mailing list