[cig-commits] r6107 - in long/3D/Gale/trunk/src/StgFEM: .
Discretisation/src
walter at geodynamics.org
walter at geodynamics.org
Fri Feb 23 12:20:53 PST 2007
Author: walter
Date: 2007-02-23 12:20:52 -0800 (Fri, 23 Feb 2007)
New Revision: 6107
Added:
long/3D/Gale/trunk/src/StgFEM/Discretisation/src/RegularTrilinear.c
long/3D/Gale/trunk/src/StgFEM/Discretisation/src/RegularTrilinear.h
Modified:
long/3D/Gale/trunk/src/StgFEM/
long/3D/Gale/trunk/src/StgFEM/Discretisation/src/Discretisation.h
long/3D/Gale/trunk/src/StgFEM/Discretisation/src/ElementType.h
long/3D/Gale/trunk/src/StgFEM/Discretisation/src/FeMesh.c
long/3D/Gale/trunk/src/StgFEM/Discretisation/src/Init.c
long/3D/Gale/trunk/src/StgFEM/Discretisation/src/types.h
Log:
r990 at earth (orig r741): LukeHodkinson | 2007-02-12 18:31:05 -0800
Adding an optimised method for calculating global to
local element coordinates in regular elements.
Property changes on: long/3D/Gale/trunk/src/StgFEM
___________________________________________________________________
Name: svk:merge
- 38867592-cf10-0410-9e16-a142ea72ac34:/cig:880
db209038-57f2-0310-97fa-b160e0ae9d04:/branches/decomp3d:740
db209038-57f2-0310-97fa-b160e0ae9d04:/trunk:669
+ 38867592-cf10-0410-9e16-a142ea72ac34:/cig:880
db209038-57f2-0310-97fa-b160e0ae9d04:/branches/decomp3d:741
db209038-57f2-0310-97fa-b160e0ae9d04:/trunk:669
Modified: long/3D/Gale/trunk/src/StgFEM/Discretisation/src/Discretisation.h
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/Discretisation/src/Discretisation.h 2007-02-23 20:20:49 UTC (rev 6106)
+++ long/3D/Gale/trunk/src/StgFEM/Discretisation/src/Discretisation.h 2007-02-23 20:20:52 UTC (rev 6107)
@@ -61,6 +61,7 @@
#include "ConstantElementType.h"
#include "BilinearElementType.h"
#include "TrilinearElementType.h"
+ #include "RegularTrilinear.h"
#include "LinearTriangleElementType.h"
#include "Element.h"
Modified: long/3D/Gale/trunk/src/StgFEM/Discretisation/src/ElementType.h
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/Discretisation/src/ElementType.h 2007-02-23 20:20:49 UTC (rev 6106)
+++ long/3D/Gale/trunk/src/StgFEM/Discretisation/src/ElementType.h 2007-02-23 20:20:52 UTC (rev 6107)
@@ -87,6 +87,45 @@
Stream* debug;
struct ElementType { __ElementType };
+
+
+ #define ELEMENTTYPE_DEFARGS \
+ 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, \
+ ElementType_EvaluateShapeFunctionsAtFunction* _evaluateShapeFunctionsAt, \
+ ElementType_EvaluateShapeFunctionLocalDerivsAtFunction* _evaluateShapeFunctionLocalDerivsAt, \
+ ElementType_ConvertGlobalCoordToElLocalFunction* _convertGlobalCoordToElLocal, \
+ Index nodeCount
+
+ #define ELEMENTTYPE_PASSARGS \
+ _sizeOfSelf, \
+ type, \
+ _delete, \
+ _print, \
+ _copy, \
+ _defaultConstructor, \
+ _construct, \
+ _build, \
+ _initialise, \
+ _execute, \
+ _destroy, \
+ name, \
+ initFlag, \
+ _evaluateShapeFunctionsAt, \
+ _evaluateShapeFunctionLocalDerivsAt, \
+ _convertGlobalCoordToElLocal, \
+ nodeCount
/* No "ElementType_New" and "ElementType_Init" as this is an abstract class */
Modified: long/3D/Gale/trunk/src/StgFEM/Discretisation/src/FeMesh.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/Discretisation/src/FeMesh.c 2007-02-23 20:20:49 UTC (rev 6106)
+++ long/3D/Gale/trunk/src/StgFEM/Discretisation/src/FeMesh.c 2007-02-23 20:20:52 UTC (rev 6107)
@@ -78,6 +78,13 @@
}
void _FeMesh_Init( FeMesh* self ) {
+ Stream* stream;
+
+ assert( self && Stg_CheckType( self, FeMesh ) );
+
+ stream = Journal_Register( Info_Type, self->type );
+ Stream_SetPrintingRank( stream, 0 );
+
self->feElType = NULL;
self->feElFamily = NULL;
}
@@ -123,10 +130,16 @@
void _FeMesh_Build( void* feMesh, void* data ) {
FeMesh* self = (FeMesh*)feMesh;
+ Stream* stream;
ElementType* elType;
assert( self );
+ stream = Journal_Register( Info_Type, self->type );
+ Stream_Indent( stream );
+ Journal_Printf( stream, "Assigning FeMesh element types...\n" );
+ Stream_Indent( stream );
+
_Mesh_Build( self, data );
@@ -141,6 +154,15 @@
else
abort();
}
+ else if( !strcmp( self->feElFamily, "linear-regular" ) ) {
+ unsigned nDims;
+
+ nDims = Mesh_GetDimSize( self );
+ if( nDims == 3 )
+ elType = (ElementType*)RegularTrilinear_New( "" );
+ else
+ abort();
+ }
else if( !strcmp( self->feElFamily, "constant" ) ) {
elType = (ElementType*)ConstantElementType_New( "" );
}
@@ -149,6 +171,11 @@
FeMesh_SetElementType( self, elType );
if( self->feElType )
Stg_Component_Build( self->feElType, data, False );
+
+ Journal_Printf( stream, "... FE element types are '%s',\n", elType->type );
+ Journal_Printf( stream, "... done.\n" );
+ Stream_UnIndent( stream );
+ Stream_UnIndent( stream );
}
void _FeMesh_Initialise( void* feMesh, void* data ) {
Modified: long/3D/Gale/trunk/src/StgFEM/Discretisation/src/Init.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/Discretisation/src/Init.c 2007-02-23 20:20:49 UTC (rev 6106)
+++ long/3D/Gale/trunk/src/StgFEM/Discretisation/src/Init.c 2007-02-23 20:20:52 UTC (rev 6107)
@@ -84,6 +84,7 @@
RegisterParent( ElementType_Type, Stg_Component_Type );
RegisterParent( BilinearElementType_Type, ElementType_Type );
RegisterParent( TrilinearElementType_Type, ElementType_Type );
+ RegisterParent( RegularTrilinear_Type, TrilinearElementType_Type );
RegisterParent( ConstantElementType_Type, ElementType_Type );
RegisterParent( LinearTriangleElementType_Type, ElementType_Type );
RegisterParent( ElementType_Register_Type, Stg_Component_Type );
Added: long/3D/Gale/trunk/src/StgFEM/Discretisation/src/RegularTrilinear.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/Discretisation/src/RegularTrilinear.c 2007-02-23 20:20:49 UTC (rev 6106)
+++ long/3D/Gale/trunk/src/StgFEM/Discretisation/src/RegularTrilinear.c 2007-02-23 20:20:52 UTC (rev 6107)
@@ -0,0 +1,163 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+** Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+** Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+** Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+** Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** This library is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with this library; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+**
+** $Id: RegularTrilinear.c 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <mpi.h>
+
+#include "StGermain/StGermain.h"
+#include "Discretisation.h"
+
+
+/* Textual name of this class */
+const Type RegularTrilinear_Type = "RegularTrilinear";
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Constructors
+*/
+
+RegularTrilinear* RegularTrilinear_New( Name name ) {
+ return _RegularTrilinear_New( sizeof(RegularTrilinear),
+ RegularTrilinear_Type,
+ _RegularTrilinear_Delete,
+ _RegularTrilinear_Print,
+ NULL,
+ (void* (*)(Name))_RegularTrilinear_New,
+ _RegularTrilinear_Construct,
+ _RegularTrilinear_Build,
+ _RegularTrilinear_Initialise,
+ _RegularTrilinear_Execute,
+ _RegularTrilinear_Destroy,
+ name,
+ False,
+ _TrilinearElementType_SF_allNodes,
+ _TrilinearElementType_SF_allLocalDerivs_allNodes,
+ RegularTrilinear_ConvertGlobalCoordToElLocal,
+ 8 );
+}
+
+RegularTrilinear* _RegularTrilinear_New( REGULARTRILINEAR_DEFARGS ) {
+ RegularTrilinear* self;
+
+ /* Allocate memory */
+ assert( _sizeOfSelf >= sizeof(RegularTrilinear) );
+ self = (RegularTrilinear*)_TrilinearElementType_New( ELEMENTTYPE_PASSARGS );
+
+ /* Virtual info */
+
+ /* RegularTrilinear info */
+ _RegularTrilinear_Init( self );
+
+ return self;
+}
+
+void _RegularTrilinear_Init( RegularTrilinear* self ) {
+ assert( self && Stg_CheckType( self, RegularTrilinear ) );
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Virtual functions
+*/
+
+void _RegularTrilinear_Delete( void* elementType ) {
+ RegularTrilinear* self = (RegularTrilinear*)elementType;
+
+ /* Delete the parent. */
+ _TrilinearElementType_Delete( self );
+}
+
+void _RegularTrilinear_Print( void* elementType, Stream* stream ) {
+ RegularTrilinear* self = (RegularTrilinear*)elementType;
+
+ /* Set the Journal for printing informations */
+ Stream* elementTypeStream;
+ elementTypeStream = Journal_Register( InfoStream_Type, "RegularTrilinearStream" );
+
+ /* Print parent */
+ Journal_Printf( stream, "RegularTrilinear (ptr): (%p)\n", self );
+ _TrilinearElementType_Print( self, stream );
+}
+
+void _RegularTrilinear_Construct( void* elementType, Stg_ComponentFactory* cf, void* data ) {
+}
+
+void _RegularTrilinear_Build( void* elementType, void* data ) {
+ _TrilinearElementType_Build( elementType, data );
+}
+
+void _RegularTrilinear_Initialise( void* elementType, void* data ) {
+ _TrilinearElementType_Initialise( elementType, data );
+}
+
+void _RegularTrilinear_Execute( void* elementType, void* data ) {
+}
+
+void _RegularTrilinear_Destroy( void* elementType, void* data ) {
+}
+
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+void RegularTrilinear_ConvertGlobalCoordToElLocal( void* elementType, void* mesh, unsigned element,
+ const double* globalCoord, double* localCoord )
+{
+ RegularTrilinear* self = (RegularTrilinear*)elementType;
+ unsigned nInc, *inc;
+ double* vert[2];
+ double w;
+
+ assert( self && Stg_CheckType( self, RegularTrilinear ) );
+
+ Mesh_GetIncidence( mesh, MT_VOLUME, element, MT_VERTEX, &nInc, &inc );
+
+ vert[0] = Mesh_GetVertex( mesh, inc[0] );
+ vert[1] = Mesh_GetVertex( mesh, inc[7] );
+ w = vert[1][0] - vert[0][0];
+ localCoord[0] = 2.0 * (globalCoord[0] - vert[0][0]) / w - 1.0;
+ w = vert[1][1] - vert[0][1];
+ localCoord[1] = 2.0 * (globalCoord[1] - vert[0][1]) / w - 1.0;
+ w = vert[1][2] - vert[0][2];
+ localCoord[2] = 2.0 * (globalCoord[2] - vert[0][2]) / w - 1.0;
+
+ assert( localCoord[0] >= -1.0 && localCoord[0] <= 1.0 );
+ assert( localCoord[1] >= -1.0 && localCoord[1] <= 1.0 );
+ assert( localCoord[2] >= -1.0 && localCoord[2] <= 1.0 );
+}
+
+
+/*----------------------------------------------------------------------------------------------------------------------------------
+** Private Functions
+*/
Added: long/3D/Gale/trunk/src/StgFEM/Discretisation/src/RegularTrilinear.h
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/Discretisation/src/RegularTrilinear.h 2007-02-23 20:20:49 UTC (rev 6106)
+++ long/3D/Gale/trunk/src/StgFEM/Discretisation/src/RegularTrilinear.h 2007-02-23 20:20:52 UTC (rev 6107)
@@ -0,0 +1,97 @@
+/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**
+** Copyright (C), 2003, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
+**
+** Authors:
+** Stevan M. Quenette, Senior Software Engineer, VPAC. (steve at vpac.org)
+** Patrick D. Sunter, Software Engineer, VPAC. (pds at vpac.org)
+** Luke J. Hodkinson, Computational Engineer, VPAC. (lhodkins at vpac.org)
+** Siew-Ching Tan, Software Engineer, VPAC. (siew at vpac.org)
+** Alan H. Lo, Computational Engineer, VPAC. (alan at vpac.org)
+** Raquibul Hassan, Computational Engineer, VPAC. (raq at vpac.org)
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License as published by the Free Software Foundation; either
+** version 2.1 of the License, or (at your option) any later version.
+**
+** This library is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** Lesser General Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with this library; if not, write to the Free Software
+** Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+**
+*/
+/** \file
+** Role:
+**
+** Assumptions:
+**
+** Invariants:
+**
+** Comments:
+**
+** $Id: RegularTrilinear.h 3584 2006-05-16 11:11:07Z PatrickSunter $
+**
+**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
+
+#ifndef __Discretisaton_Mesh_RegularTrilinear_h__
+#define __Discretisaton_Mesh_RegularTrilinear_h__
+
+ /** Textual name of this class */
+ extern const Type RegularTrilinear_Type;
+
+ /** Virtual function types */
+
+ /** RegularTrilinear class contents */
+ #define __RegularTrilinear \
+ /* General info */ \
+ __TrilinearElementType \
+ \
+ /* Virtual info */ \
+ \
+ /* RegularTrilinear info */
+
+ struct RegularTrilinear { __RegularTrilinear };
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Constructors
+ */
+
+ #define REGULARTRILINEAR_DEFARGS \
+ ELEMENTTYPE_DEFARGS
+
+ #define REGULARTRILINEAR_PASSARGS \
+ ELEMENTTYPE_PASSARGS
+
+ RegularTrilinear* RegularTrilinear_New( Name name );
+ RegularTrilinear* _RegularTrilinear_New( REGULARTRILINEAR_DEFARGS );
+ void _RegularTrilinear_Init( RegularTrilinear* self );
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Virtual functions
+ */
+
+ void _RegularTrilinear_Delete( void* elementType );
+ void _RegularTrilinear_Print( void* elementType, Stream* stream );
+ void _RegularTrilinear_Construct( void* elementType, Stg_ComponentFactory* cf, void* data );
+ void _RegularTrilinear_Build( void* elementType, void* data );
+ void _RegularTrilinear_Initialise( void* elementType, void* data );
+ void _RegularTrilinear_Execute( void* elementType, void* data );
+ void _RegularTrilinear_Destroy( void* elementType, void* data );
+
+ void RegularTrilinear_ConvertGlobalCoordToElLocal( void* elementType, void* mesh, unsigned element,
+ const double* globalCoord, double* localCoord );
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Public functions
+ */
+
+ /*--------------------------------------------------------------------------------------------------------------------------
+ ** Private Member functions
+ */
+
+#endif /* __Discretisaton_Mesh_RegularTrilinear_h__ */
Modified: long/3D/Gale/trunk/src/StgFEM/Discretisation/src/types.h
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/Discretisation/src/types.h 2007-02-23 20:20:49 UTC (rev 6106)
+++ long/3D/Gale/trunk/src/StgFEM/Discretisation/src/types.h 2007-02-23 20:20:52 UTC (rev 6107)
@@ -57,6 +57,7 @@
typedef struct ConstantElementType ConstantElementType;
typedef struct BilinearElementType BilinearElementType;
typedef struct TrilinearElementType TrilinearElementType;
+ typedef struct RegularTrilinear RegularTrilinear;
typedef struct LinearTriangleElementType LinearTriangleElementType;
typedef struct FiniteElement_Element FiniteElement_Element;
typedef struct FeMesh FeMesh;
More information about the cig-commits
mailing list