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

walter at geodynamics.org walter at geodynamics.org
Wed Feb 28 10:21:23 PST 2007


Author: walter
Date: 2007-02-28 10:21:22 -0800 (Wed, 28 Feb 2007)
New Revision: 6130

Modified:
   long/3D/Gale/trunk/src/StgFEM/
   long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/PETScMatrix.c
   long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/PETScMatrix.h
   long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/SROpGenerator.c
Log:
 r1018 at earth (orig r755):  LukeHodkinson | 2007-02-27 18:44:24 -0800
 Making 'SetNonZeroStructure' a virtual function.
 



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:754
db209038-57f2-0310-97fa-b160e0ae9d04:/trunk:669
   + 38867592-cf10-0410-9e16-a142ea72ac34:/cig:880
db209038-57f2-0310-97fa-b160e0ae9d04:/branches/decomp3d:755
db209038-57f2-0310-97fa-b160e0ae9d04:/trunk:669

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/PETScMatrix.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/PETScMatrix.c	2007-02-28 18:21:19 UTC (rev 6129)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/PETScMatrix.c	2007-02-28 18:21:22 UTC (rev 6130)
@@ -89,7 +89,8 @@
 				 PETScMatrix_RestoreRow, 
 				 PETScMatrix_GetDiagonal, 
 				 PETScMatrix_Duplicate, 
-				 PETScMatrix_CopyEntries );
+				 PETScMatrix_CopyEntries, 
+				 _PETScMatrix_SetNonZeroStructure );
 }
 
 PETScMatrix* _PETScMatrix_New( PETSCMATRIX_DEFARGS ) {
@@ -100,6 +101,7 @@
 	self = (PETScMatrix*)_Matrix_New( MATRIX_PASSARGS );
 
 	/* Virtual info */
+	self->setNonZeroStructure = setNonZeroStructure;
 
 	/* PETScMatrix info */
 	_PETScMatrix_Init( self );
@@ -108,12 +110,9 @@
 }
 
 void _PETScMatrix_Init( PETScMatrix* self ) {
-	PetscErrorCode	ec;
-
 	assert( self && Stg_CheckType( self, PETScMatrix ) );
 
-	ec = MatCreate( self->comm, &self->petscMat );
-	CheckPETScError( ec );
+	self->petscMat = PETSC_NULL;
 }
 
 
@@ -679,13 +678,8 @@
 	dstMatrix->hasChanged = True;
 }
 
-
-/*--------------------------------------------------------------------------------------------------------------------------
-** Public Functions
-*/
-
-void PETScMatrix_SetNonZeroStructure( void* matrix, unsigned nNonZeros, 
-				      unsigned* diagonalNonZeroIndices, unsigned* offDiagonalNonZeroIndices )
+void _PETScMatrix_SetNonZeroStructure( void* matrix, unsigned nNonZeros, 
+				       unsigned* diagonalNonZeroIndices, unsigned* offDiagonalNonZeroIndices )
 {
 	PETScMatrix*	self = (PETScMatrix*)matrix;
 	PetscErrorCode	ec;
@@ -714,6 +708,11 @@
 	self->hasChanged = True;
 }
 
+
+/*--------------------------------------------------------------------------------------------------------------------------
+** Public Functions
+*/
+
 void PETScMatrix_Draw( void* matrix ) {
 	PETScMatrix*	self = (PETScMatrix*)matrix;
 	PetscErrorCode	ec;

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/PETScMatrix.h
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/PETScMatrix.h	2007-02-28 18:21:19 UTC (rev 6129)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/PETScMatrix.h	2007-02-28 18:21:22 UTC (rev 6130)
@@ -45,15 +45,18 @@
 	extern const Type PETScMatrix_Type;
 
 	/** Virtual function types */
+	typedef void (PETScMatrix_SetNonZeroStructure)( void* matrix, unsigned nNonZeros, 
+							unsigned* diagonalNonZeroIndices, unsigned* offDiagonalNonZeroIndices);
 
 	/** PETScMatrix class contents */
-	#define __PETScMatrix				\
-		/* General info */			\
-		__Matrix				\
-							\
-		/* Virtual info */			\
-							\
-		/* PETScMatrix info */			\
+	#define __PETScMatrix							\
+		/* General info */						\
+		__Matrix							\
+										\
+		/* Virtual info */						\
+		PETScMatrix_SetNonZeroStructure*	setNonZeroStructure;	\
+										\
+		/* PETScMatrix info */						\
 		Mat		petscMat;
 
 	struct PETScMatrix { __PETScMatrix };
@@ -62,11 +65,13 @@
 	** Constructors
 	*/
 
-	#define PETSCMATRIX_DEFARGS \
-		MATRIX_DEFARGS
+	#define PETSCMATRIX_DEFARGS						\
+		MATRIX_DEFARGS, 						\
+		PETScMatrix_SetNonZeroStructure*	setNonZeroStructure
 
-	#define PETSCMATRIX_PASSARGS \
-		MATRIX_PASSARGS
+	#define PETSCMATRIX_PASSARGS	\
+		MATRIX_PASSARGS, 	\
+		setNonZeroStructure
 
 	PETScMatrix* PETScMatrix_New( Name name );
 	PETScMatrix* _PETScMatrix_New( PETSCMATRIX_DEFARGS );
@@ -122,12 +127,16 @@
 	void PETScMatrix_Duplicate( void* matrix, void** dstMatrix );
 	void PETScMatrix_CopyEntries( void* matrix, void* dstMatrix );
 
+	void _PETScMatrix_SetNonZeroStructure( void* matrix, unsigned nNonZeros, 
+					       unsigned* diagonalNonZeroIndices, unsigned* offDiagonalNonZeroIndices);
+
+	#define PETScMatrix_SetNonZeroStructure( self, nNonZeros, diagonalNonZeroIndices, offDiagonalNonZeroIndices)		\
+		VirtualCall( self, setNonZeroStructure, self, nNonZeros, diagonalNonZeroIndices, offDiagonalNonZeroIndices)
+
 	/*--------------------------------------------------------------------------------------------------------------------------
 	** Public functions
 	*/
 
-	void PETScMatrix_SetNonZeroStructure( void* matrix, unsigned nNonZeros, 
-					      unsigned* diagonalNonZeroIndices, unsigned* offDiagonalNonZeroIndices);
 	void PETScMatrix_Draw( void* matrix );
 
 	/*--------------------------------------------------------------------------------------------------------------------------

Modified: long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/SROpGenerator.c
===================================================================
--- long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/SROpGenerator.c	2007-02-28 18:21:19 UTC (rev 6129)
+++ long/3D/Gale/trunk/src/StgFEM/SLE/LinearAlgebra/src/SROpGenerator.c	2007-02-28 18:21:22 UTC (rev 6130)
@@ -433,7 +433,7 @@
 			unsigned	*nDiagNonZeros, *nOffDiagNonZeros;
 
 			SROpGenerator_CalcOpNonZeros( self, l_i, &nDiagNonZeros, &nOffDiagNonZeros );
-			PETScMatrix_SetNonZeroStructure( P, 0, nDiagNonZeros, nOffDiagNonZeros );
+			PETScMatrix_SetNonZeroStructure( (PETScMatrix*)P, 0, nDiagNonZeros, nOffDiagNonZeros );
 			FreeArray( nDiagNonZeros );
 			FreeArray( nOffDiagNonZeros );
 		}



More information about the cig-commits mailing list