[cig-commits] r13088 - long/3D/SNAC/trunk/Snac/plugins/remesher

echoi at geodynamics.org echoi at geodynamics.org
Wed Oct 15 12:11:30 PDT 2008


Author: echoi
Date: 2008-10-15 12:11:30 -0700 (Wed, 15 Oct 2008)
New Revision: 13088

Modified:
   long/3D/SNAC/trunk/Snac/plugins/remesher/Remesh.c
Log:
fixed a bug of overwriting the initially computed vertical balance.



Modified: long/3D/SNAC/trunk/Snac/plugins/remesher/Remesh.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/remesher/Remesh.c	2008-10-15 19:09:56 UTC (rev 13087)
+++ long/3D/SNAC/trunk/Snac/plugins/remesher/Remesh.c	2008-10-15 19:11:30 UTC (rev 13088)
@@ -91,16 +91,18 @@
 								context->meshExtensionMgr,
 								mesh,
 								SnacRemesher_MeshHandle );
+		Node_LocalIndex		newNode_i;
 
 		Journal_Printf( context->snacInfo, "Remeshing!\n" );
 		
 		/*
-		** If spherical coordinates are being used, then we'll need to convert the current mesh's cartesian coordinates 
+		** If spherical coordinates are being used, 
+		** then we'll need to convert the current mesh's cartesian coordinates 
 		** to spherical coordinates first.
 		*/
 		
 		if( meshExt->meshType == SnacRemesher_Spherical ) {
-			unsigned	lNode_i;
+			Node_LocalIndex	lNode_i;
 			
 			for( lNode_i = 0; lNode_i < mesh->nodeLocalCount; lNode_i++ ) {
 				double	x = mesh->nodeCoord[lNode_i][0];
@@ -124,11 +126,26 @@
 		/* Interpolate current nodal values onto new coordinates. */
 		meshExt->newNodes = (Snac_Node*)ExtensionManager_Malloc( mesh->nodeExtensionMgr, mesh->nodeLocalCount );
 		_SnacRemesher_InterpolateNodes( context );
+
+		/* Don't forget the residualFr/Ft: This simple copy works because bottoms nodes are always bottom and remeshing doesn't change the node number. */
+		for( newNode_i = 0; newNode_i < mesh->nodeLocalCount; newNode_i++ ) {
+			Snac_Node* dstNode = 
+				(Snac_Node*)ExtensionManager_At( context->mesh->nodeExtensionMgr,
+												 meshExt->newNodes,
+												 newNode_i );
+
+			Snac_Node* srcNode = 
+				Snac_Node_At( context, newNode_i );
+
+			dstNode->residualFr = srcNode->residualFr;
+			dstNode->residualFt = srcNode->residualFt;
+		}
 		
 		/* Interpolate current elemental values onto new coordinates. */
 		meshExt->newElements = (Snac_Element*)ExtensionManager_Malloc( mesh->elementExtensionMgr, mesh->elementLocalCount );
 		_SnacRemesher_InterpolateElements( context );
 		
+
 		/* Copy accross the new coord, node & element information to the current arrays. */
 		memcpy( mesh->nodeCoord, meshExt->newNodeCoords, mesh->nodeLocalCount * sizeof(Coord) );
 		memcpy( mesh->node, meshExt->newNodes, mesh->nodeExtensionMgr->finalSize * mesh->nodeLocalCount );
@@ -170,7 +187,6 @@
 	}
 }
 
-
 #if 0
 void _SnacRemesher_Sync( void* _context ) {
 	Snac_Context*				context = (Snac_Context*)_context;



More information about the cig-commits mailing list