[cig-commits] r6096 - in long/3D/Gale/trunk/src/StgFEM: . SLE/SystemSetup/src

walter at geodynamics.org walter at geodynamics.org
Fri Feb 23 10:03:58 PST 2007


Author: walter
Date: 2007-02-23 10:03:57 -0800 (Fri, 23 Feb 2007)
New Revision: 6096

Modified:
   long/3D/Gale/trunk/src/StgFEM/
   long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.c
   long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.h
Log:
 r982 at earth (orig r724):  LukeHodkinson | 2007-01-30 14:49:15 -0800
 Forcing complete destruction of PETSc's stiffness
 matrix in between solves. This is required to that
 the MatRelax routine doesn't use old data.
 



Property changes on: long/3D/Gale/trunk/src/StgFEM
___________________________________________________________________
Name: svk:merge
   - 38867592-cf10-0410-9e16-a142ea72ac34:/cig:880
db209038-57f2-0310-97fa-b160e0ae9d04:/branches/decomp3d:723
db209038-57f2-0310-97fa-b160e0ae9d04:/trunk:669
   + 38867592-cf10-0410-9e16-a142ea72ac34:/cig:880
db209038-57f2-0310-97fa-b160e0ae9d04:/branches/decomp3d:724
db209038-57f2-0310-97fa-b160e0ae9d04:/trunk:669

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.c	2007-02-23 18:03:54 UTC (rev 6095)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.c	2007-02-23 18:03:57 UTC (rev 6096)
@@ -471,19 +471,8 @@
 	
 /* 	assert( self->nonZeroCount ); */
 
-#ifdef HAVE_PETSC
-	self->matrix = (Matrix*)PETScMatrix_New( "" );
-#else
-#error *** No linear algebra package found.
-#endif
-	Matrix_SetComm( self->matrix, self->comm );
-	Matrix_SetLocalSize( self->matrix, self->rowLocalSize, self->colLocalSize );
+	StiffnessMatrix_CreateMatrix( self );
 
-#ifdef HAVE_PETSC
-	PETScMatrix_SetNonZeroStructure( self->matrix, self->nonZeroCount, 
-					 self->diagonalNonZeroIndices, self->offDiagonalNonZeroIndices );
-#endif
-
 	Journal_DPrintf( self->debug, "Matrix allocated.\n" );
 
 	Stream_UnIndentBranch( StgFEM_Debug );
@@ -751,29 +740,8 @@
 void StiffnessMatrix_Assemble( void* stiffnessMatrix, Bool bcRemoveQuery, void* data ) {
 	StiffnessMatrix* self = (StiffnessMatrix*)stiffnessMatrix;
 
-#if 0
-	/** DEBUG */
-	FreeObject( self->matrx );
-	if( self->diagonalNonZeroIndices == NULL ) {
-		/* Allocate the matrix */
-		self->matrix = Matrix_New( 
-			self->comm,
-			self->rowLocalSize,
-			self->colLocalSize,
-			self->nonZeroCount );
-	}
-	else {
-		/* Allocate the matrix */
-		self->matrix = Matrix_New2( 
-			self->comm,
-			self->rowLocalSize,
-			self->colLocalSize,
-			self->diagonalNonZeroIndices,
-			self->offDiagonalNonZeroIndices );
-	}
-	/** DEBUG */
-#endif
-	
+	StiffnessMatrix_CreateMatrix( self );
+
 	Journal_DPrintf( self->debug, "In %s - for matrix \"%s\" - calling the \"%s\" E.P.\n", __func__, self->name,
 		self->assembleStiffnessMatrix->name );
 	/* Call the Entry point directly from the base class */
@@ -1324,6 +1292,7 @@
 		Mesh_GetIncidence( colMesh, Mesh_GetDimSize( colMesh ), elementInd, MT_VERTEX, &nColElNodes, &colElNodes );
 		nRowDofs = rowDofs->dofCounts[0];
 		nColDofs = colDofs->dofCounts[0];
+
 		for( n_i = 0; n_i < nRowElNodes; n_i++ ) {
 			for( d_i = 0; d_i < nRowDofs; d_i++ ) {
 				dofI = rowEqNum->locationMatrix[elementInd][n_i][d_i];
@@ -1505,3 +1474,23 @@
 	Stg_CheckType( stiffnessMatrixTerm, StiffnessMatrixTerm );
 	Stg_ObjectList_Append( self->stiffnessMatrixTermList, stiffnessMatrixTerm );
 }
+
+
+void StiffnessMatrix_CreateMatrix( StiffnessMatrix* self ) {
+	assert( self && Stg_CheckType( self, StiffnessMatrix ) );
+
+	FreeObject( self->matrix );
+
+#ifdef HAVE_PETSC
+	self->matrix = (Matrix*)PETScMatrix_New( "" );
+#else
+#error *** No linear algebra package found.
+#endif
+	Matrix_SetComm( self->matrix, self->comm );
+	Matrix_SetLocalSize( self->matrix, self->rowLocalSize, self->colLocalSize );
+
+#ifdef HAVE_PETSC
+	PETScMatrix_SetNonZeroStructure( self->matrix, self->nonZeroCount, 
+					 self->diagonalNonZeroIndices, self->offDiagonalNonZeroIndices );
+#endif
+}

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.h
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.h	2007-02-23 18:03:54 UTC (rev 6095)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/SystemSetup/src/StiffnessMatrix.h	2007-02-23 18:03:57 UTC (rev 6096)
@@ -264,5 +264,7 @@
 		Index elStiffMatToAddColSize );
 	
 	void StiffnessMatrix_AddStiffnessMatrixTerm( void* stiffnessMatrixVector, StiffnessMatrixTerm* stiffnessMatrixTerm ) ;
+
+	void StiffnessMatrix_CreateMatrix( StiffnessMatrix* self );
 	
 #endif /* __StgFEM_SLE_SystemSetup_StiffnessMatrix_h__ */



More information about the cig-commits mailing list