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

walter at geodynamics.org walter at geodynamics.org
Wed Oct 11 13:47:10 PDT 2006


Author: walter
Date: 2006-10-11 13:47:08 -0700 (Wed, 11 Oct 2006)
New Revision: 4851

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/MeshClass.h
Log:
 r2908 at earth:  boo | 2006-10-11 13:42:38 -0700
  r2824 at earth (orig r3812):  LukeHodkinson | 2006-09-26 20:31:05 -0700
  Adding the new topology to the mesh. At the moment
  the new topology is optional.
  
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2907
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3811
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2908
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3812

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c	2006-10-11 20:47:06 UTC (rev 4850)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.c	2006-10-11 20:47:08 UTC (rev 4851)
@@ -36,6 +36,7 @@
 
 #include "types.h"
 #include "shortcuts.h"
+#include "MeshTopology.h"
 #include "MeshClass.h"
 
 #include <stdio.h>
@@ -66,7 +67,7 @@
 		_Mesh_Delete, 
 		_Mesh_Print, 
 		_Mesh_Copy, 
-		(void*)Mesh_DefaultNew,
+		(void* (*)(Name))Mesh_DefaultNew,
 		_Mesh_Construct,
 		_Mesh_Build, 
 		_Mesh_Initialise, 
@@ -99,7 +100,7 @@
 		_Mesh_Delete, 
 		_Mesh_Print, 
 		_Mesh_Copy, 
-		(void*)Mesh_DefaultNew,
+		(void* (*)(Name))Mesh_DefaultNew,
 		_Mesh_Construct,
 		_Mesh_Build, 
 		_Mesh_Initialise, 
@@ -138,7 +139,7 @@
 	self->_delete = _Mesh_Delete;
 	self->_print = _Mesh_Print;
 	self->_copy = _Mesh_Copy;
-	self->_defaultConstructor = (void*)Mesh_DefaultNew;
+	self->_defaultConstructor = (void* (*)(Name))Mesh_DefaultNew;
 	self->_construct = _Mesh_Construct,
 	self->_build = _Mesh_Build;
 	self->_initialise = _Mesh_Initialise;
@@ -223,6 +224,12 @@
 	ExtensionManager_Register_Add( extensionMgr_Register, self->elementExtensionMgr );
 	self->extensionMgr_Register = extensionMgr_Register;
 	self->debug = Journal_Register( Debug_Type, self->type );
+
+	/* New topology stuff. */
+	self->topo = MeshTopology_New( "" );
+	self->useTopo = False;
+	self->generator = NULL;
+	self->info = ExtensionManager_New_OfExistingObject( "mesh_info", self );
 	
 	/* Nodes */
 	self->nodeLocalCount = 0;
