[cig-commits] r16575 - long/3D/SNAC/trunk/Snac/plugins/remesherSPR

echoi at geodynamics.org echoi at geodynamics.org
Thu Apr 22 08:03:41 PDT 2010


Author: echoi
Date: 2010-04-22 08:03:41 -0700 (Thu, 22 Apr 2010)
New Revision: 16575

Modified:
   long/3D/SNAC/trunk/Snac/plugins/remesherSPR/Remesh.c
   long/3D/SNAC/trunk/Snac/plugins/remesherSPR/Remesh.h
   long/3D/SNAC/trunk/Snac/plugins/remesherSPR/RemeshElements.c
   long/3D/SNAC/trunk/Snac/plugins/remesherSPR/RemeshNodes.c
Log:
Nodal field recovery is now done before syncing.



Modified: long/3D/SNAC/trunk/Snac/plugins/remesherSPR/Remesh.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/remesherSPR/Remesh.c	2010-04-22 00:13:06 UTC (rev 16574)
+++ long/3D/SNAC/trunk/Snac/plugins/remesherSPR/Remesh.c	2010-04-22 15:03:41 UTC (rev 16575)
@@ -116,6 +116,8 @@
 			}
 		}
 		
+		_SnacRemesher_RecoverNodes( context );
+
 		/* Sync the mesh. */
 		if( mesh->layout->decomp->procsInUse > 1 ) {
 			Mesh_Sync( mesh );
@@ -158,7 +160,7 @@
 
 		/* Simply average the recovered fields at the barycenter of each tet and run updateElements. */
    		_SnacRemesher_InterpolateElements( context );
-  		_SnacRemesher_UpdateElements( context ); 
+   		_SnacRemesher_UpdateElements( context );
 		
 		/* Free some space, as it won't be needed until the next remesh. */
  		ExtensionManager_Free( mesh->nodeExtensionMgr, meshExt->newNodes );

Modified: long/3D/SNAC/trunk/Snac/plugins/remesherSPR/Remesh.h
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/remesherSPR/Remesh.h	2010-04-22 00:13:06 UTC (rev 16574)
+++ long/3D/SNAC/trunk/Snac/plugins/remesherSPR/Remesh.h	2010-04-22 15:03:41 UTC (rev 16575)
@@ -46,6 +46,7 @@
 	void _SnacRemesher_NewCoords( void* _context );
 
 	void _SnacRemesher_InterpolateNodes( void* _context );
+	void _SnacRemesher_RecoverNodes( void* context );
 	void _SnacRemesher_RecoverNode( void* context, unsigned nodeInd );
 	void _SnacRemesher_InterpolateNode( void* context,
 					    unsigned nodeInd, unsigned elementInd, unsigned tetInd, 

Modified: long/3D/SNAC/trunk/Snac/plugins/remesherSPR/RemeshElements.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/remesherSPR/RemeshElements.c	2010-04-22 00:13:06 UTC (rev 16574)
+++ long/3D/SNAC/trunk/Snac/plugins/remesherSPR/RemeshElements.c	2010-04-22 15:03:41 UTC (rev 16575)
@@ -85,7 +85,7 @@
 		   0.6 is a conservative choice (than 0.5) to reduce the artefact, but it is not guaranteed to work always. */
 		element->material_I = ((materialInd>0.6)?1:0);
 /* 		element->material_I = (Material_Index)(materialInd/10+0.5); */
-
+#if 0
 		KeyCall( context, context->updateElementK, Snac_UpdateElementMomentum_CallCast* )
 			( KeyHandle(context,context->updateElementK),
 			  context,
@@ -94,6 +94,7 @@
 		if( elementMinLengthScale < context->minLengthScale ) {
 			context->minLengthScale = elementMinLengthScale;
 		}
+#endif
 	}
 }
 
@@ -117,7 +118,7 @@
 	for(j=0;j<6;j++) {
 		strain[j] = 0.0;
 		stress[j] = 0.0;
-		for(i=0;i<4;i++) {
+		for(i=0;i<Tetrahedra_Point_Count;i++) {
 			Index dstNodeNum = Element_Node_I(context, dstEltInd, TetraToNode[dstTetInd][i]);
  			Snac_Node* dstNode = Snac_Node_At( context, dstNodeNum );
  			strain[j] += 0.25f * dstNode->strainSPR[j];
@@ -128,14 +129,14 @@
 		}
 	}
 	materialInd = 0.0;
-	for(i=0;i<4;i++) {
+	for(i=0;i<Tetrahedra_Point_Count;i++) {
 		Index dstNodeNum = Element_Node_I(context, dstEltInd, TetraToNode[dstTetInd][i]);
 		Snac_Node* dstNode = Snac_Node_At( context, dstNodeNum );
 		materialInd += 0.25f*(dstNode->material_ISPR);
 	}
 
 	density = 0.0;
-	for(i=0;i<4;i++) {
+	for(i=0;i<Tetrahedra_Point_Count;i++) {
 		Index dstNodeNum = Element_Node_I(context, dstEltInd, TetraToNode[dstTetInd][i]);
 		Snac_Node* dstNode = Snac_Node_At( context, dstNodeNum );
 		density += 0.25f*(dstNode->densitySPR);

Modified: long/3D/SNAC/trunk/Snac/plugins/remesherSPR/RemeshNodes.c
===================================================================
--- long/3D/SNAC/trunk/Snac/plugins/remesherSPR/RemeshNodes.c	2010-04-22 00:13:06 UTC (rev 16574)
+++ long/3D/SNAC/trunk/Snac/plugins/remesherSPR/RemeshNodes.c	2010-04-22 15:03:41 UTC (rev 16575)
@@ -51,6 +51,22 @@
 #include <gsl/gsl_linalg.h>
 
 
+void _SnacRemesher_RecoverNodes( void* _context ) {
+	Snac_Context*			context = (Snac_Context*)_context;
+	SnacRemesher_Context*	contextExt = ExtensionManager_Get( context->extensionMgr,
+															   context,
+															   SnacRemesher_ContextHandle );
+	Mesh*					mesh = context->mesh;
+	Node_LocalIndex			newNode_i;
+
+	/*
+	** Populate arrays for recovered fields using the SPR method.
+	*/
+	for( newNode_i = 0; newNode_i < mesh->nodeLocalCount; newNode_i++ )
+		SnacRemesher_RecoverNode( context, contextExt, newNode_i );
+}
+
+
 void _SnacRemesher_InterpolateNodes( void* _context ) {
 	Snac_Context*			context = (Snac_Context*)_context;
 	SnacRemesher_Context*	contextExt = ExtensionManager_Get( context->extensionMgr,
@@ -74,12 +90,6 @@
 	meshExt->nExternalNodes = 0;
 
 	/*
-	** Populate arrays for recovered fields using the SPR method.
-	*/
-	for( newNode_i = 0; newNode_i < mesh->nodeLocalCount; newNode_i++ )
-		SnacRemesher_RecoverNode( context, contextExt, newNode_i );
-
-	/*
 	** Scoot over all the new nodes and find the old element in which each one resides, then interpolate.
 	*/
 
@@ -147,6 +157,7 @@
 			memcpy( (unsigned char*)meshExt->newNodes + newNode_i * mesh->nodeExtensionMgr->finalSize,
 				(unsigned char*)mesh->node + newNode_i * mesh->nodeExtensionMgr->finalSize,
 				mesh->nodeExtensionMgr->finalSize );
+
 			/* assert(0); */
 		}
 
@@ -568,6 +579,6 @@
 
 	/* Free the element node array. */
 	FreeArray( elements );
-	
+
 	/* end of recovery. */
 }



More information about the CIG-COMMITS mailing list