[cig-commits] commit:

Mercurial hg at geodynamics.org
Mon Nov 24 11:58:09 PST 2008


changeset:   4:1e8c94d60a06
user:        LukeHodkinson
date:        Thu Oct 18 00:26:16 2007 +0000
files:       Mesh/src/MeshClass.c Mesh/src/MeshTopology.def Mesh/src/Mesh_Algorithms.c Mesh/src/Mesh_HexType.c
description:
Some minor changes to allow the new AMR topology
class to be used in the same way as the incidence
graph equivalent.


diff -r 2134b3bf9e06 -r 1e8c94d60a06 Mesh/src/MeshClass.c
--- a/Mesh/src/MeshClass.c	Thu Oct 11 08:01:40 2007 +0000
+++ b/Mesh/src/MeshClass.c	Thu Oct 18 00:26:16 2007 +0000
@@ -272,7 +272,10 @@ unsigned Mesh_GetLocalSize( void* mesh, 
 	assert( self );
 	assert( self->topo );
 
-	return Decomp_GetNumLocals( Sync_GetDecomp( IGraph_GetDomain( self->topo, dim ) ) );
+	if( Class_IsSuper( self->topo, IGraph ) )
+		return Decomp_GetNumLocals( Sync_GetDecomp( IGraph_GetDomain( self->topo, dim ) ) );
+	else
+		return MeshTopology_GetNumCells( self->topo, dim );
 }
 
 unsigned Mesh_GetRemoteSize( void* mesh, MeshTopology_Dim dim ) {
@@ -290,7 +293,10 @@ unsigned Mesh_GetDomainSize( void* mesh,
 	assert( self );
 	assert( self->topo );
 
-	return Sync_GetNumDomains( IGraph_GetDomain( self->topo, dim ) );
+	if( Class_IsSuper( self->topo, IGraph ) )
+		return Sync_GetNumDomains( IGraph_GetDomain( self->topo, dim ) );
+	else
+		return MeshTopology_GetNumCells( self->topo, dim );
 }
 
 unsigned Mesh_GetSharedSize( void* mesh, MeshTopology_Dim dim ) {
@@ -551,12 +557,14 @@ void Mesh_DeformationUpdate( void* mesh 
 
 	assert( self );
 
-	self->minSep = Mesh_Algorithms_GetMinimumSeparation( self->algorithms, self->minAxialSep );
-	Mesh_Algorithms_GetLocalCoordRange( self->algorithms, self->minLocalCrd, self->maxLocalCrd );
-	Mesh_Algorithms_GetDomainCoordRange( self->algorithms, self->minDomainCrd, self->maxDomainCrd );
-	Mesh_Algorithms_GetGlobalCoordRange( self->algorithms, self->minGlobalCrd, self->maxGlobalCrd );
-
-	Mesh_Algorithms_Update( self->algorithms );
+	if( Mesh_GetDomainSize( self, 0 ) ) {
+		self->minSep = Mesh_Algorithms_GetMinimumSeparation( self->algorithms, self->minAxialSep );
+		Mesh_Algorithms_GetLocalCoordRange( self->algorithms, self->minLocalCrd, self->maxLocalCrd );
+		Mesh_Algorithms_GetDomainCoordRange( self->algorithms, self->minDomainCrd, self->maxDomainCrd );
+		Mesh_Algorithms_GetGlobalCoordRange( self->algorithms, self->minGlobalCrd, self->maxGlobalCrd );
+
+		Mesh_Algorithms_Update( self->algorithms );
+	}
 }
 
 void Mesh_Sync( void* mesh ) {
diff -r 2134b3bf9e06 -r 1e8c94d60a06 Mesh/src/MeshTopology.def
--- a/Mesh/src/MeshTopology.def	Thu Oct 11 08:01:40 2007 +0000
+++ b/Mesh/src/MeshTopology.def	Thu Oct 18 00:26:16 2007 +0000
@@ -49,6 +49,10 @@ METHOD( GetComm, const Comm*,
 	(const void* self), 
 	(self) )
 
+ABSTRACTMETHOD( GetNumCells, int,
+		(const void* self, int dim),
+		(self, dim) )
+
 VOIDABSTRACTMETHOD( GetIncidence, void, 
 		    (void* self, int fromDim, int fromEl, int toDim, IArray* inc), 
 		    (self, fromDim, fromEl, toDim, inc) )
diff -r 2134b3bf9e06 -r 1e8c94d60a06 Mesh/src/Mesh_Algorithms.c
--- a/Mesh/src/Mesh_Algorithms.c	Thu Oct 11 08:01:40 2007 +0000
+++ b/Mesh/src/Mesh_Algorithms.c	Thu Oct 18 00:26:16 2007 +0000
@@ -163,15 +163,21 @@ void _Mesh_Algorithms_Update( void* algo
 	if( !self->mesh )
 		return;
 
-	if( Mesh_HasIncidence( self->mesh, MT_VERTEX, MT_VERTEX ) )
+	if( !Class_IsSuper( self->mesh->topo, IGraph ) || 
+	    Mesh_HasIncidence( self->mesh, MT_VERTEX, MT_VERTEX ) )
+	{
 		self->nearestVertex = Mesh_Algorithms_NearestVertexWithNeighbours;
+	}
 	else
 		self->nearestVertex = Mesh_Algorithms_NearestVertexGeneral;
 
 	nDims = Mesh_GetDimSize( self->mesh );
 	for( d_i = 0; d_i < nDims; d_i++ ) {
-		if( !Mesh_GetGlobalSize( self->mesh, d_i ) || !Mesh_HasIncidence( self->mesh, nDims, d_i ) )
+	   if( Class_IsSuper( self->mesh->topo, IGraph ) &&
+	       (!Mesh_GetGlobalSize( self->mesh, d_i ) || !Mesh_HasIncidence( self->mesh, nDims, d_i )) )
+	   {
 			break;
+	   }
 	}
 	if( d_i == nDims )
 		self->search = Mesh_Algorithms_SearchWithFullIncidence;
diff -r 2134b3bf9e06 -r 1e8c94d60a06 Mesh/src/Mesh_HexType.c
--- a/Mesh/src/Mesh_HexType.c	Thu Oct 11 08:01:40 2007 +0000
+++ b/Mesh/src/Mesh_HexType.c	Thu Oct 18 00:26:16 2007 +0000
@@ -149,8 +149,11 @@ void Mesh_HexType_Update( void* hexType 
 
 	nDims = Mesh_GetDimSize( self->mesh );
 	for( d_i = 0; d_i < nDims; d_i++ ) {
-		if( !Mesh_GetGlobalSize( self->mesh, d_i ) || !Mesh_HasIncidence( self->mesh, nDims, d_i ) )
+		if( Class_IsSuper( self->mesh->topo, IGraph ) && 
+		    (!Mesh_GetGlobalSize( self->mesh, d_i ) || !Mesh_HasIncidence( self->mesh, nDims, d_i )) )
+		{
 			break;
+		}
 	}
 
 	if( Mesh_GetDimSize( self->mesh ) == 3 ) {



More information about the CIG-COMMITS mailing list