@@ -374,7 +381,8 @@
 
 void _Mesh_Delete( void* mesh ) {
 	Mesh* self = (Mesh*)mesh;
-	
+
+	FreeObject( self->topo );
 	Memory_Free( self->nodeCoord );
 
 	Mesh_DestroyTables( self );
@@ -954,8 +962,15 @@
 void _Mesh_Build( void* mesh, void* data ) {
 	Mesh* self = (Mesh*) mesh;
 
+	/* Run the generator if we have one. */
+	if( self->generator )
+		Build( self->generator, data, False );
+
 	/* Build Layout */
 	Build( self->layout, data, False );
+
+	/* KIND OF HACK: Add the topology to the element layout. */
+	self->layout->elementLayout->topo = self->topo;
 	
 	if ( self->layout->decomp->rank >= self->layout->decomp->procsInUse ) return;
 
@@ -1634,7 +1649,7 @@
 	assert( self->buildNodeNeighbourTbl && self->nodeNeighbourTbl );
 
 	/* Begin somewhere in the middle. */
-	curNode = self->nodeLocalCount / 2;
+	curNode = self->nodeDomainCount / 2;
 
 	/* Calc distance squared to current node. */
 	tmp = nodeCrds[curNode][0] - crd[0];
@@ -1658,7 +1673,7 @@
 			double	nbrDist;
 
 			/* Skip invalid neighbours. */
-			if( nbrs[nbr_i] >= self->nodeLocalCount )
+			if( nbrs[nbr_i] >= self->nodeDomainCount )
 				continue;
 
 			tmp = nodeCrds[nbrs[nbr_i]][0] - crd[0];
@@ -1725,7 +1740,7 @@
 		closeNode = Mesh_ClosestNode( self, pnt );
 		elInd = eLyt->elementWithPoint( eLyt, self->layout->decomp, pnt, bndStat, 
 						self->nodeElementCountTbl[closeNode], self->nodeElementTbl[closeNode] );
-		if( elInd >= self->elementLocalCount )
+		if( elInd >= self->elementDomainCount )
 			elInd = eLyt->elementWithPoint( eLyt, self->layout->decomp, pnt, bndStat, 0, NULL );
 
 		return elInd;
@@ -2042,8 +2057,8 @@
 		 * Calculate where my shadow elements are going to come from.
 		 */
 		
-		// TODO: FIX TAGS
-		// TODO: see if some of this can be reduced into re-usable funcs
+		/* TODO: FIX TAGS */
+		/* TODO: see if some of this can be reduced into re-usable funcs */
 
 		/* allocate some work space */
 		request = Memory_Alloc_Array( MPI_Request , self->procNbrInfo->procNbrCnt, "MPI_Request_procNbrCnt" );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.h	2006-10-11 20:47:06 UTC (rev 4850)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/MeshClass.h	2006-10-11 20:47:08 UTC (rev 4851)
@@ -84,20 +84,26 @@
 	typedef Bool			(Mesh_Element_IsShadowFunction)		( void* mesh, Element_DomainIndex domainIndex );
 	
 	/** Mesh class contents */
-	#define __Mesh \
-		/* General info */ \
-		__Stg_Component \
-		Stream*					debug; \
-		Dictionary*				dictionary; \
-		\
-		/* Virtual info */ \
-		/* Node mapping functions */ \
-		Mesh_Node_IsLocalFunction*		nodeIsLocal; \
-		Mesh_Node_IsShadowFunction*		nodeIsShadow; \
-		/* Element mapping functions */ \
-		Mesh_Element_IsLocalFunction*		elementIsLocal; \
-		Mesh_Element_IsShadowFunction*		elementIsShadow; \
-		\
+	#define __Mesh								\
+		/* General info */						\
+		__Stg_Component							\
+		Stream*					debug;			\
+		Dictionary*				dictionary;		\
+										\
+		/* Virtual info */						\
+										\
+		MeshTopology*				topo;			\
+		Bool					useTopo;		\
+		MeshGenerator*				generator;		\
+		ExtensionManager*			info;			\
+										\
+		/* Node mapping functions */					\
+		Mesh_Node_IsLocalFunction*		nodeIsLocal;		\
+		Mesh_Node_IsShadowFunction*		nodeIsShadow;		\
+		/* Element mapping functions */					\
+		Mesh_Element_IsLocalFunction*		elementIsLocal;		\
+		Mesh_Element_IsShadowFunction*		elementIsShadow;	\
+										\
 		/* Mesh info ... */ \
 		MeshLayout*				layout; \
 		/** Extensions to individual nodes */ \
@@ -109,7 +115,7 @@
 		/* Node */ \
 		Node_List				node; \
 		Coord*					nodeCoord; \
-		unsigned				nSpaceDims; \
+		unsigned				nSpaceDims;\
 		/* counts */ \
 		Node_LocalIndex				nodeLocalCount; \
 		Node_DomainIndex			nodeDomainCount; \
@@ -388,7 +394,7 @@
 	double Mesh_NodeSeparation( Mesh* self );
 
 	unsigned Mesh_ElementWithPoint( void* mesh, Coord pnt, PartitionBoundaryStatus bndStat );
-	
+
 	void Mesh_Sync( void* mesh );
 	
 	/*--------------------------------------------------------------------------------------------------------------------------



More information about the cig-commits mailing list