[cig-commits] r5774 - in long/3D/Gale/trunk/src/StGermain: . Discretisation/Mesh/src

walter at geodynamics.org walter at geodynamics.org
Thu Jan 11 21:04:28 PST 2007


Author: walter
Date: 2007-01-11 21:04:27 -0800 (Thu, 11 Jan 2007)
New Revision: 5774

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_CentroidType.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_CentroidType.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_ElementType.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_ElementType.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_HexType.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_HexType.h
Log:
 r3283 at earth (orig r3957):  LukeHodkinson | 2007-01-10 15:01:54 -0800
 More cleanup.
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/branches/decomp3d/StGermain:3956
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/branches/decomp3d/StGermain:3957
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c	2007-01-12 05:04:23 UTC (rev 5773)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c	2007-01-12 05:04:27 UTC (rev 5774)
@@ -459,7 +459,7 @@
 	assert( self->elTypeMap[element] < self->nElTypes );
 	assert( self->elTypes[self->elTypeMap[element]] );
 
-	return Mesh_ElementType_ElementHasPoint( self->elTypes[self->elTypeMap[element]], self, element, point, 
+	return Mesh_ElementType_ElementHasPoint( self->elTypes[self->elTypeMap[element]], element, point, 
 						 dim, ind );
 }
 

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c	2007-01-12 05:04:23 UTC (rev 5773)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_Algorithms.c	2007-01-12 05:04:27 UTC (rev 5774)
@@ -264,7 +264,7 @@
 		double			curSep;
 
 		elType = Mesh_GetElementType( mesh, e_i );
-		curSep = Mesh_ElementType_GetMinimumSeparation( elType, mesh, e_i, dimSep );
+		curSep = Mesh_ElementType_GetMinimumSeparation( elType, e_i, dimSep );
 		if( curSep < minSep ) {
 			minSep = curSep;
 			if( perDim )

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_CentroidType.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_CentroidType.c	2007-01-12 05:04:23 UTC (rev 5773)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_CentroidType.c	2007-01-12 05:04:27 UTC (rev 5774)
@@ -61,6 +61,7 @@
 				       _Mesh_CentroidType_Delete, 
 				       _Mesh_CentroidType_Print, 
 				       NULL, 
+				       Mesh_CentroidType_Update, 
 				       Mesh_CentroidType_ElementHasPoint, 
 				       Mesh_CentroidType_GetMinimumSeparation, 
 				       Mesh_CentroidType_GetCentroid );
@@ -92,25 +93,31 @@
 ** Virtual functions
 */
 
-void _Mesh_CentroidType_Delete( void* elementType ) {
-	Mesh_CentroidType*	self = (Mesh_CentroidType*)elementType;
+void _Mesh_CentroidType_Delete( void* centroidType ) {
+	Mesh_CentroidType*	self = (Mesh_CentroidType*)centroidType;
 
 	/* Delete the parent. */
 	_Mesh_ElementType_Delete( self );
 }
 
-void _Mesh_CentroidType_Print( void* elementType, Stream* stream ) {
-	Mesh_CentroidType*	self = (Mesh_CentroidType*)elementType;
-	Stream*			elementTypeStream;
+void _Mesh_CentroidType_Print( void* centroidType, Stream* stream ) {
+	Mesh_CentroidType*	self = (Mesh_CentroidType*)centroidType;
+	Stream*			centroidTypeStream;
 
-	elementTypeStream = Journal_Register( InfoStream_Type, "Mesh_CentroidTypeStream" );
+	centroidTypeStream = Journal_Register( InfoStream_Type, "Mesh_CentroidTypeStream" );
 
 	/* Print parent */
 	Journal_Printf( stream, "Mesh_CentroidType (ptr): (%p)\n", self );
 	_Mesh_ElementType_Print( self, stream );
 }
 
-Bool Mesh_CentroidType_ElementHasPoint( void* centroidType, void* _mesh, unsigned elInd, double* point, 
+void Mesh_CentroidType_Update( void* centroidType ) {
+	Mesh_CentroidType*	self = (Mesh_CentroidType*)centroidType;
+
+	assert( self && Stg_CheckType( self, Mesh_CentroidType ) );
+}
+
+Bool Mesh_CentroidType_ElementHasPoint( void* centroidType, unsigned elInd, double* point, 
 					MeshTopology_Dim* dim, unsigned* ind )
 {
 	Mesh_CentroidType*	self = (Mesh_CentroidType*)centroidType;
@@ -120,7 +127,7 @@
 	return Mesh_ElementHasPoint( self->elMesh, elInd, point, dim, ind );
 }
 
-double Mesh_CentroidType_GetMinimumSeparation( void* centroidType, void* mesh, unsigned elInd, double* perDim ) {
+double Mesh_CentroidType_GetMinimumSeparation( void* centroidType, unsigned elInd, double* perDim ) {
 	Mesh_CentroidType*	self = (Mesh_CentroidType*)centroidType;
 	Mesh_ElementType*	elType;
 
@@ -128,15 +135,18 @@
 
 	elType = Mesh_GetElementType( self->elMesh, elInd );
 
-	return Mesh_ElementType_GetMinimumSeparation( elType, self->elMesh, elInd, perDim );
+	return Mesh_ElementType_GetMinimumSeparation( elType, elInd, perDim );
 }
 
-void Mesh_CentroidType_GetCentroid( void* centroidType, void* mesh, unsigned element, double* centroid ) {
-	unsigned	nInc, *inc;
+void Mesh_CentroidType_GetCentroid( void* centroidType, unsigned element, double* centroid ) {
+	Mesh_CentroidType*	self = (Mesh_CentroidType*)centroidType;
+	unsigned		nInc, *inc;
 
-	Mesh_GetIncidence( mesh, Mesh_GetDimSize( mesh ), element, MT_VERTEX, &nInc, &inc );
+	assert( self && Stg_CheckType( self, Mesh_CentroidType ) );
+
+	Mesh_GetIncidence( self->mesh, Mesh_GetDimSize( self->mesh ), element, MT_VERTEX, &nInc, &inc );
 	assert( nInc == 1 );
-	memcpy( centroid, Mesh_GetVertex( mesh, inc[0] ), Mesh_GetDimSize( mesh ) * sizeof(unsigned) );
+	memcpy( centroid, Mesh_GetVertex( self->mesh, inc[0] ), Mesh_GetDimSize( self->mesh ) * sizeof(unsigned) );
 }
 
 
@@ -148,6 +158,7 @@
 	Mesh_CentroidType*	self = (Mesh_CentroidType*)centroidType;
 
 	assert( self && Stg_CheckType( self, Mesh_CentroidType ) );
+	assert( !mesh || Stg_CheckType( mesh, Mesh ) );
 
 	self->elMesh = mesh;
 }

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_CentroidType.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_CentroidType.h	2007-01-12 05:04:23 UTC (rev 5773)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_CentroidType.h	2007-01-12 05:04:27 UTC (rev 5774)
@@ -54,7 +54,7 @@
 		/* Virtual info */			\
 							\
 		/* Mesh_CentroidType info */		\
-		Mesh*		elMesh;
+		Mesh*			elMesh;
 
 	struct Mesh_CentroidType { __Mesh_CentroidType };
 
@@ -79,10 +79,11 @@
 	void _Mesh_CentroidType_Delete( void* centroidType );
 	void _Mesh_CentroidType_Print( void* centroidType, Stream* stream );
 
-	Bool Mesh_CentroidType_ElementHasPoint( void* centroidType, void* mesh, unsigned elInd, double* point, 
+	void Mesh_CentroidType_Update( void* centroidType );
+	Bool Mesh_CentroidType_ElementHasPoint( void* centroidType, unsigned elInd, double* point, 
 					   MeshTopology_Dim* dim, unsigned* ind );
-	double Mesh_CentroidType_GetMinimumSeparation( void* centroidType, void* mesh, unsigned elInd, double* perDim );
-	void Mesh_CentroidType_GetCentroid( void* centroidType, void* mesh, unsigned element, double* centroid );
+	double Mesh_CentroidType_GetMinimumSeparation( void* centroidType, unsigned elInd, double* perDim );
+	void Mesh_CentroidType_GetCentroid( void* centroidType, unsigned element, double* centroid );
 
 	/*--------------------------------------------------------------------------------------------------------------------------
 	** Public functions

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_ElementType.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_ElementType.c	2007-01-12 05:04:23 UTC (rev 5773)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_ElementType.c	2007-01-12 05:04:27 UTC (rev 5774)
@@ -128,7 +128,7 @@
 	Mesh_ElementType*	self = (Mesh_ElementType*)elementType;
 
 	assert( self && Stg_CheckType( self, Mesh_ElementType ) );
-	assert( mesh && Stg_CheckType( mesh, Mesh ) );
+	assert( !mesh || Stg_CheckType( mesh, Mesh ) );
 
 	self->mesh = mesh;
 	Mesh_ElementType_Update( self );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_ElementType.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_ElementType.h	2007-01-12 05:04:23 UTC (rev 5773)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_ElementType.h	2007-01-12 05:04:27 UTC (rev 5774)
@@ -73,14 +73,14 @@
 
 	#define MESH_ELEMENTTYPE_DEFARGS							\
 		STG_CLASS_DEFARGS,								\
-		Mesh_ElementType_UpdateFunc*			updateFunc;			\
+		Mesh_ElementType_UpdateFunc*			updateFunc, 			\
 		Mesh_ElementType_ElementHasPointFunc*		elementHasPointFunc,		\
 		Mesh_ElementType_GetMinimumSeparationFunc*	getMinimumSeparationFunc,	\
 		Mesh_ElementType_GetCentroidFunc*		getCentroidFunc
 
 	#define MESH_ELEMENTTYPE_PASSARGS	\
 		STG_CLASS_PASSARGS, 		\
-		updateFunc, 			\		
+		updateFunc, 			\
 		elementHasPointFunc, 		\
 		getMinimumSeparationFunc,	\
 		getCentroidFunc
@@ -102,10 +102,10 @@
 	#define Mesh_ElementType_ElementHasPoint( self, element, point, dim, ind )		\
 		VirtualCall( self, elementHasPointFunc, self, element, point, dim, ind )
 
-	#define Mesh_ElementType_GetMinimumSeparation( elementType, element, perDim )		\
+	#define Mesh_ElementType_GetMinimumSeparation( self, element, perDim )			\
 		VirtualCall( self, getMinimumSeparationFunc, self, element, perDim )
 
-	#define Mesh_ElementType_GetCentroid( elementType, element, centroid )			\
+	#define Mesh_ElementType_GetCentroid( self, element, centroid )				\
 		VirtualCall( self, getCentroidFunc, self, element, centroid )
 
 	/*--------------------------------------------------------------------------------------------------------------------------

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_HexType.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_HexType.c	2007-01-12 05:04:23 UTC (rev 5773)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_HexType.c	2007-01-12 05:04:27 UTC (rev 5774)
@@ -61,6 +61,7 @@
 				  _Mesh_HexType_Delete, 
 				  _Mesh_HexType_Print, 
 				  NULL, 
+				  Mesh_HexType_Update, 
 				  Mesh_HexType_ElementHasPoint, 
 				  Mesh_HexType_GetMinimumSeparation, 
 				  _Mesh_ElementType_GetCentroid );
@@ -82,6 +83,23 @@
 }
 
 void _Mesh_HexType_Init( Mesh_HexType* self ) {
+	assert( self && Stg_CheckType( self, Mesh_HexType ) );
+
+	self->triInds = AllocArray2D( unsigned, 2, 3 );
+	self->triInds[0][0] = 0; self->triInds[0][1] = 1; self->triInds[0][2] = 2;
+	self->triInds[1][0] = 1; self->triInds[1][1] = 3; self->triInds[1][2] = 2;
+
+	self->tetInds = AllocArray2D( unsigned, 10, 4 );
+	self->tetInds[0][0] = 0; self->tetInds[0][1] = 1; self->tetInds[0][2] = 2; self->tetInds[0][3] = 4;
+	self->tetInds[1][0] = 1; self->tetInds[1][1] = 2; self->tetInds[1][2] = 3; self->tetInds[1][3] = 7;
+	self->tetInds[2][0] = 1; self->tetInds[2][1] = 4; self->tetInds[2][2] = 5; self->tetInds[2][3] = 7;
+	self->tetInds[3][0] = 2; self->tetInds[3][1] = 4; self->tetInds[3][2] = 6; self->tetInds[3][3] = 7;
+	self->tetInds[4][0] = 1; self->tetInds[4][1] = 2; self->tetInds[4][2] = 4; self->tetInds[4][3] = 7;
+	self->tetInds[5][0] = 0; self->tetInds[5][1] = 1; self->tetInds[5][2] = 3; self->tetInds[5][3] = 5;
+	self->tetInds[6][0] = 0; self->tetInds[6][1] = 4; self->tetInds[6][2] = 5; self->tetInds[6][3] = 6;
+	self->tetInds[7][0] = 0; self->tetInds[7][1] = 2; self->tetInds[7][2] = 3; self->tetInds[7][3] = 6;
+	self->tetInds[8][0] = 3; self->tetInds[8][1] = 5; self->tetInds[8][2] = 6; self->tetInds[8][3] = 7;
+	self->tetInds[9][0] = 0; self->tetInds[9][1] = 3; self->tetInds[9][2] = 5; self->tetInds[9][3] = 6;
 }
 
 
@@ -92,6 +110,9 @@
 void _Mesh_HexType_Delete( void* elementType ) {
 	Mesh_HexType*	self = (Mesh_HexType*)elementType;
 
+	FreeArray( self->triInds );
+	FreeArray( self->tetInds );
+
 	/* Delete the parent. */
 	_Mesh_ElementType_Delete( self );
 }
@@ -107,21 +128,23 @@
 	_Mesh_ElementType_Print( self, stream );
 }
 
+void Mesh_HexType_Update( void* hexType ) {
+	Mesh_HexType*	self = (Mesh_HexType*)hexType;
 
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
+	assert( self && Stg_CheckType( self, Mesh_HexType ) );
+}
 
 Bool Mesh_HexType_ElementHasPoint( void* hexType, unsigned elInd, double* point, 
 				   MeshTopology_Dim* dim, unsigned* ind )
 {
 	Mesh_HexType*	self = (Mesh_HexType*)hexType;
 
+	assert( self && Stg_CheckType( self, Mesh_HexType ) );
 	assert( Mesh_GetDimSize( self->mesh ) <= 3 );
 
-	if( Mesh_GetDimSize( mesh ) == 3 )
+	if( Mesh_GetDimSize( self->mesh ) == 3 )
 		return Mesh_HexType_ElementHasPoint3D( self, elInd, point, dim, ind );
-	else if( Mesh_GetDimSize( mesh ) == 2 )
+	else if( Mesh_GetDimSize( self->mesh ) == 2 )
 		return Mesh_HexType_ElementHasPoint2D( self, elInd, point, dim, ind );
 	else
 		return Mesh_HexType_ElementHasPoint1D( self, elInd, point, dim, ind );
@@ -221,6 +244,11 @@
 }
 
 
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
+
 /*----------------------------------------------------------------------------------------------------------------------------------
 ** Private Functions
 */
@@ -234,10 +262,6 @@
 	MeshTopology*	topo;
 	unsigned	inside;
 
-	static const unsigned	tetInds[10][4] = {{0, 1, 2, 4}, {1, 2, 3, 7}, {1, 4, 5, 7}, {2, 4, 6, 7}, 
-						  {1, 2, 4, 7}, {0, 1, 3, 5}, {0, 4, 5, 6}, {0, 2, 3, 6}, 
-						  {3, 5, 6, 7}, {0, 3, 5, 6}};
-
 	assert( self && Stg_CheckType( self, Mesh_HexType ) );
 	assert( Mesh_GetDimSize( self->mesh ) == 3 );
 	assert( elInd < Mesh_GetDomainSize( self->mesh, Mesh_GetDimSize( self->mesh ) ) );
@@ -726,8 +750,6 @@
 	MeshTopology*	topo;
 	unsigned	inside;
 
-	static const unsigned	triInds[2][3] = {{0, 1, 2}, {1, 3, 2}};
-
 	assert( self && Stg_CheckType( self, Mesh_HexType ) );
 	assert( Mesh_GetDimSize( self->mesh ) == 2 );
 	assert( elInd < Mesh_GetDomainSize( self->mesh, Mesh_GetDimSize( self->mesh ) ) );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_HexType.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_HexType.h	2007-01-12 05:04:23 UTC (rev 5773)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Mesh_HexType.h	2007-01-12 05:04:27 UTC (rev 5774)
@@ -53,7 +53,9 @@
 							\
 		/* Virtual info */			\
 							\
-		/* Mesh_HexType info */
+		/* Mesh_HexType info */			\
+		unsigned**		triInds;	\
+		unsigned**		tetInds;
 
 	struct Mesh_HexType { __Mesh_HexType };
 
@@ -78,6 +80,7 @@
 	void _Mesh_HexType_Delete( void* hexType );
 	void _Mesh_HexType_Print( void* hexType, Stream* stream );
 
+	void Mesh_HexType_Update( void* hexType );
 	Bool Mesh_HexType_ElementHasPoint( void* hexType, unsigned elInd, double* point, 
 					   MeshTopology_Dim* dim, unsigned* ind );
 	double Mesh_HexType_GetMinimumSeparation( void* hexType, unsigned elInd, double* perDim );
@@ -90,11 +93,11 @@
 	** Private Member functions
 	*/
 
-	Bool Mesh_HexType_ElementHasPoint3D( Mesh_HexType* self, Mesh* mesh, unsigned elInd, double* point, 
+	Bool Mesh_HexType_ElementHasPoint3D( Mesh_HexType* self, unsigned elInd, double* point, 
 					     MeshTopology_Dim* dim, unsigned* ind );
-	Bool Mesh_HexType_ElementHasPoint2D( Mesh_HexType* self, Mesh* mesh, unsigned elInd, double* point, 
+	Bool Mesh_HexType_ElementHasPoint2D( Mesh_HexType* self, unsigned elInd, double* point, 
 					     MeshTopology_Dim* dim, unsigned* ind );
-	Bool Mesh_HexType_ElementHasPoint1D( Mesh_HexType* self, Mesh* mesh, unsigned elInd, double* point, 
+	Bool Mesh_HexType_ElementHasPoint1D( Mesh_HexType* self, unsigned elInd, double* point, 
 					     MeshTopology_Dim* dim, unsigned* ind );
 	void Mesh_HexType_TetBarycenter( double** verts, unsigned* inc, unsigned* inds, double* point, double* bc );
 	void Mesh_HexType_TriBarycenter( double** verts, unsigned* inc, unsigned* inds, double* point, double* bc );



More information about the cig-commits mailing list