File: | mat/impls/sbaij/mpi/mpisbaij.c |
Warning: | line 24, column 14 Division by zero |
[?] Use j/k keys for keyboard navigation
1 | ||||
2 | #include <../src/mat/impls/baij/mpi/mpibaij.h> /*I "petscmat.h" I*/ | |||
3 | #include <../src/mat/impls/sbaij/mpi/mpisbaij.h> | |||
4 | #include <../src/mat/impls/sbaij/seq/sbaij.h> | |||
5 | #include <petscblaslapack.h> | |||
6 | ||||
7 | #if defined(PETSC_HAVE_ELEMENTAL) | |||
8 | PETSC_INTERNextern __attribute__((visibility ("hidden"))) PetscErrorCode MatConvert_MPISBAIJ_Elemental(Mat,MatType,MatReuse,Mat*); | |||
9 | #endif | |||
10 | ||||
11 | /* This could be moved to matimpl.h */ | |||
12 | static PetscErrorCode MatPreallocateWithMats_Private(Mat B, PetscInt nm, Mat X[], PetscBool symm[], PetscBool fill) | |||
13 | { | |||
14 | Mat preallocator; | |||
15 | PetscInt r,rstart,rend; | |||
16 | PetscInt bs,i,m,n,M,N; | |||
17 | PetscBool cong = PETSC_TRUE; | |||
18 | PetscErrorCode ierr; | |||
19 | ||||
20 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 20; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
21 | PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),21,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),21,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if ( ((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm )0x44000001),21,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),21,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
22 | PetscValidLogicalCollectiveInt(B,nm,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -nm ; b1[1] = nm; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm ((PetscObject)B),2,22,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),22,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)B),22,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d" ,2); } while (0); | |||
23 | for (i = 0; i < nm; i++) { | |||
24 | PetscValidHeaderSpecific(X[i],MAT_CLASSID,3)do { if (!X[i]) return PetscError(((MPI_Comm)0x44000001),24,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",3); if ( !PetscCheckPointer(X[i],PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),24,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,3); if (((PetscObject)(X[i]))->classid != MAT_CLASSID) { if (((PetscObject)(X[i]))->classid == -1) return PetscError( ((MPI_Comm)0x44000001),24,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,3); else return PetscError(((MPI_Comm)0x44000001),24,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,3); } } while (0); | |||
25 | ierr = PetscLayoutCompare(B->rmap,X[i]->rmap,&cong);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),25,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
26 | if (!cong) SETERRQ(PetscObjectComm((PetscObject)B),PETSC_ERR_SUP,"Not for different layouts")return PetscError(PetscObjectComm((PetscObject)B),26,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Not for different layouts"); | |||
27 | } | |||
28 | PetscValidLogicalCollectiveBool(B,fill,5)do { PetscErrorCode _7_ierr; PetscMPIInt b1[2],b2[2]; b1[0] = -(PetscMPIInt)fill; b1[1] = (PetscMPIInt)fill; _7_ierr = (PetscAllreduceBarrierCheck (PetscObjectComm((PetscObject)B),2,28,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),28,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)B),28,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Bool value must be same on all processes, argument # %d" ,5); } while (0); | |||
29 | ierr = MatGetBlockSize(B,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),29,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
30 | ierr = MatGetSize(B,&M,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),30,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
31 | ierr = MatGetLocalSize(B,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),31,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
32 | ierr = MatCreate(PetscObjectComm((PetscObject)B),&preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),32,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
33 | ierr = MatSetType(preallocator,MATPREALLOCATOR"preallocator");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),33,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
34 | ierr = MatSetBlockSize(preallocator,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),34,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
35 | ierr = MatSetSizes(preallocator,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),35,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
36 | ierr = MatSetUp(preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),36,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
37 | ierr = MatGetOwnershipRange(preallocator,&rstart,&rend);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),37,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
38 | for (r = rstart; r < rend; ++r) { | |||
39 | PetscInt ncols; | |||
40 | const PetscInt *row; | |||
41 | const PetscScalar *vals; | |||
42 | ||||
43 | for (i = 0; i < nm; i++) { | |||
44 | ierr = MatGetRow(X[i],r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),44,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
45 | ierr = MatSetValues(preallocator,1,&r,ncols,row,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),45,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
46 | if (symm && symm[i]) { | |||
47 | ierr = MatSetValues(preallocator,ncols,row,1,&r,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),47,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
48 | } | |||
49 | ierr = MatRestoreRow(X[i],r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),49,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
50 | } | |||
51 | } | |||
52 | ierr = MatAssemblyBegin(preallocator,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),52,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
53 | ierr = MatAssemblyEnd(preallocator,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),53,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
54 | ierr = MatPreallocatorPreallocate(preallocator,fill,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),54,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
55 | ierr = MatDestroy(&preallocator);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),55,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
56 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
57 | } | |||
58 | ||||
59 | static PetscErrorCode MatConvert_MPISBAIJ_XAIJ(Mat A, MatType newtype, MatReuse reuse, Mat *newmat) | |||
60 | { | |||
61 | Mat B; | |||
62 | PetscErrorCode ierr; | |||
63 | PetscInt r; | |||
64 | ||||
65 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 65; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
66 | if (reuse != MAT_REUSE_MATRIX) { | |||
67 | PetscBool symm = PETSC_TRUE; | |||
68 | PetscInt bs; | |||
69 | ||||
70 | ierr = MatCreate(PetscObjectComm((PetscObject)A),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),70,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
71 | ierr = MatSetSizes(B,A->rmap->n,A->cmap->n,A->rmap->N,A->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),71,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
72 | ierr = MatSetType(B,newtype);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),72,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
73 | ierr = MatGetBlockSize(A,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),73,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
74 | ierr = MatSetBlockSize(B,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),74,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
75 | ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
76 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),76,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
77 | ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),77,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
78 | ierr = MatPreallocateWithMats_Private(B,1,&A,&symm,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),78,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
79 | ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),79,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
80 | } else B = *newmat; | |||
81 | ||||
82 | ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),82,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
83 | for (r = A->rmap->rstart; r < A->rmap->rend; r++) { | |||
84 | PetscInt ncols; | |||
85 | const PetscInt *row; | |||
86 | const PetscScalar *vals; | |||
87 | ||||
88 | ierr = MatGetRow(A,r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),88,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
89 | ierr = MatSetValues(B,1,&r,ncols,row,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),89,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
90 | ierr = MatSetValues(B,ncols,row,1,&r,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),90,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
91 | ierr = MatRestoreRow(A,r,&ncols,&row,&vals);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),91,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
92 | } | |||
93 | ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),93,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
94 | ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),94,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
95 | ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),95,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
96 | ||||
97 | if (reuse == MAT_INPLACE_MATRIX) { | |||
98 | ierr = MatHeaderReplace(A,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),98,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
99 | } else { | |||
100 | *newmat = B; | |||
101 | } | |||
102 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
103 | } | |||
104 | ||||
105 | PetscErrorCode MatStoreValues_MPISBAIJ(Mat mat) | |||
106 | { | |||
107 | Mat_MPISBAIJ *aij = (Mat_MPISBAIJ*)mat->data; | |||
108 | PetscErrorCode ierr; | |||
109 | ||||
110 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 110; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
111 | ierr = MatStoreValues(aij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),111,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
112 | ierr = MatStoreValues(aij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),112,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
113 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
114 | } | |||
115 | ||||
116 | PetscErrorCode MatRetrieveValues_MPISBAIJ(Mat mat) | |||
117 | { | |||
118 | Mat_MPISBAIJ *aij = (Mat_MPISBAIJ*)mat->data; | |||
119 | PetscErrorCode ierr; | |||
120 | ||||
121 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 121; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
122 | ierr = MatRetrieveValues(aij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),122,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
123 | ierr = MatRetrieveValues(aij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),123,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
124 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
125 | } | |||
126 | ||||
127 | #define MatSetValues_SeqSBAIJ_A_Private(row,col,value,addv,orow,ocol){ brow = row/bs; rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; rmax = aimax[brow]; nrow = ailen[brow]; bcol = col/bs; ridx = row % bs; cidx = col % bs; low = 0; high = nrow; while (high-low > 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol ) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx ; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto a_noinsert; } } if (a->nonew == 1) goto a_noinsert; if (a ->nonew == -1) return PetscError(((MPI_Comm)0x44000001),127 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix" ,orow,ocol); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ *)A->data; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (a-> nonew == -2) return PetscError(((MPI_Comm)0x44000001),127,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow +1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = PetscMemcpy( new_j,aj,(ai[brow]+nrow)*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[brow] - nrow); ierr = PetscMemcpy(new_j+ai[brow]+nrow+CHUNKSIZE ,aj+ai[brow]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a,aa,bs2*(ai[brow]+nrow)*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(ai[brow]+nrow),bs2*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a+bs2*(ai[brow]+nrow+CHUNKSIZE),aa+bs2*(ai[brow]+nrow),bs2 *len*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain-> a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow ]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] + CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++ ; }; N = nrow++ - 1; for (ii=N; ii>=_i; ii--) { rp[ii+1] = rp[ii]; ierr = PetscMemcpy(ap+bs2*(ii+1),ap+bs2*(ii),bs2*sizeof (MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError (((MPI_Comm)0x44000001),127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } if (N>=_i) { ierr = PetscMemzero(ap+bs2*_i,bs2*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),127,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } rp[_i] = bcol; ap [bs2*_i + bs*cidx + ridx] = value; A->nonzerostate++;a_noinsert :; ailen[brow] = nrow; } \ | |||
128 | { \ | |||
129 | \ | |||
130 | brow = row/bs; \ | |||
131 | rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; \ | |||
132 | rmax = aimax[brow]; nrow = ailen[brow]; \ | |||
133 | bcol = col/bs; \ | |||
134 | ridx = row % bs; cidx = col % bs; \ | |||
135 | low = 0; high = nrow; \ | |||
136 | while (high-low > 3) { \ | |||
137 | t = (low+high)/2; \ | |||
138 | if (rp[t] > bcol) high = t; \ | |||
139 | else low = t; \ | |||
140 | } \ | |||
141 | for (_i=low; _i<high; _i++) { \ | |||
142 | if (rp[_i] > bcol) break; \ | |||
143 | if (rp[_i] == bcol) { \ | |||
144 | bap = ap + bs2*_i + bs*cidx + ridx; \ | |||
145 | if (addv == ADD_VALUES) *bap += value; \ | |||
146 | else *bap = value; \ | |||
147 | goto a_noinsert; \ | |||
148 | } \ | |||
149 | } \ | |||
150 | if (a->nonew == 1) goto a_noinsert; \ | |||
151 | if (a->nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero at global row/column (%D, %D) into matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix" ,orow,ocol); \ | |||
152 | MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,brow,bcol,rmax,aa,ai,aj,rp,ap,aimax,a->nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE, len,*new_i=0,*new_j=0; MatScalar *new_a; if (a->nonew == - 2) return PetscError(((MPI_Comm)0x44000001),152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),152,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow +1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = PetscMemcpy( new_j,aj,(ai[brow]+nrow)*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),152,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[brow] - nrow); ierr = PetscMemcpy(new_j+ai[brow]+nrow+CHUNKSIZE ,aj+ai[brow]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),152,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a,aa,bs2*(ai[brow]+nrow)*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),152,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(ai[brow]+nrow),bs2*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a+bs2*(ai[brow]+nrow+CHUNKSIZE),aa+bs2*(ai[brow]+nrow),bs2 *len*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),152,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain-> a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow ]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] + CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++ ; }; \ | |||
153 | N = nrow++ - 1; \ | |||
154 | /* shift up all the later entries in this row */ \ | |||
155 | for (ii=N; ii>=_i; ii--) { \ | |||
156 | rp[ii+1] = rp[ii]; \ | |||
157 | ierr = PetscMemcpy(ap+bs2*(ii+1),ap+bs2*(ii),bs2*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),157,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); \ | |||
158 | } \ | |||
159 | if (N>=_i) { ierr = PetscMemzero(ap+bs2*_i,bs2*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } \ | |||
160 | rp[_i] = bcol; \ | |||
161 | ap[bs2*_i + bs*cidx + ridx] = value; \ | |||
162 | A->nonzerostate++;\ | |||
163 | a_noinsert:; \ | |||
164 | ailen[brow] = nrow; \ | |||
165 | } | |||
166 | ||||
167 | #define MatSetValues_SeqSBAIJ_B_Private(row,col,value,addv,orow,ocol){ brow = row/bs; rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; rmax = bimax[brow]; nrow = bilen[brow]; bcol = col/bs; ridx = row % bs; cidx = col % bs; low = 0; high = nrow; while (high-low > 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol ) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx ; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto b_noinsert; } } if (b->nonew == 1) goto b_noinsert; if (b ->nonew == -1) return PetscError(((MPI_Comm)0x44000001),167 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix" ,orow,ocol); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ *)B->data; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] + CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (b-> nonew == -2) return PetscError(((MPI_Comm)0x44000001),167,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,167,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),167,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow +1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs +1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = PetscMemcpy( new_j,bj,(bi[brow]+nrow)*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),167,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - bi[brow] - nrow); ierr = PetscMemcpy(new_j+bi[brow]+nrow+CHUNKSIZE ,bj+bi[brow]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),167,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a,ba,bs2*(bi[brow]+nrow)*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),167,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(bi[brow]+nrow),bs2*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),167,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a+bs2*(bi[brow]+nrow+CHUNKSIZE),ba+bs2*(bi[brow]+nrow),bs2 *len*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),167,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),167,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain-> a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow ]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] + CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++ ; }; N = nrow++ - 1; for (ii=N; ii>=_i; ii--) { rp[ii+1] = rp[ii]; ierr = PetscMemcpy(ap+bs2*(ii+1),ap+bs2*(ii),bs2*sizeof (MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError (((MPI_Comm)0x44000001),167,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } if (N>=_i) { ierr = PetscMemzero(ap+bs2*_i,bs2*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),167,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} rp[_i] = bcol; ap [bs2*_i + bs*cidx + ridx] = value; B->nonzerostate++;b_noinsert :; bilen[brow] = nrow; } \ | |||
168 | { \ | |||
169 | brow = row/bs; \ | |||
170 | rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; \ | |||
171 | rmax = bimax[brow]; nrow = bilen[brow]; \ | |||
172 | bcol = col/bs; \ | |||
173 | ridx = row % bs; cidx = col % bs; \ | |||
174 | low = 0; high = nrow; \ | |||
175 | while (high-low > 3) { \ | |||
176 | t = (low+high)/2; \ | |||
177 | if (rp[t] > bcol) high = t; \ | |||
178 | else low = t; \ | |||
179 | } \ | |||
180 | for (_i=low; _i<high; _i++) { \ | |||
181 | if (rp[_i] > bcol) break; \ | |||
182 | if (rp[_i] == bcol) { \ | |||
183 | bap = ap + bs2*_i + bs*cidx + ridx; \ | |||
184 | if (addv == ADD_VALUES) *bap += value; \ | |||
185 | else *bap = value; \ | |||
186 | goto b_noinsert; \ | |||
187 | } \ | |||
188 | } \ | |||
189 | if (b->nonew == 1) goto b_noinsert; \ | |||
190 | if (b->nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new nonzero at global row/column (%D, %D) into matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),190,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix" ,orow,ocol); \ | |||
191 | MatSeqXAIJReallocateAIJ(B,b->mbs,bs2,nrow,brow,bcol,rmax,ba,bi,bj,rp,ap,bimax,b->nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)B->data ; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] + CHUNKSIZE, len,*new_i=0,*new_j=0; MatScalar *new_a; if (b->nonew == - 2) return PetscError(((MPI_Comm)0x44000001),191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),191,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow +1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs +1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = PetscMemcpy( new_j,bj,(bi[brow]+nrow)*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),191,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - bi[brow] - nrow); ierr = PetscMemcpy(new_j+bi[brow]+nrow+CHUNKSIZE ,bj+bi[brow]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),191,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a,ba,bs2*(bi[brow]+nrow)*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),191,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(bi[brow]+nrow),bs2*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a+bs2*(bi[brow]+nrow+CHUNKSIZE),ba+bs2*(bi[brow]+nrow),bs2 *len*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),191,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain-> a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow ]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] + CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++ ; }; \ | |||
192 | N = nrow++ - 1; \ | |||
193 | /* shift up all the later entries in this row */ \ | |||
194 | for (ii=N; ii>=_i; ii--) { \ | |||
195 | rp[ii+1] = rp[ii]; \ | |||
196 | ierr = PetscMemcpy(ap+bs2*(ii+1),ap+bs2*(ii),bs2*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); \ | |||
197 | } \ | |||
198 | if (N>=_i) { ierr = PetscMemzero(ap+bs2*_i,bs2*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} \ | |||
199 | rp[_i] = bcol; \ | |||
200 | ap[bs2*_i + bs*cidx + ridx] = value; \ | |||
201 | B->nonzerostate++;\ | |||
202 | b_noinsert:; \ | |||
203 | bilen[brow] = nrow; \ | |||
204 | } | |||
205 | ||||
206 | /* Only add/insert a(i,j) with i<=j (blocks). | |||
207 | Any a(i,j) with i>j input by user is ingored. | |||
208 | */ | |||
209 | PetscErrorCode MatSetValues_MPISBAIJ(Mat mat,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const PetscScalar v[],InsertMode addv) | |||
210 | { | |||
211 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
212 | MatScalar value; | |||
213 | PetscBool roworiented = baij->roworiented; | |||
214 | PetscErrorCode ierr; | |||
215 | PetscInt i,j,row,col; | |||
216 | PetscInt rstart_orig=mat->rmap->rstart; | |||
217 | PetscInt rend_orig =mat->rmap->rend,cstart_orig=mat->cmap->rstart; | |||
218 | PetscInt cend_orig =mat->cmap->rend,bs=mat->rmap->bs; | |||
219 | ||||
220 | /* Some Variables required in the macro */ | |||
221 | Mat A = baij->A; | |||
222 | Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)(A)->data; | |||
223 | PetscInt *aimax=a->imax,*ai=a->i,*ailen=a->ilen,*aj=a->j; | |||
224 | MatScalar *aa =a->a; | |||
225 | ||||
226 | Mat B = baij->B; | |||
227 | Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)(B)->data; | |||
228 | PetscInt *bimax=b->imax,*bi=b->i,*bilen=b->ilen,*bj=b->j; | |||
229 | MatScalar *ba =b->a; | |||
230 | ||||
231 | PetscInt *rp,ii,nrow,_i,rmax,N,brow,bcol; | |||
232 | PetscInt low,high,t,ridx,cidx,bs2=a->bs2; | |||
233 | MatScalar *ap,*bap; | |||
234 | ||||
235 | /* for stash */ | |||
236 | PetscInt n_loc, *in_loc = NULL((void*)0); | |||
237 | MatScalar *v_loc = NULL((void*)0); | |||
238 | ||||
239 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 239; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
240 | if (!baij->donotstash) { | |||
241 | if (n > baij->n_loc) { | |||
242 | ierr = PetscFree(baij->in_loc)((*PetscTrFree)((void*)(baij->in_loc),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->in_loc) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
243 | ierr = PetscFree(baij->v_loc)((*PetscTrFree)((void*)(baij->v_loc),243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->v_loc) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),243,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
244 | ierr = PetscMalloc1(n,&baij->in_loc)PetscMallocA(1,PETSC_FALSE,244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(n)*sizeof(**(&baij->in_loc)),(&baij-> in_loc));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),244,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
245 | ierr = PetscMalloc1(n,&baij->v_loc)PetscMallocA(1,PETSC_FALSE,245,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(n)*sizeof(**(&baij->v_loc)),(&baij->v_loc ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),245,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
246 | ||||
247 | baij->n_loc = n; | |||
248 | } | |||
249 | in_loc = baij->in_loc; | |||
250 | v_loc = baij->v_loc; | |||
251 | } | |||
252 | ||||
253 | for (i=0; i<m; i++) { | |||
254 | if (im[i] < 0) continue; | |||
255 | #if defined(PETSC_USE_DEBUG1) | |||
256 | if (im[i] >= mat->rmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",im[i],mat->rmap->N-1)return PetscError(((MPI_Comm)0x44000001),256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Row too large: row %D max %D",im[i], mat->rmap->N-1); | |||
257 | #endif | |||
258 | if (im[i] >= rstart_orig && im[i] < rend_orig) { /* this processor entry */ | |||
259 | row = im[i] - rstart_orig; /* local row index */ | |||
260 | for (j=0; j<n; j++) { | |||
261 | if (im[i]/bs > in[j]/bs) { | |||
262 | if (a->ignore_ltriangular) { | |||
263 | continue; /* ignore lower triangular blocks */ | |||
264 | } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)" ); | |||
265 | } | |||
266 | if (in[j] >= cstart_orig && in[j] < cend_orig) { /* diag entry (A) */ | |||
267 | col = in[j] - cstart_orig; /* local col index */ | |||
268 | brow = row/bs; bcol = col/bs; | |||
269 | if (brow > bcol) continue; /* ignore lower triangular blocks of A */ | |||
270 | if (roworiented) value = v[i*n+j]; | |||
271 | else value = v[i+j*m]; | |||
272 | MatSetValues_SeqSBAIJ_A_Private(row,col,value,addv,im[i],in[j]){ brow = row/bs; rp = aj + ai[brow]; ap = aa + bs2*ai[brow]; rmax = aimax[brow]; nrow = ailen[brow]; bcol = col/bs; ridx = row % bs; cidx = col % bs; low = 0; high = nrow; while (high-low > 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol ) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx ; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto a_noinsert; } } if (a->nonew == 1) goto a_noinsert; if (a ->nonew == -1) return PetscError(((MPI_Comm)0x44000001),272 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix" ,im[i],in[j]); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ *)A->data; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (a-> nonew == -2) return PetscError(((MPI_Comm)0x44000001),272,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),272,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow +1; ii++) {new_i[ii] = ai[ii];} for (ii=brow+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = PetscMemcpy( new_j,aj,(ai[brow]+nrow)*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),272,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[brow] - nrow); ierr = PetscMemcpy(new_j+ai[brow]+nrow+CHUNKSIZE ,aj+ai[brow]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),272,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a,aa,bs2*(ai[brow]+nrow)*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),272,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(ai[brow]+nrow),bs2*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a+bs2*(ai[brow]+nrow+CHUNKSIZE),aa+bs2*(ai[brow]+nrow),bs2 *len*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),272,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain-> a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[brow ]; ap = aa + bs2*ai[brow]; rmax = aimax[brow] = aimax[brow] + CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++ ; }; N = nrow++ - 1; for (ii=N; ii>=_i; ii--) { rp[ii+1] = rp[ii]; ierr = PetscMemcpy(ap+bs2*(ii+1),ap+bs2*(ii),bs2*sizeof (MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError (((MPI_Comm)0x44000001),272,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } if (N>=_i) { ierr = PetscMemzero(ap+bs2*_i,bs2*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),272,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } rp[_i] = bcol; ap [bs2*_i + bs*cidx + ridx] = value; A->nonzerostate++;a_noinsert :; ailen[brow] = nrow; }; | |||
273 | /* ierr = MatSetValues_SeqBAIJ(baij->A,1,&row,1,&col,&value,addv);CHKERRQ(ierr); */ | |||
274 | } else if (in[j] < 0) continue; | |||
275 | #if defined(PETSC_USE_DEBUG1) | |||
276 | else if (in[j] >= mat->cmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",in[j],mat->cmap->N-1)return PetscError(((MPI_Comm)0x44000001),276,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Column too large: col %D max %D",in[ j],mat->cmap->N-1); | |||
277 | #endif | |||
278 | else { /* off-diag entry (B) */ | |||
279 | if (mat->was_assembled) { | |||
280 | if (!baij->colmap) { | |||
281 | ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),281,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
282 | } | |||
283 | #if defined(PETSC_USE_CTABLE1) | |||
284 | ierr = PetscTableFind(baij->colmap,in[j]/bs + 1,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),284,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
285 | col = col - 1; | |||
286 | #else | |||
287 | col = baij->colmap[in[j]/bs] - 1; | |||
288 | #endif | |||
289 | if (col < 0 && !((Mat_SeqSBAIJ*)(baij->A->data))->nonew) { | |||
290 | ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),290,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
291 | col = in[j]; | |||
292 | /* Reinitialize the variables required by MatSetValues_SeqBAIJ_B_Private() */ | |||
293 | B = baij->B; | |||
294 | b = (Mat_SeqBAIJ*)(B)->data; | |||
295 | bimax= b->imax;bi=b->i;bilen=b->ilen;bj=b->j; | |||
296 | ba = b->a; | |||
297 | } else col += in[j]%bs; | |||
298 | } else col = in[j]; | |||
299 | if (roworiented) value = v[i*n+j]; | |||
300 | else value = v[i+j*m]; | |||
301 | MatSetValues_SeqSBAIJ_B_Private(row,col,value,addv,im[i],in[j]){ brow = row/bs; rp = bj + bi[brow]; ap = ba + bs2*bi[brow]; rmax = bimax[brow]; nrow = bilen[brow]; bcol = col/bs; ridx = row % bs; cidx = col % bs; low = 0; high = nrow; while (high-low > 3) { t = (low+high)/2; if (rp[t] > bcol) high = t; else low = t; } for (_i=low; _i<high; _i++) { if (rp[_i] > bcol ) break; if (rp[_i] == bcol) { bap = ap + bs2*_i + bs*cidx + ridx ; if (addv == ADD_VALUES) *bap += value; else *bap = value; goto b_noinsert; } } if (b->nonew == 1) goto b_noinsert; if (b ->nonew == -1) return PetscError(((MPI_Comm)0x44000001),301 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new nonzero at global row/column (%D, %D) into matrix" ,im[i],in[j]); if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ *)B->data; PetscInt CHUNKSIZE = 15,new_nz = bi[b->mbs] + CHUNKSIZE,len,*new_i=0,*new_j=0; MatScalar *new_a; if (b-> nonew == -2) return PetscError(((MPI_Comm)0x44000001),301,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,brow,bcol); ierr = PetscMallocA(3,PETSC_FALSE,301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(b-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),301,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<brow +1; ii++) {new_i[ii] = bi[ii];} for (ii=brow+1; ii<b->mbs +1; ii++) {new_i[ii] = bi[ii]+CHUNKSIZE;} ierr = PetscMemcpy( new_j,bj,(bi[brow]+nrow)*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),301,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - bi[brow] - nrow); ierr = PetscMemcpy(new_j+bi[brow]+nrow+CHUNKSIZE ,bj+bi[brow]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),301,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a,ba,bs2*(bi[brow]+nrow)*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),301,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(bi[brow]+nrow),bs2*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a+bs2*(bi[brow]+nrow+CHUNKSIZE),ba+bs2*(bi[brow]+nrow),bs2 *len*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),301,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ba = new_a; Ain-> a = (MatScalar*) new_a; bi = Ain->i = new_i; bj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = bj + bi[brow ]; ap = ba + bs2*bi[brow]; rmax = bimax[brow] = bimax[brow] + CHUNKSIZE; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++ ; }; N = nrow++ - 1; for (ii=N; ii>=_i; ii--) { rp[ii+1] = rp[ii]; ierr = PetscMemcpy(ap+bs2*(ii+1),ap+bs2*(ii),bs2*sizeof (MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError (((MPI_Comm)0x44000001),301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } if (N>=_i) { ierr = PetscMemzero(ap+bs2*_i,bs2*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),301,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0);} rp[_i] = bcol; ap [bs2*_i + bs*cidx + ridx] = value; B->nonzerostate++;b_noinsert :; bilen[brow] = nrow; }; | |||
302 | /* ierr = MatSetValues_SeqBAIJ(baij->B,1,&row,1,&col,&value,addv);CHKERRQ(ierr); */ | |||
303 | } | |||
304 | } | |||
305 | } else { /* off processor entry */ | |||
306 | if (mat->nooffprocentries) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Setting off process row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set",im[i])return PetscError(((MPI_Comm)0x44000001),306,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Setting off process row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set" ,im[i]); | |||
307 | if (!baij->donotstash) { | |||
308 | mat->assembled = PETSC_FALSE; | |||
309 | n_loc = 0; | |||
310 | for (j=0; j<n; j++) { | |||
311 | if (im[i]/bs > in[j]/bs) continue; /* ignore lower triangular blocks */ | |||
312 | in_loc[n_loc] = in[j]; | |||
313 | if (roworiented) { | |||
314 | v_loc[n_loc] = v[i*n+j]; | |||
315 | } else { | |||
316 | v_loc[n_loc] = v[j*m+i]; | |||
317 | } | |||
318 | n_loc++; | |||
319 | } | |||
320 | ierr = MatStashValuesRow_Private(&mat->stash,im[i],n_loc,in_loc,v_loc,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),320,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
321 | } | |||
322 | } | |||
323 | } | |||
324 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
325 | } | |||
326 | ||||
327 | PETSC_STATIC_INLINEstatic inline PetscErrorCode MatSetValuesBlocked_SeqSBAIJ_Inlined(Mat A,PetscInt row,PetscInt col,const PetscScalar v[],InsertMode is,PetscInt orow,PetscInt ocol) | |||
328 | { | |||
329 | Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)A->data; | |||
330 | PetscErrorCode ierr; | |||
331 | PetscInt *rp,low,high,t,ii,jj,nrow,i,rmax,N; | |||
332 | PetscInt *imax =a->imax,*ai=a->i,*ailen=a->ilen; | |||
333 | PetscInt *aj =a->j,nonew=a->nonew,bs2=a->bs2,bs=A->rmap->bs; | |||
334 | PetscBool roworiented=a->roworiented; | |||
335 | const PetscScalar *value = v; | |||
336 | MatScalar *ap,*aa = a->a,*bap; | |||
337 | ||||
338 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 338; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
339 | if (col < row) { | |||
340 | if (a->ignore_ltriangular) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); /* ignore lower triangular block */ | |||
341 | else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),341,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)" ); | |||
342 | } | |||
343 | rp = aj + ai[row]; | |||
344 | ap = aa + bs2*ai[row]; | |||
345 | rmax = imax[row]; | |||
346 | nrow = ailen[row]; | |||
347 | value = v; | |||
348 | low = 0; | |||
349 | high = nrow; | |||
350 | ||||
351 | while (high-low > 7) { | |||
352 | t = (low+high)/2; | |||
353 | if (rp[t] > col) high = t; | |||
354 | else low = t; | |||
355 | } | |||
356 | for (i=low; i<high; i++) { | |||
357 | if (rp[i] > col) break; | |||
358 | if (rp[i] == col) { | |||
359 | bap = ap + bs2*i; | |||
360 | if (roworiented) { | |||
361 | if (is == ADD_VALUES) { | |||
362 | for (ii=0; ii<bs; ii++) { | |||
363 | for (jj=ii; jj<bs2; jj+=bs) { | |||
364 | bap[jj] += *value++; | |||
365 | } | |||
366 | } | |||
367 | } else { | |||
368 | for (ii=0; ii<bs; ii++) { | |||
369 | for (jj=ii; jj<bs2; jj+=bs) { | |||
370 | bap[jj] = *value++; | |||
371 | } | |||
372 | } | |||
373 | } | |||
374 | } else { | |||
375 | if (is == ADD_VALUES) { | |||
376 | for (ii=0; ii<bs; ii++) { | |||
377 | for (jj=0; jj<bs; jj++) { | |||
378 | *bap++ += *value++; | |||
379 | } | |||
380 | } | |||
381 | } else { | |||
382 | for (ii=0; ii<bs; ii++) { | |||
383 | for (jj=0; jj<bs; jj++) { | |||
384 | *bap++ = *value++; | |||
385 | } | |||
386 | } | |||
387 | } | |||
388 | } | |||
389 | goto noinsert2; | |||
390 | } | |||
391 | } | |||
392 | if (nonew == 1) goto noinsert2; | |||
393 | if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new block index nonzero block (%D, %D) in the matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),393,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new block index nonzero block (%D, %D) in the matrix" ,orow,ocol); | |||
394 | MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE, len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) return PetscError(((MPI_Comm)0x44000001),394,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,row,col); ierr = PetscMallocA(3,PETSC_FALSE,394,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),394,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<row +1; ii++) {new_i[ii] = ai[ii];} for (ii=row+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = PetscMemcpy( new_j,aj,(ai[row]+nrow)*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),394,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[row] - nrow); ierr = PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE ,aj+ai[row]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),394,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a,aa,bs2*(ai[row]+nrow)*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),394,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(ai[row]+nrow),bs2*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),394,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a+bs2*(ai[row]+nrow+CHUNKSIZE),aa+bs2*(ai[row]+nrow),bs2 *len*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),394,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),394,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain-> a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row ]; ap = aa + bs2*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE ; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }; | |||
395 | N = nrow++ - 1; high++; | |||
396 | /* shift up all the later entries in this row */ | |||
397 | for (ii=N; ii>=i; ii--) { | |||
398 | rp[ii+1] = rp[ii]; | |||
399 | ierr = PetscMemcpy(ap+bs2*(ii+1),ap+bs2*(ii),bs2*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),399,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
400 | } | |||
401 | if (N >= i) { | |||
402 | ierr = PetscMemzero(ap+bs2*i,bs2*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),402,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
403 | } | |||
404 | rp[i] = col; | |||
405 | bap = ap + bs2*i; | |||
406 | if (roworiented) { | |||
407 | for (ii=0; ii<bs; ii++) { | |||
408 | for (jj=ii; jj<bs2; jj+=bs) { | |||
409 | bap[jj] = *value++; | |||
410 | } | |||
411 | } | |||
412 | } else { | |||
413 | for (ii=0; ii<bs; ii++) { | |||
414 | for (jj=0; jj<bs; jj++) { | |||
415 | *bap++ = *value++; | |||
416 | } | |||
417 | } | |||
418 | } | |||
419 | noinsert2:; | |||
420 | ailen[row] = nrow; | |||
421 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
422 | } | |||
423 | ||||
424 | /* | |||
425 | This routine is exactly duplicated in mpibaij.c | |||
426 | */ | |||
427 | PETSC_STATIC_INLINEstatic inline PetscErrorCode MatSetValuesBlocked_SeqBAIJ_Inlined(Mat A,PetscInt row,PetscInt col,const PetscScalar v[],InsertMode is,PetscInt orow,PetscInt ocol) | |||
428 | { | |||
429 | Mat_SeqBAIJ *a = (Mat_SeqBAIJ*)A->data; | |||
430 | PetscInt *rp,low,high,t,ii,jj,nrow,i,rmax,N; | |||
431 | PetscInt *imax=a->imax,*ai=a->i,*ailen=a->ilen; | |||
432 | PetscErrorCode ierr; | |||
433 | PetscInt *aj =a->j,nonew=a->nonew,bs2=a->bs2,bs=A->rmap->bs; | |||
434 | PetscBool roworiented=a->roworiented; | |||
435 | const PetscScalar *value = v; | |||
436 | MatScalar *ap,*aa = a->a,*bap; | |||
437 | ||||
438 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 438; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
439 | rp = aj + ai[row]; | |||
440 | ap = aa + bs2*ai[row]; | |||
441 | rmax = imax[row]; | |||
442 | nrow = ailen[row]; | |||
443 | low = 0; | |||
444 | high = nrow; | |||
445 | value = v; | |||
446 | while (high-low > 7) { | |||
447 | t = (low+high)/2; | |||
448 | if (rp[t] > col) high = t; | |||
449 | else low = t; | |||
450 | } | |||
451 | for (i=low; i<high; i++) { | |||
452 | if (rp[i] > col) break; | |||
453 | if (rp[i] == col) { | |||
454 | bap = ap + bs2*i; | |||
455 | if (roworiented) { | |||
456 | if (is == ADD_VALUES) { | |||
457 | for (ii=0; ii<bs; ii++) { | |||
458 | for (jj=ii; jj<bs2; jj+=bs) { | |||
459 | bap[jj] += *value++; | |||
460 | } | |||
461 | } | |||
462 | } else { | |||
463 | for (ii=0; ii<bs; ii++) { | |||
464 | for (jj=ii; jj<bs2; jj+=bs) { | |||
465 | bap[jj] = *value++; | |||
466 | } | |||
467 | } | |||
468 | } | |||
469 | } else { | |||
470 | if (is == ADD_VALUES) { | |||
471 | for (ii=0; ii<bs; ii++,value+=bs) { | |||
472 | for (jj=0; jj<bs; jj++) { | |||
473 | bap[jj] += value[jj]; | |||
474 | } | |||
475 | bap += bs; | |||
476 | } | |||
477 | } else { | |||
478 | for (ii=0; ii<bs; ii++,value+=bs) { | |||
479 | for (jj=0; jj<bs; jj++) { | |||
480 | bap[jj] = value[jj]; | |||
481 | } | |||
482 | bap += bs; | |||
483 | } | |||
484 | } | |||
485 | } | |||
486 | goto noinsert2; | |||
487 | } | |||
488 | } | |||
489 | if (nonew == 1) goto noinsert2; | |||
490 | if (nonew == -1) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Inserting a new global block indexed nonzero block (%D, %D) in the matrix", orow, ocol)return PetscError(((MPI_Comm)0x44000001),490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Inserting a new global block indexed nonzero block (%D, %D) in the matrix" ,orow,ocol); | |||
491 | MatSeqXAIJReallocateAIJ(A,a->mbs,bs2,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar)if (nrow >= rmax) { Mat_SeqAIJ *Ain = (Mat_SeqAIJ*)A->data ; PetscInt CHUNKSIZE = 15,new_nz = ai[a->mbs] + CHUNKSIZE, len,*new_i=0,*new_j=0; MatScalar *new_a; if (nonew == -2) return PetscError(((MPI_Comm)0x44000001),491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"New nonzero at (%D,%D) caused a malloc\nUse MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" ,row,col); ierr = PetscMallocA(3,PETSC_FALSE,491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2*new_nz)*sizeof(**(&new_a)),(&new_a),(size_t )(new_nz)*sizeof(**(&new_j)),(&new_j),(size_t)(a-> mbs+1)*sizeof(**(&new_i)),(&new_i));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),491,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); for (ii=0; ii<row +1; ii++) {new_i[ii] = ai[ii];} for (ii=row+1; ii<a->mbs +1; ii++) {new_i[ii] = ai[ii]+CHUNKSIZE;} ierr = PetscMemcpy( new_j,aj,(ai[row]+nrow)*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),491,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); len = (new_nz - CHUNKSIZE - ai[row] - nrow); ierr = PetscMemcpy(new_j+ai[row]+nrow+CHUNKSIZE ,aj+ai[row]+nrow,len*sizeof(PetscInt));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),491,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a,aa,bs2*(ai[row]+nrow)*sizeof(MatScalar));do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),491,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemzero (new_a+bs2*(ai[row]+nrow),bs2*CHUNKSIZE*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = PetscMemcpy (new_a+bs2*(ai[row]+nrow+CHUNKSIZE),aa+bs2*(ai[row]+nrow),bs2 *len*sizeof(MatScalar));do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),491,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); ierr = MatSeqXAIJFreeAIJ (A,&Ain->a,&Ain->j,&Ain->i);do {if (__builtin_expect (!!(ierr),0)) return PetscError(((MPI_Comm)0x44000001),491,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); aa = new_a; Ain-> a = (MatScalar*) new_a; ai = Ain->i = new_i; aj = Ain-> j = new_j; Ain->singlemalloc = PETSC_TRUE; rp = aj + ai[row ]; ap = aa + bs2*ai[row]; rmax = imax[row] = imax[row] + CHUNKSIZE ; Ain->maxnz += bs2*CHUNKSIZE; Ain->reallocs++; }; | |||
492 | N = nrow++ - 1; high++; | |||
493 | /* shift up all the later entries in this row */ | |||
494 | for (ii=N; ii>=i; ii--) { | |||
495 | rp[ii+1] = rp[ii]; | |||
496 | ierr = PetscMemcpy(ap+bs2*(ii+1),ap+bs2*(ii),bs2*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),496,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
497 | } | |||
498 | if (N >= i) { | |||
499 | ierr = PetscMemzero(ap+bs2*i,bs2*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),499,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
500 | } | |||
501 | rp[i] = col; | |||
502 | bap = ap + bs2*i; | |||
503 | if (roworiented) { | |||
504 | for (ii=0; ii<bs; ii++) { | |||
505 | for (jj=ii; jj<bs2; jj+=bs) { | |||
506 | bap[jj] = *value++; | |||
507 | } | |||
508 | } | |||
509 | } else { | |||
510 | for (ii=0; ii<bs; ii++) { | |||
511 | for (jj=0; jj<bs; jj++) { | |||
512 | *bap++ = *value++; | |||
513 | } | |||
514 | } | |||
515 | } | |||
516 | noinsert2:; | |||
517 | ailen[row] = nrow; | |||
518 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
519 | } | |||
520 | ||||
521 | /* | |||
522 | This routine could be optimized by removing the need for the block copy below and passing stride information | |||
523 | to the above inline routines; similarly in MatSetValuesBlocked_MPIBAIJ() | |||
524 | */ | |||
525 | PetscErrorCode MatSetValuesBlocked_MPISBAIJ(Mat mat,PetscInt m,const PetscInt im[],PetscInt n,const PetscInt in[],const MatScalar v[],InsertMode addv) | |||
526 | { | |||
527 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
528 | const MatScalar *value; | |||
529 | MatScalar *barray =baij->barray; | |||
530 | PetscBool roworiented = baij->roworiented,ignore_ltriangular = ((Mat_SeqSBAIJ*)baij->A->data)->ignore_ltriangular; | |||
531 | PetscErrorCode ierr; | |||
532 | PetscInt i,j,ii,jj,row,col,rstart=baij->rstartbs; | |||
533 | PetscInt rend=baij->rendbs,cstart=baij->rstartbs,stepval; | |||
534 | PetscInt cend=baij->rendbs,bs=mat->rmap->bs,bs2=baij->bs2; | |||
535 | ||||
536 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 536; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
537 | if (!barray) { | |||
538 | ierr = PetscMalloc1(bs2,&barray)PetscMallocA(1,PETSC_FALSE,538,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs2)*sizeof(**(&barray)),(&barray));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),538,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
539 | baij->barray = barray; | |||
540 | } | |||
541 | ||||
542 | if (roworiented) { | |||
543 | stepval = (n-1)*bs; | |||
544 | } else { | |||
545 | stepval = (m-1)*bs; | |||
546 | } | |||
547 | for (i=0; i<m; i++) { | |||
548 | if (im[i] < 0) continue; | |||
549 | #if defined(PETSC_USE_DEBUG1) | |||
550 | if (im[i] >= baij->Mbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Block indexed row too large %D max %D",im[i],baij->Mbs-1)return PetscError(((MPI_Comm)0x44000001),550,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Block indexed row too large %D max %D" ,im[i],baij->Mbs-1); | |||
551 | #endif | |||
552 | if (im[i] >= rstart && im[i] < rend) { | |||
553 | row = im[i] - rstart; | |||
554 | for (j=0; j<n; j++) { | |||
555 | if (im[i] > in[j]) { | |||
556 | if (ignore_ltriangular) continue; /* ignore lower triangular blocks */ | |||
557 | else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_USER,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)")return PetscError(((MPI_Comm)0x44000001),557,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,83,PETSC_ERROR_INITIAL,"Lower triangular value cannot be set for sbaij format. Ignoring these values, run with -mat_ignore_lower_triangular or call MatSetOption(mat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE)" ); | |||
558 | } | |||
559 | /* If NumCol = 1 then a copy is not required */ | |||
560 | if ((roworiented) && (n == 1)) { | |||
561 | barray = (MatScalar*) v + i*bs2; | |||
562 | } else if ((!roworiented) && (m == 1)) { | |||
563 | barray = (MatScalar*) v + j*bs2; | |||
564 | } else { /* Here a copy is required */ | |||
565 | if (roworiented) { | |||
566 | value = v + i*(stepval+bs)*bs + j*bs; | |||
567 | } else { | |||
568 | value = v + j*(stepval+bs)*bs + i*bs; | |||
569 | } | |||
570 | for (ii=0; ii<bs; ii++,value+=stepval) { | |||
571 | for (jj=0; jj<bs; jj++) { | |||
572 | *barray++ = *value++; | |||
573 | } | |||
574 | } | |||
575 | barray -=bs2; | |||
576 | } | |||
577 | ||||
578 | if (in[j] >= cstart && in[j] < cend) { | |||
579 | col = in[j] - cstart; | |||
580 | ierr = MatSetValuesBlocked_SeqSBAIJ_Inlined(baij->A,row,col,barray,addv,im[i],in[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),580,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
581 | } else if (in[j] < 0) continue; | |||
582 | #if defined(PETSC_USE_DEBUG1) | |||
583 | else if (in[j] >= baij->Nbs) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Block indexed column too large %D max %D",in[j],baij->Nbs-1)return PetscError(((MPI_Comm)0x44000001),583,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Block indexed column too large %D max %D" ,in[j],baij->Nbs-1); | |||
584 | #endif | |||
585 | else { | |||
586 | if (mat->was_assembled) { | |||
587 | if (!baij->colmap) { | |||
588 | ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),588,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
589 | } | |||
590 | ||||
591 | #if defined(PETSC_USE_DEBUG1) | |||
592 | #if defined(PETSC_USE_CTABLE1) | |||
593 | { PetscInt data; | |||
594 | ierr = PetscTableFind(baij->colmap,in[j]+1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),594,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
595 | if ((data - 1) % bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Incorrect colmap")return PetscError(((MPI_Comm)0x44000001),595,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,77,PETSC_ERROR_INITIAL,"Incorrect colmap"); | |||
596 | } | |||
597 | #else | |||
598 | if ((baij->colmap[in[j]] - 1) % bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Incorrect colmap")return PetscError(((MPI_Comm)0x44000001),598,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,77,PETSC_ERROR_INITIAL,"Incorrect colmap"); | |||
599 | #endif | |||
600 | #endif | |||
601 | #if defined(PETSC_USE_CTABLE1) | |||
602 | ierr = PetscTableFind(baij->colmap,in[j]+1,&col);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),602,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
603 | col = (col - 1)/bs; | |||
604 | #else | |||
605 | col = (baij->colmap[in[j]] - 1)/bs; | |||
606 | #endif | |||
607 | if (col < 0 && !((Mat_SeqBAIJ*)(baij->A->data))->nonew) { | |||
608 | ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
609 | col = in[j]; | |||
610 | } | |||
611 | } else col = in[j]; | |||
612 | ierr = MatSetValuesBlocked_SeqBAIJ_Inlined(baij->B,row,col,barray,addv,im[i],in[j]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
613 | } | |||
614 | } | |||
615 | } else { | |||
616 | if (mat->nooffprocentries) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Setting off process block indexed row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set",im[i])return PetscError(((MPI_Comm)0x44000001),616,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Setting off process block indexed row %D even though MatSetOption(,MAT_NO_OFF_PROC_ENTRIES,PETSC_TRUE) was set" ,im[i]); | |||
617 | if (!baij->donotstash) { | |||
618 | if (roworiented) { | |||
619 | ierr = MatStashValuesRowBlocked_Private(&mat->bstash,im[i],n,in,v,m,n,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),619,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
620 | } else { | |||
621 | ierr = MatStashValuesColBlocked_Private(&mat->bstash,im[i],n,in,v,m,n,i);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),621,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
622 | } | |||
623 | } | |||
624 | } | |||
625 | } | |||
626 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
627 | } | |||
628 | ||||
629 | PetscErrorCode MatGetValues_MPISBAIJ(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const PetscInt idxn[],PetscScalar v[]) | |||
630 | { | |||
631 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
632 | PetscErrorCode ierr; | |||
633 | PetscInt bs = mat->rmap->bs,i,j,bsrstart = mat->rmap->rstart,bsrend = mat->rmap->rend; | |||
634 | PetscInt bscstart = mat->cmap->rstart,bscend = mat->cmap->rend,row,col,data; | |||
635 | ||||
636 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 636; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
637 | for (i=0; i<m; i++) { | |||
| ||||
638 | if (idxm[i] < 0) continue; /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative row: %D",idxm[i]); */ | |||
639 | if (idxm[i] >= mat->rmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Row too large: row %D max %D",idxm[i],mat->rmap->N-1)return PetscError(((MPI_Comm)0x44000001),639,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Row too large: row %D max %D",idxm[i ],mat->rmap->N-1); | |||
640 | if (idxm[i] >= bsrstart && idxm[i] < bsrend) { | |||
641 | row = idxm[i] - bsrstart; | |||
642 | for (j=0; j<n; j++) { | |||
643 | if (idxn[j] < 0) continue; /* SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Negative column %D",idxn[j]); */ | |||
644 | if (idxn[j] >= mat->cmap->N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Column too large: col %D max %D",idxn[j],mat->cmap->N-1)return PetscError(((MPI_Comm)0x44000001),644,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Column too large: col %D max %D",idxn [j],mat->cmap->N-1); | |||
645 | if (idxn[j] >= bscstart && idxn[j] < bscend) { | |||
646 | col = idxn[j] - bscstart; | |||
647 | ierr = MatGetValues_SeqSBAIJ(baij->A,1,&row,1,&col,v+i*n+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),647,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
648 | } else { | |||
649 | if (!baij->colmap) { | |||
650 | ierr = MatCreateColmap_MPIBAIJ_Private(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),650,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
651 | } | |||
652 | #if defined(PETSC_USE_CTABLE1) | |||
653 | ierr = PetscTableFind(baij->colmap,idxn[j]/bs+1,&data);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),653,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
654 | data--; | |||
655 | #else | |||
656 | data = baij->colmap[idxn[j]/bs]-1; | |||
657 | #endif | |||
658 | if ((data < 0) || (baij->garray[data/bs] != idxn[j]/bs)) *(v+i*n+j) = 0.0; | |||
659 | else { | |||
660 | col = data + idxn[j]%bs; | |||
661 | ierr = MatGetValues_SeqBAIJ(baij->B,1,&row,1,&col,v+i*n+j);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),661,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
662 | } | |||
663 | } | |||
664 | } | |||
665 | } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only local values currently supported")return PetscError(((MPI_Comm)0x44000001),665,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Only local values currently supported" ); | |||
666 | } | |||
667 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
668 | } | |||
669 | ||||
670 | PetscErrorCode MatNorm_MPISBAIJ(Mat mat,NormType type,PetscReal *norm) | |||
671 | { | |||
672 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
673 | PetscErrorCode ierr; | |||
674 | PetscReal sum[2],*lnorm2; | |||
675 | ||||
676 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 676; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
677 | if (baij->size == 1) { | |||
678 | ierr = MatNorm(baij->A,type,norm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),678,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
679 | } else { | |||
680 | if (type == NORM_FROBENIUS) { | |||
681 | ierr = PetscMalloc1(2,&lnorm2)PetscMallocA(1,PETSC_FALSE,681,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(2)*sizeof(**(&lnorm2)),(&lnorm2));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),681,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
682 | ierr = MatNorm(baij->A,type,lnorm2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
683 | *lnorm2 = (*lnorm2)*(*lnorm2); lnorm2++; /* squar power of norm(A) */ | |||
684 | ierr = MatNorm(baij->B,type,lnorm2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),684,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
685 | *lnorm2 = (*lnorm2)*(*lnorm2); lnorm2--; /* squar power of norm(B) */ | |||
686 | ierr = MPIU_Allreduce(lnorm2,sum,2,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat) ,2,686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)mat))),0) || MPI_Allreduce((lnorm2),(sum),(2),( ((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003)),(PetscObjectComm ((PetscObject)mat)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
687 | *norm = PetscSqrtReal(sum[0] + 2*sum[1])sqrt(sum[0] + 2*sum[1]); | |||
688 | ierr = PetscFree(lnorm2)((*PetscTrFree)((void*)(lnorm2),688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((lnorm2) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
689 | } else if (type == NORM_INFINITY || type == NORM_1) { /* max row/column sum */ | |||
690 | Mat_SeqSBAIJ *amat=(Mat_SeqSBAIJ*)baij->A->data; | |||
691 | Mat_SeqBAIJ *bmat=(Mat_SeqBAIJ*)baij->B->data; | |||
692 | PetscReal *rsum,*rsum2,vabs; | |||
693 | PetscInt *jj,*garray=baij->garray,rstart=baij->rstartbs,nz; | |||
694 | PetscInt brow,bcol,col,bs=baij->A->rmap->bs,row,grow,gcol,mbs=amat->mbs; | |||
695 | MatScalar *v; | |||
696 | ||||
697 | ierr = PetscMalloc2(mat->cmap->N,&rsum,mat->cmap->N,&rsum2)PetscMallocA(2,PETSC_FALSE,697,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(mat->cmap->N)*sizeof(**(&rsum)),(&rsum ),(size_t)(mat->cmap->N)*sizeof(**(&rsum2)),(&rsum2 ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),697,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
698 | ierr = PetscMemzero(rsum,mat->cmap->N*sizeof(PetscReal));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
699 | /* Amat */ | |||
700 | v = amat->a; jj = amat->j; | |||
701 | for (brow=0; brow<mbs; brow++) { | |||
702 | grow = bs*(rstart + brow); | |||
703 | nz = amat->i[brow+1] - amat->i[brow]; | |||
704 | for (bcol=0; bcol<nz; bcol++) { | |||
705 | gcol = bs*(rstart + *jj); jj++; | |||
706 | for (col=0; col<bs; col++) { | |||
707 | for (row=0; row<bs; row++) { | |||
708 | vabs = PetscAbsScalar(*v); v++; | |||
709 | rsum[gcol+col] += vabs; | |||
710 | /* non-diagonal block */ | |||
711 | if (bcol > 0 && vabs > 0.0) rsum[grow+row] += vabs; | |||
712 | } | |||
713 | } | |||
714 | } | |||
715 | ierr = PetscLogFlops(nz*bs*bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),715,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
716 | } | |||
717 | /* Bmat */ | |||
718 | v = bmat->a; jj = bmat->j; | |||
719 | for (brow=0; brow<mbs; brow++) { | |||
720 | grow = bs*(rstart + brow); | |||
721 | nz = bmat->i[brow+1] - bmat->i[brow]; | |||
722 | for (bcol=0; bcol<nz; bcol++) { | |||
723 | gcol = bs*garray[*jj]; jj++; | |||
724 | for (col=0; col<bs; col++) { | |||
725 | for (row=0; row<bs; row++) { | |||
726 | vabs = PetscAbsScalar(*v); v++; | |||
727 | rsum[gcol+col] += vabs; | |||
728 | rsum[grow+row] += vabs; | |||
729 | } | |||
730 | } | |||
731 | } | |||
732 | ierr = PetscLogFlops(nz*bs*bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),732,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
733 | } | |||
734 | ierr = MPIU_Allreduce(rsum,rsum2,mat->cmap->N,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat) ,mat->cmap->N,734,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)mat))),0) || MPI_Allreduce((rsum),(rsum2),(mat-> cmap->N),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003 )),(PetscObjectComm((PetscObject)mat)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),734,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
735 | *norm = 0.0; | |||
736 | for (col=0; col<mat->cmap->N; col++) { | |||
737 | if (rsum2[col] > *norm) *norm = rsum2[col]; | |||
738 | } | |||
739 | ierr = PetscFree2(rsum,rsum2)PetscFreeA(2,739,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,&(rsum),&(rsum2));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),739,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
740 | } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"No support for this norm yet")return PetscError(((MPI_Comm)0x44000001),740,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"No support for this norm yet"); | |||
741 | } | |||
742 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
743 | } | |||
744 | ||||
745 | PetscErrorCode MatAssemblyBegin_MPISBAIJ(Mat mat,MatAssemblyType mode) | |||
746 | { | |||
747 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
748 | PetscErrorCode ierr; | |||
749 | PetscInt nstash,reallocs; | |||
750 | ||||
751 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 751; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
752 | if (baij->donotstash || mat->nooffprocentries) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
753 | ||||
754 | ierr = MatStashScatterBegin_Private(mat,&mat->stash,mat->rmap->range);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),754,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
755 | ierr = MatStashScatterBegin_Private(mat,&mat->bstash,baij->rangebs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),755,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
756 | ierr = MatStashGetInfo_Private(&mat->stash,&nstash,&reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),756,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
757 | ierr = PetscInfo2(mat,"Stash has %D entries,uses %D mallocs.\n",nstash,reallocs)PetscInfo_Private(__func__,mat,"Stash has %D entries,uses %D mallocs.\n" ,nstash,reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),757,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
758 | ierr = MatStashGetInfo_Private(&mat->stash,&nstash,&reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),758,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
759 | ierr = PetscInfo2(mat,"Block-Stash has %D entries, uses %D mallocs.\n",nstash,reallocs)PetscInfo_Private(__func__,mat,"Block-Stash has %D entries, uses %D mallocs.\n" ,nstash,reallocs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),759,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
760 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
761 | } | |||
762 | ||||
763 | PetscErrorCode MatAssemblyEnd_MPISBAIJ(Mat mat,MatAssemblyType mode) | |||
764 | { | |||
765 | Mat_MPISBAIJ *baij=(Mat_MPISBAIJ*)mat->data; | |||
766 | Mat_SeqSBAIJ *a =(Mat_SeqSBAIJ*)baij->A->data; | |||
767 | PetscErrorCode ierr; | |||
768 | PetscInt i,j,rstart,ncols,flg,bs2=baij->bs2; | |||
769 | PetscInt *row,*col; | |||
770 | PetscBool other_disassembled; | |||
771 | PetscMPIInt n; | |||
772 | PetscBool r1,r2,r3; | |||
773 | MatScalar *val; | |||
774 | ||||
775 | /* do not use 'b=(Mat_SeqBAIJ*)baij->B->data' as B can be reset in disassembly */ | |||
776 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 776; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
777 | if (!baij->donotstash && !mat->nooffprocentries) { | |||
778 | while (1) { | |||
779 | ierr = MatStashScatterGetMesg_Private(&mat->stash,&n,&row,&col,&val,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),779,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
780 | if (!flg) break; | |||
781 | ||||
782 | for (i=0; i<n;) { | |||
783 | /* Now identify the consecutive vals belonging to the same row */ | |||
784 | for (j=i,rstart=row[j]; j<n; j++) { | |||
785 | if (row[j] != rstart) break; | |||
786 | } | |||
787 | if (j < n) ncols = j-i; | |||
788 | else ncols = n-i; | |||
789 | /* Now assemble all these values with a single function call */ | |||
790 | ierr = MatSetValues_MPISBAIJ(mat,1,row+i,ncols,col+i,val+i,mat->insertmode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),790,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
791 | i = j; | |||
792 | } | |||
793 | } | |||
794 | ierr = MatStashScatterEnd_Private(&mat->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),794,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
795 | /* Now process the block-stash. Since the values are stashed column-oriented, | |||
796 | set the roworiented flag to column oriented, and after MatSetValues() | |||
797 | restore the original flags */ | |||
798 | r1 = baij->roworiented; | |||
799 | r2 = a->roworiented; | |||
800 | r3 = ((Mat_SeqBAIJ*)baij->B->data)->roworiented; | |||
801 | ||||
802 | baij->roworiented = PETSC_FALSE; | |||
803 | a->roworiented = PETSC_FALSE; | |||
804 | ||||
805 | ((Mat_SeqBAIJ*)baij->B->data)->roworiented = PETSC_FALSE; /* b->roworinted */ | |||
806 | while (1) { | |||
807 | ierr = MatStashScatterGetMesg_Private(&mat->bstash,&n,&row,&col,&val,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
808 | if (!flg) break; | |||
809 | ||||
810 | for (i=0; i<n;) { | |||
811 | /* Now identify the consecutive vals belonging to the same row */ | |||
812 | for (j=i,rstart=row[j]; j<n; j++) { | |||
813 | if (row[j] != rstart) break; | |||
814 | } | |||
815 | if (j < n) ncols = j-i; | |||
816 | else ncols = n-i; | |||
817 | ierr = MatSetValuesBlocked_MPISBAIJ(mat,1,row+i,ncols,col+i,val+i*bs2,mat->insertmode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),817,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
818 | i = j; | |||
819 | } | |||
820 | } | |||
821 | ierr = MatStashScatterEnd_Private(&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),821,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
822 | ||||
823 | baij->roworiented = r1; | |||
824 | a->roworiented = r2; | |||
825 | ||||
826 | ((Mat_SeqBAIJ*)baij->B->data)->roworiented = r3; /* b->roworinted */ | |||
827 | } | |||
828 | ||||
829 | ierr = MatAssemblyBegin(baij->A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),829,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
830 | ierr = MatAssemblyEnd(baij->A,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),830,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
831 | ||||
832 | /* determine if any processor has disassembled, if so we must | |||
833 | also disassemble ourselfs, in order that we may reassemble. */ | |||
834 | /* | |||
835 | if nonzero structure of submatrix B cannot change then we know that | |||
836 | no processor disassembled thus we can skip this stuff | |||
837 | */ | |||
838 | if (!((Mat_SeqBAIJ*)baij->B->data)->nonew) { | |||
839 | ierr = MPIU_Allreduce(&mat->was_assembled,&other_disassembled,1,MPIU_BOOL,MPI_PROD,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat) ,1,839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)mat))),0) || MPI_Allreduce((&mat->was_assembled ),(&other_disassembled),(1),(MPIU_BOOL),((MPI_Op)(0x58000004 )),(PetscObjectComm((PetscObject)mat)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),839,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
840 | if (mat->was_assembled && !other_disassembled) { | |||
841 | ierr = MatDisAssemble_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),841,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
842 | } | |||
843 | } | |||
844 | ||||
845 | if (!mat->was_assembled && mode == MAT_FINAL_ASSEMBLY) { | |||
846 | ierr = MatSetUpMultiply_MPISBAIJ(mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),846,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); /* setup Mvctx and sMvctx */ | |||
847 | } | |||
848 | ierr = MatAssemblyBegin(baij->B,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),848,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
849 | ierr = MatAssemblyEnd(baij->B,mode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),849,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
850 | ||||
851 | ierr = PetscFree2(baij->rowvalues,baij->rowindices)PetscFreeA(2,851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,&(baij->rowvalues),&(baij->rowindices));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),851,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
852 | ||||
853 | baij->rowvalues = 0; | |||
854 | ||||
855 | /* if no new nonzero locations are allowed in matrix then only set the matrix state the first time through */ | |||
856 | if ((!mat->was_assembled && mode == MAT_FINAL_ASSEMBLY) || !((Mat_SeqBAIJ*)(baij->A->data))->nonew) { | |||
857 | PetscObjectState state = baij->A->nonzerostate + baij->B->nonzerostate; | |||
858 | ierr = MPIU_Allreduce(&state,&mat->nonzerostate,1,MPIU_INT64,MPI_SUM,PetscObjectComm((PetscObject)mat))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)mat) ,1,858,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)mat))),0) || MPI_Allreduce((&state),(&mat ->nonzerostate),(1),(((MPI_Datatype)0x4c00083a)),((MPI_Op) (0x58000003)),(PetscObjectComm((PetscObject)mat)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),858,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
859 | } | |||
860 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
861 | } | |||
862 | ||||
863 | extern PetscErrorCode MatSetValues_MPIBAIJ(Mat,PetscInt,const PetscInt[],PetscInt,const PetscInt[],const PetscScalar[],InsertMode); | |||
864 | #include <petscdraw.h> | |||
865 | static PetscErrorCode MatView_MPISBAIJ_ASCIIorDraworSocket(Mat mat,PetscViewer viewer) | |||
866 | { | |||
867 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
868 | PetscErrorCode ierr; | |||
869 | PetscInt bs = mat->rmap->bs; | |||
870 | PetscMPIInt rank = baij->rank; | |||
871 | PetscBool iascii,isdraw; | |||
872 | PetscViewer sviewer; | |||
873 | PetscViewerFormat format; | |||
874 | ||||
875 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 875; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
876 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),876,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
877 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),877,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
878 | if (iascii) { | |||
879 | ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),879,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
880 | if (format == PETSC_VIEWER_ASCII_INFO_DETAIL) { | |||
881 | MatInfo info; | |||
882 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)mat),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),882,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
883 | ierr = MatGetInfo(mat,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),883,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
884 | ierr = PetscViewerASCIIPushSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),884,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
885 | ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] Local rows %D nz %D nz alloced %D bs %D mem %g\n",rank,mat->rmap->n,(PetscInt)info.nz_used,(PetscInt)info.nz_allocated,mat->rmap->bs,(double)info.memory);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),885,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
886 | ierr = MatGetInfo(baij->A,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),886,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
887 | ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] on-diagonal part: nz %D \n",rank,(PetscInt)info.nz_used);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),887,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
888 | ierr = MatGetInfo(baij->B,MAT_LOCAL,&info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),888,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
889 | ierr = PetscViewerASCIISynchronizedPrintf(viewer,"[%d] off-diagonal part: nz %D \n",rank,(PetscInt)info.nz_used);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),889,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
890 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),890,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
891 | ierr = PetscViewerASCIIPopSynchronized(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),891,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
892 | ierr = PetscViewerASCIIPrintf(viewer,"Information on VecScatter used in matrix-vector product: \n");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),892,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
893 | ierr = VecScatterView(baij->Mvctx,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),893,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
894 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
895 | } else if (format == PETSC_VIEWER_ASCII_INFO) { | |||
896 | ierr = PetscViewerASCIIPrintf(viewer," block size is %D\n",bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),896,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
897 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
898 | } else if (format == PETSC_VIEWER_ASCII_FACTOR_INFO) { | |||
899 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
900 | } | |||
901 | } | |||
902 | ||||
903 | if (isdraw) { | |||
904 | PetscDraw draw; | |||
905 | PetscBool isnull; | |||
906 | ierr = PetscViewerDrawGetDraw(viewer,0,&draw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
907 | ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),907,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
908 | if (isnull) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
909 | } | |||
910 | ||||
911 | { | |||
912 | /* assemble the entire matrix onto first processor. */ | |||
913 | Mat A; | |||
914 | Mat_SeqSBAIJ *Aloc; | |||
915 | Mat_SeqBAIJ *Bloc; | |||
916 | PetscInt M = mat->rmap->N,N = mat->cmap->N,*ai,*aj,col,i,j,k,*rvals,mbs = baij->mbs; | |||
917 | MatScalar *a; | |||
918 | const char *matname; | |||
919 | ||||
920 | /* Should this be the same type as mat? */ | |||
921 | ierr = MatCreate(PetscObjectComm((PetscObject)mat),&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),921,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
922 | if (!rank) { | |||
923 | ierr = MatSetSizes(A,M,N,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),923,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
924 | } else { | |||
925 | ierr = MatSetSizes(A,0,0,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),925,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
926 | } | |||
927 | ierr = MatSetType(A,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),927,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
928 | ierr = MatMPISBAIJSetPreallocation(A,mat->rmap->bs,0,NULL((void*)0),0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),928,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
929 | ierr = MatSetOption(A,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),929,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
930 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),930,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
931 | ||||
932 | /* copy over the A part */ | |||
933 | Aloc = (Mat_SeqSBAIJ*)baij->A->data; | |||
934 | ai = Aloc->i; aj = Aloc->j; a = Aloc->a; | |||
935 | ierr = PetscMalloc1(bs,&rvals)PetscMallocA(1,PETSC_FALSE,935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs)*sizeof(**(&rvals)),(&rvals));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),935,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
936 | ||||
937 | for (i=0; i<mbs; i++) { | |||
938 | rvals[0] = bs*(baij->rstartbs + i); | |||
939 | for (j=1; j<bs; j++) rvals[j] = rvals[j-1] + 1; | |||
940 | for (j=ai[i]; j<ai[i+1]; j++) { | |||
941 | col = (baij->cstartbs+aj[j])*bs; | |||
942 | for (k=0; k<bs; k++) { | |||
943 | ierr = MatSetValues_MPISBAIJ(A,bs,rvals,1,&col,a,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),943,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
944 | col++; | |||
945 | a += bs; | |||
946 | } | |||
947 | } | |||
948 | } | |||
949 | /* copy over the B part */ | |||
950 | Bloc = (Mat_SeqBAIJ*)baij->B->data; | |||
951 | ai = Bloc->i; aj = Bloc->j; a = Bloc->a; | |||
952 | for (i=0; i<mbs; i++) { | |||
953 | ||||
954 | rvals[0] = bs*(baij->rstartbs + i); | |||
955 | for (j=1; j<bs; j++) rvals[j] = rvals[j-1] + 1; | |||
956 | for (j=ai[i]; j<ai[i+1]; j++) { | |||
957 | col = baij->garray[aj[j]]*bs; | |||
958 | for (k=0; k<bs; k++) { | |||
959 | ierr = MatSetValues_MPIBAIJ(A,bs,rvals,1,&col,a,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),959,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
960 | col++; | |||
961 | a += bs; | |||
962 | } | |||
963 | } | |||
964 | } | |||
965 | ierr = PetscFree(rvals)((*PetscTrFree)((void*)(rvals),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((rvals) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),965,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
966 | ierr = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),966,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
967 | ierr = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),967,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
968 | /* | |||
969 | Everyone has to call to draw the matrix since the graphics waits are | |||
970 | synchronized across all processors that share the PetscDraw object | |||
971 | */ | |||
972 | ierr = PetscViewerGetSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),972,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
973 | ierr = PetscObjectGetName((PetscObject)mat,&matname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),973,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
974 | if (!rank) { | |||
975 | ierr = PetscObjectSetName((PetscObject)((Mat_MPISBAIJ*)(A->data))->A,matname);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),975,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
976 | ierr = MatView_SeqSBAIJ(((Mat_MPISBAIJ*)(A->data))->A,sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),976,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
977 | } | |||
978 | ierr = PetscViewerRestoreSubViewer(viewer,PETSC_COMM_SELF((MPI_Comm)0x44000001),&sviewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),978,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
979 | ierr = PetscViewerFlush(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),979,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
980 | ierr = MatDestroy(&A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),980,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
981 | } | |||
982 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
983 | } | |||
984 | ||||
985 | static PetscErrorCode MatView_MPISBAIJ_Binary(Mat mat,PetscViewer viewer) | |||
986 | { | |||
987 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)mat->data; | |||
988 | Mat_SeqSBAIJ *A = (Mat_SeqSBAIJ*)a->A->data; | |||
989 | Mat_SeqBAIJ *B = (Mat_SeqBAIJ*)a->B->data; | |||
990 | PetscErrorCode ierr; | |||
991 | PetscInt i,*row_lens,*crow_lens,bs = mat->rmap->bs,j,k,bs2=a->bs2,header[4],nz,rlen; | |||
992 | PetscInt *range=0,nzmax,*column_indices,cnt,col,*garray = a->garray,cstart = mat->cmap->rstart/bs,len,pcnt,l,ll; | |||
993 | int fd; | |||
994 | PetscScalar *column_values; | |||
995 | FILE *file; | |||
996 | PetscMPIInt rank,size,tag = ((PetscObject)viewer)->tag; | |||
997 | PetscInt message_count,flowcontrolcount; | |||
998 | ||||
999 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 999; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1000 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)mat),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1000,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1001 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)mat),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1001,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1002 | nz = bs2*(A->nz + B->nz); | |||
1003 | rlen = mat->rmap->n; | |||
1004 | ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1004,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1005 | if (!rank) { | |||
1006 | header[0] = MAT_FILE_CLASSID1211216; | |||
1007 | header[1] = mat->rmap->N; | |||
1008 | header[2] = mat->cmap->N; | |||
1009 | ||||
1010 | ierr = MPI_Reduce(&nz,&header[3],1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1010,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1011 | ierr = PetscBinaryWrite(fd,header,4,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1012 | /* get largest number of rows any processor has */ | |||
1013 | range = mat->rmap->range; | |||
1014 | for (i=1; i<size; i++) { | |||
1015 | rlen = PetscMax(rlen,range[i+1] - range[i])(((rlen)<(range[i+1] - range[i])) ? (range[i+1] - range[i] ) : (rlen)); | |||
1016 | } | |||
1017 | } else { | |||
1018 | ierr = MPI_Reduce(&nz,0,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1018,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1019 | } | |||
1020 | ||||
1021 | ierr = PetscMalloc1(rlen/bs,&crow_lens)PetscMallocA(1,PETSC_FALSE,1021,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(rlen/bs)*sizeof(**(&crow_lens)),(&crow_lens ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1021,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1022 | /* compute lengths of each row */ | |||
1023 | for (i=0; i<a->mbs; i++) { | |||
1024 | crow_lens[i] = A->i[i+1] - A->i[i] + B->i[i+1] - B->i[i]; | |||
1025 | } | |||
1026 | /* store the row lengths to the file */ | |||
1027 | ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1027,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1028 | if (!rank) { | |||
1029 | MPI_Status status; | |||
1030 | ierr = PetscMalloc1(rlen,&row_lens)PetscMallocA(1,PETSC_FALSE,1030,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(rlen)*sizeof(**(&row_lens)),(&row_lens));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1030,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1031 | rlen = (range[1] - range[0])/bs; | |||
1032 | for (i=0; i<rlen; i++) { | |||
1033 | for (j=0; j<bs; j++) { | |||
1034 | row_lens[i*bs+j] = bs*crow_lens[i]; | |||
1035 | } | |||
1036 | } | |||
1037 | ierr = PetscBinaryWrite(fd,row_lens,bs*rlen,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1037,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1038 | for (i=1; i<size; i++) { | |||
1039 | rlen = (range[i+1] - range[i])/bs; | |||
1040 | ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1040,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1041 | ierr = MPI_Recv(crow_lens,rlen,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),(rlen),(((MPI_Datatype)0x4c000405))) || MPI_Recv((crow_lens ),(rlen),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm ((PetscObject)mat)),(&status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1041,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1042 | for (k=0; k<rlen; k++) { | |||
1043 | for (j=0; j<bs; j++) { | |||
1044 | row_lens[k*bs+j] = bs*crow_lens[k]; | |||
1045 | } | |||
1046 | } | |||
1047 | ierr = PetscBinaryWrite(fd,row_lens,bs*rlen,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1047,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1048 | } | |||
1049 | ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1049,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1050 | ierr = PetscFree(row_lens)((*PetscTrFree)((void*)(row_lens),1050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((row_lens) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1050,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1051 | } else { | |||
1052 | ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1052,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1053 | ierr = MPI_Send(crow_lens,mat->rmap->n/bs,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(mat->rmap->n/bs),(((MPI_Datatype)0x4c000405))) || MPI_Send ((crow_lens),(mat->rmap->n/bs),(((MPI_Datatype)0x4c000405 )),(0),(tag),(PetscObjectComm((PetscObject)mat))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1053,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1054 | ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1054,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1055 | } | |||
1056 | ierr = PetscFree(crow_lens)((*PetscTrFree)((void*)(crow_lens),1056,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((crow_lens) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1056,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1057 | ||||
1058 | /* load up the local column indices. Include for all rows not just one for each block row since process 0 does not have the | |||
1059 | information needed to make it for each row from a block row. This does require more communication but still not more than | |||
1060 | the communication needed for the nonzero values */ | |||
1061 | nzmax = nz; /* space a largest processor needs */ | |||
1062 | ierr = MPI_Reduce(&nz,&nzmax,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_MAX(MPI_Op)(0x58000001),0,PetscObjectComm((PetscObject)mat));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1062,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1063 | ierr = PetscMalloc1(nzmax,&column_indices)PetscMallocA(1,PETSC_FALSE,1063,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(nzmax)*sizeof(**(&column_indices)),(&column_indices ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1063,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1064 | cnt = 0; | |||
1065 | for (i=0; i<a->mbs; i++) { | |||
1066 | pcnt = cnt; | |||
1067 | for (j=B->i[i]; j<B->i[i+1]; j++) { | |||
1068 | if ((col = garray[B->j[j]]) > cstart) break; | |||
1069 | for (l=0; l<bs; l++) { | |||
1070 | column_indices[cnt++] = bs*col+l; | |||
1071 | } | |||
1072 | } | |||
1073 | for (k=A->i[i]; k<A->i[i+1]; k++) { | |||
1074 | for (l=0; l<bs; l++) { | |||
1075 | column_indices[cnt++] = bs*(A->j[k] + cstart)+l; | |||
1076 | } | |||
1077 | } | |||
1078 | for (; j<B->i[i+1]; j++) { | |||
1079 | for (l=0; l<bs; l++) { | |||
1080 | column_indices[cnt++] = bs*garray[B->j[j]]+l; | |||
1081 | } | |||
1082 | } | |||
1083 | len = cnt - pcnt; | |||
1084 | for (k=1; k<bs; k++) { | |||
1085 | ierr = PetscMemcpy(&column_indices[cnt],&column_indices[pcnt],len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1085,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1086 | cnt += len; | |||
1087 | } | |||
1088 | } | |||
1089 | if (cnt != nz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_LIB,"Internal PETSc error: cnt = %D nz = %D",cnt,nz)return PetscError(((MPI_Comm)0x44000001),1089,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,76,PETSC_ERROR_INITIAL,"Internal PETSc error: cnt = %D nz = %D" ,cnt,nz); | |||
1090 | ||||
1091 | /* store the columns to the file */ | |||
1092 | ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1092,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1093 | if (!rank) { | |||
1094 | MPI_Status status; | |||
1095 | ierr = PetscBinaryWrite(fd,column_indices,nz,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1095,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1096 | for (i=1; i<size; i++) { | |||
1097 | ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1097,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1098 | ierr = MPI_Recv(&cnt,1,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),(1),(((MPI_Datatype)0x4c000405))) || MPI_Recv((&cnt),(1 ),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm((PetscObject )mat)),(&status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1098,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1099 | ierr = MPI_Recv(column_indices,cnt,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),(cnt),(((MPI_Datatype)0x4c000405))) || MPI_Recv((column_indices ),(cnt),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm ((PetscObject)mat)),(&status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1099,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1100 | ierr = PetscBinaryWrite(fd,column_indices,cnt,PETSC_INT,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1100,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1101 | } | |||
1102 | ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1102,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1103 | } else { | |||
1104 | ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1104,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1105 | ierr = MPI_Send(&cnt,1,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || MPI_Send((&cnt),(1 ),(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm((PetscObject )mat))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1105,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1106 | ierr = MPI_Send(column_indices,cnt,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(cnt),(((MPI_Datatype)0x4c000405))) || MPI_Send((column_indices ),(cnt),(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm ((PetscObject)mat))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1106,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1107 | ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1107,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1108 | } | |||
1109 | ierr = PetscFree(column_indices)((*PetscTrFree)((void*)(column_indices),1109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((column_indices) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1110 | ||||
1111 | /* load up the numerical values */ | |||
1112 | ierr = PetscMalloc1(nzmax,&column_values)PetscMallocA(1,PETSC_FALSE,1112,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(nzmax)*sizeof(**(&column_values)),(&column_values ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1112,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1113 | cnt = 0; | |||
1114 | for (i=0; i<a->mbs; i++) { | |||
1115 | rlen = bs*(B->i[i+1] - B->i[i] + A->i[i+1] - A->i[i]); | |||
1116 | for (j=B->i[i]; j<B->i[i+1]; j++) { | |||
1117 | if (garray[B->j[j]] > cstart) break; | |||
1118 | for (l=0; l<bs; l++) { | |||
1119 | for (ll=0; ll<bs; ll++) { | |||
1120 | column_values[cnt + l*rlen + ll] = B->a[bs2*j+l+bs*ll]; | |||
1121 | } | |||
1122 | } | |||
1123 | cnt += bs; | |||
1124 | } | |||
1125 | for (k=A->i[i]; k<A->i[i+1]; k++) { | |||
1126 | for (l=0; l<bs; l++) { | |||
1127 | for (ll=0; ll<bs; ll++) { | |||
1128 | column_values[cnt + l*rlen + ll] = A->a[bs2*k+l+bs*ll]; | |||
1129 | } | |||
1130 | } | |||
1131 | cnt += bs; | |||
1132 | } | |||
1133 | for (; j<B->i[i+1]; j++) { | |||
1134 | for (l=0; l<bs; l++) { | |||
1135 | for (ll=0; ll<bs; ll++) { | |||
1136 | column_values[cnt + l*rlen + ll] = B->a[bs2*j+l+bs*ll]; | |||
1137 | } | |||
1138 | } | |||
1139 | cnt += bs; | |||
1140 | } | |||
1141 | cnt += (bs-1)*rlen; | |||
1142 | } | |||
1143 | if (cnt != nz) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_PLIB,"Internal PETSc error: cnt = %D nz = %D",cnt,nz)return PetscError(((MPI_Comm)0x44000001),1143,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,77,PETSC_ERROR_INITIAL,"Internal PETSc error: cnt = %D nz = %D" ,cnt,nz); | |||
1144 | ||||
1145 | /* store the column values to the file */ | |||
1146 | ierr = PetscViewerFlowControlStart(viewer,&message_count,&flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1146,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1147 | if (!rank) { | |||
1148 | MPI_Status status; | |||
1149 | ierr = PetscBinaryWrite(fd,column_values,nz,PETSC_SCALARPETSC_DOUBLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1149,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1150 | for (i=1; i<size; i++) { | |||
1151 | ierr = PetscViewerFlowControlStepMaster(viewer,i,&message_count,flowcontrolcount);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1151,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1152 | ierr = MPI_Recv(&cnt,1,MPIU_INT,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),(1),(((MPI_Datatype)0x4c000405))) || MPI_Recv((&cnt),(1 ),(((MPI_Datatype)0x4c000405)),(i),(tag),(PetscObjectComm((PetscObject )mat)),(&status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1152,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1153 | ierr = MPI_Recv(column_values,cnt,MPIU_SCALAR,i,tag,PetscObjectComm((PetscObject)mat),&status)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),(cnt),(((MPI_Datatype)0x4c00080b))) || MPI_Recv((column_values ),(cnt),(((MPI_Datatype)0x4c00080b)),(i),(tag),(PetscObjectComm ((PetscObject)mat)),(&status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1153,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1154 | ierr = PetscBinaryWrite(fd,column_values,cnt,PETSC_SCALARPETSC_DOUBLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1154,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1155 | } | |||
1156 | ierr = PetscViewerFlowControlEndMaster(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1156,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1157 | } else { | |||
1158 | ierr = PetscViewerFlowControlStepWorker(viewer,rank,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1158,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1159 | ierr = MPI_Send(&nz,1,MPIU_INT,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(1),(((MPI_Datatype)0x4c000405))) || MPI_Send((&nz),(1) ,(((MPI_Datatype)0x4c000405)),(0),(tag),(PetscObjectComm((PetscObject )mat))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1160 | ierr = MPI_Send(column_values,nz,MPIU_SCALAR,0,tag,PetscObjectComm((PetscObject)mat))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(nz),(((MPI_Datatype)0x4c00080b))) || MPI_Send((column_values ),(nz),(((MPI_Datatype)0x4c00080b)),(0),(tag),(PetscObjectComm ((PetscObject)mat))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1160,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1161 | ierr = PetscViewerFlowControlEndWorker(viewer,&message_count);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1162 | } | |||
1163 | ierr = PetscFree(column_values)((*PetscTrFree)((void*)(column_values),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((column_values) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1163,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1164 | ||||
1165 | ierr = PetscViewerBinaryGetInfoPointer(viewer,&file);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1166 | if (file) { | |||
1167 | fprintf(file,"-matload_block_size %d\n",(int)mat->rmap->bs); | |||
1168 | } | |||
1169 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1170 | } | |||
1171 | ||||
1172 | PetscErrorCode MatView_MPISBAIJ(Mat mat,PetscViewer viewer) | |||
1173 | { | |||
1174 | PetscErrorCode ierr; | |||
1175 | PetscBool iascii,isdraw,issocket,isbinary; | |||
1176 | ||||
1177 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1177; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1178 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII"ascii",&iascii);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1179 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERDRAW"draw",&isdraw);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1180 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSOCKET"socket",&issocket);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1180,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1181 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1181,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1182 | if (iascii || isdraw || issocket) { | |||
1183 | ierr = MatView_MPISBAIJ_ASCIIorDraworSocket(mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1184 | } else if (isbinary) { | |||
1185 | ierr = MatView_MPISBAIJ_Binary(mat,viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1185,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1186 | } | |||
1187 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1188 | } | |||
1189 | ||||
1190 | PetscErrorCode MatDestroy_MPISBAIJ(Mat mat) | |||
1191 | { | |||
1192 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
1193 | PetscErrorCode ierr; | |||
1194 | ||||
1195 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1195; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1196 | #if defined(PETSC_USE_LOG1) | |||
1197 | PetscLogObjectState((PetscObject)mat,"Rows=%D,Cols=%D",mat->rmap->N,mat->cmap->N); | |||
1198 | #endif | |||
1199 | ierr = MatStashDestroy_Private(&mat->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1199,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1200 | ierr = MatStashDestroy_Private(&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1201 | ierr = MatDestroy(&baij->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1201,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1202 | ierr = MatDestroy(&baij->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1202,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1203 | #if defined(PETSC_USE_CTABLE1) | |||
1204 | ierr = PetscTableDestroy(&baij->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1205 | #else | |||
1206 | ierr = PetscFree(baij->colmap)((*PetscTrFree)((void*)(baij->colmap),1206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->colmap) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1206,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1207 | #endif | |||
1208 | ierr = PetscFree(baij->garray)((*PetscTrFree)((void*)(baij->garray),1208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->garray) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1208,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1209 | ierr = VecDestroy(&baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1209,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1210 | ierr = VecScatterDestroy(&baij->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1210,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1211 | ierr = VecDestroy(&baij->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1211,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1212 | ierr = VecDestroy(&baij->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1212,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1213 | ierr = VecDestroy(&baij->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1213,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1214 | ierr = VecDestroy(&baij->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1214,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1215 | ierr = VecDestroy(&baij->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1215,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1216 | ierr = VecScatterDestroy(&baij->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1217 | ierr = PetscFree2(baij->rowvalues,baij->rowindices)PetscFreeA(2,1217,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,&(baij->rowvalues),&(baij->rowindices));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1217,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1218 | ierr = PetscFree(baij->barray)((*PetscTrFree)((void*)(baij->barray),1218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->barray) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1219 | ierr = PetscFree(baij->hd)((*PetscTrFree)((void*)(baij->hd),1219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->hd) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1220 | ierr = VecDestroy(&baij->diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1220,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1221 | ierr = VecDestroy(&baij->bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1222 | ierr = VecDestroy(&baij->xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1222,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1223 | #if defined(PETSC_USE_REAL_MAT_SINGLE) | |||
1224 | ierr = PetscFree(baij->setvaluescopy)((*PetscTrFree)((void*)(baij->setvaluescopy),1224,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->setvaluescopy) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1224,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1225 | #endif | |||
1226 | ierr = PetscFree(baij->in_loc)((*PetscTrFree)((void*)(baij->in_loc),1226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->in_loc) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1227 | ierr = PetscFree(baij->v_loc)((*PetscTrFree)((void*)(baij->v_loc),1227,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->v_loc) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1227,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1228 | ierr = PetscFree(baij->rangebs)((*PetscTrFree)((void*)(baij->rangebs),1228,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((baij->rangebs) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1228,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1229 | ierr = PetscFree(mat->data)((*PetscTrFree)((void*)(mat->data),1229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((mat->data) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1229,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1230 | ||||
1231 | ierr = PetscObjectChangeTypeName((PetscObject)mat,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1231,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1232 | ierr = PetscObjectComposeFunction((PetscObject)mat,"MatStoreValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatStoreValues_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1233 | ierr = PetscObjectComposeFunction((PetscObject)mat,"MatRetrieveValues_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatRetrieveValues_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1233,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1234 | ierr = PetscObjectComposeFunction((PetscObject)mat,"MatMPISBAIJSetPreallocation_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatMPISBAIJSetPreallocation_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1235 | #if defined(PETSC_HAVE_ELEMENTAL) | |||
1236 | ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_elemental_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_elemental_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1236,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1237 | #endif | |||
1238 | ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_mpiaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_mpiaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1238,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1239 | ierr = PetscObjectComposeFunction((PetscObject)mat,"MatConvert_mpisbaij_mpibaij_C",NULL)PetscObjectComposeFunction_Private((PetscObject)mat,"MatConvert_mpisbaij_mpibaij_C" ,(PetscVoidFunction)(((void*)0)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1239,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1240 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1241 | } | |||
1242 | ||||
1243 | PetscErrorCode MatMult_MPISBAIJ_Hermitian(Mat A,Vec xx,Vec yy) | |||
1244 | { | |||
1245 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1246 | PetscErrorCode ierr; | |||
1247 | PetscInt nt,mbs=a->mbs,bs=A->rmap->bs; | |||
1248 | PetscScalar *from; | |||
1249 | const PetscScalar *x; | |||
1250 | ||||
1251 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1251; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1252 | ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1252,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1253 | if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1253,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx"); | |||
1254 | ||||
1255 | /* diagonal part */ | |||
1256 | ierr = (*a->A->ops->mult)(a->A,xx,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1256,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1257 | ierr = VecSet(a->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1257,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1258 | ||||
1259 | /* subdiagonal part */ | |||
1260 | ierr = (*a->B->ops->multhermitiantranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1260,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1261 | ||||
1262 | /* copy x into the vec slvec0 */ | |||
1263 | ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1263,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1264 | ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1265 | ||||
1266 | ierr = PetscMemcpy(from,x,bs*mbs*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1266,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1267 | ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1267,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1268 | ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1268,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1269 | ||||
1270 | ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1270,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1271 | ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1271,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1272 | /* supperdiagonal part */ | |||
1273 | ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1273,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1274 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1275 | } | |||
1276 | ||||
1277 | PetscErrorCode MatMult_MPISBAIJ(Mat A,Vec xx,Vec yy) | |||
1278 | { | |||
1279 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1280 | PetscErrorCode ierr; | |||
1281 | PetscInt nt,mbs=a->mbs,bs=A->rmap->bs; | |||
1282 | PetscScalar *from; | |||
1283 | const PetscScalar *x; | |||
1284 | ||||
1285 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1285; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1286 | ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1286,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1287 | if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1287,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx"); | |||
1288 | ||||
1289 | /* diagonal part */ | |||
1290 | ierr = (*a->A->ops->mult)(a->A,xx,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1290,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1291 | ierr = VecSet(a->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1291,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1292 | ||||
1293 | /* subdiagonal part */ | |||
1294 | ierr = (*a->B->ops->multtranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1294,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1295 | ||||
1296 | /* copy x into the vec slvec0 */ | |||
1297 | ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1298 | ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1298,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1299 | ||||
1300 | ierr = PetscMemcpy(from,x,bs*mbs*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1300,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1301 | ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1302 | ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1302,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1303 | ||||
1304 | ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1305 | ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1305,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1306 | /* supperdiagonal part */ | |||
1307 | ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1307,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1308 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1309 | } | |||
1310 | ||||
1311 | PetscErrorCode MatMult_MPISBAIJ_2comm(Mat A,Vec xx,Vec yy) | |||
1312 | { | |||
1313 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1314 | PetscErrorCode ierr; | |||
1315 | PetscInt nt; | |||
1316 | ||||
1317 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1317; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1318 | ierr = VecGetLocalSize(xx,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1318,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1319 | if (nt != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible partition of A and xx")return PetscError(((MPI_Comm)0x44000001),1319,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,60,PETSC_ERROR_INITIAL,"Incompatible partition of A and xx"); | |||
1320 | ||||
1321 | ierr = VecGetLocalSize(yy,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1321,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1322 | if (nt != A->rmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Incompatible parition of A and yy")return PetscError(((MPI_Comm)0x44000001),1322,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,60,PETSC_ERROR_INITIAL,"Incompatible parition of A and yy"); | |||
1323 | ||||
1324 | ierr = VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1324,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1325 | /* do diagonal part */ | |||
1326 | ierr = (*a->A->ops->mult)(a->A,xx,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1326,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1327 | /* do supperdiagonal part */ | |||
1328 | ierr = VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1328,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1329 | ierr = (*a->B->ops->multadd)(a->B,a->lvec,yy,yy);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1330 | /* do subdiagonal part */ | |||
1331 | ierr = (*a->B->ops->multtranspose)(a->B,xx,a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1331,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1332 | ierr = VecScatterBegin(a->Mvctx,a->lvec,yy,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1332,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1333 | ierr = VecScatterEnd(a->Mvctx,a->lvec,yy,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1333,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1334 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1335 | } | |||
1336 | ||||
1337 | PetscErrorCode MatMultAdd_MPISBAIJ(Mat A,Vec xx,Vec yy,Vec zz) | |||
1338 | { | |||
1339 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1340 | PetscErrorCode ierr; | |||
1341 | PetscInt mbs=a->mbs,bs=A->rmap->bs; | |||
1342 | PetscScalar *from,zero=0.0; | |||
1343 | const PetscScalar *x; | |||
1344 | ||||
1345 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1345; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1346 | /* | |||
1347 | PetscSynchronizedPrintf(PetscObjectComm((PetscObject)A)," MatMultAdd is called ...\n"); | |||
1348 | PetscSynchronizedFlush(PetscObjectComm((PetscObject)A),PETSC_STDOUT); | |||
1349 | */ | |||
1350 | /* diagonal part */ | |||
1351 | ierr = (*a->A->ops->multadd)(a->A,xx,yy,a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1351,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1352 | ierr = VecSet(a->slvec1b,zero);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1352,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1353 | ||||
1354 | /* subdiagonal part */ | |||
1355 | ierr = (*a->B->ops->multtranspose)(a->B,xx,a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1355,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1356 | ||||
1357 | /* copy x into the vec slvec0 */ | |||
1358 | ierr = VecGetArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1358,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1359 | ierr = VecGetArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1359,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1360 | ierr = PetscMemcpy(from,x,bs*mbs*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1361 | ierr = VecRestoreArray(a->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1362 | ||||
1363 | ierr = VecScatterBegin(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1364 | ierr = VecRestoreArrayRead(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1364,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1365 | ierr = VecScatterEnd(a->sMvctx,a->slvec0,a->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1365,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1366 | ||||
1367 | /* supperdiagonal part */ | |||
1368 | ierr = (*a->B->ops->multadd)(a->B,a->slvec1b,a->slvec1a,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1368,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1369 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1370 | } | |||
1371 | ||||
1372 | PetscErrorCode MatMultAdd_MPISBAIJ_2comm(Mat A,Vec xx,Vec yy,Vec zz) | |||
1373 | { | |||
1374 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1375 | PetscErrorCode ierr; | |||
1376 | ||||
1377 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1377; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1378 | ierr = VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1378,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1379 | /* do diagonal part */ | |||
1380 | ierr = (*a->A->ops->multadd)(a->A,xx,yy,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1380,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1381 | /* do supperdiagonal part */ | |||
1382 | ierr = VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1382,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1383 | ierr = (*a->B->ops->multadd)(a->B,a->lvec,zz,zz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1383,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1384 | ||||
1385 | /* do subdiagonal part */ | |||
1386 | ierr = (*a->B->ops->multtranspose)(a->B,xx,a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1386,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1387 | ierr = VecScatterBegin(a->Mvctx,a->lvec,zz,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1387,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1388 | ierr = VecScatterEnd(a->Mvctx,a->lvec,zz,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1388,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1389 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1390 | } | |||
1391 | ||||
1392 | /* | |||
1393 | This only works correctly for square matrices where the subblock A->A is the | |||
1394 | diagonal block | |||
1395 | */ | |||
1396 | PetscErrorCode MatGetDiagonal_MPISBAIJ(Mat A,Vec v) | |||
1397 | { | |||
1398 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1399 | PetscErrorCode ierr; | |||
1400 | ||||
1401 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1401; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1402 | /* if (a->rmap->N != a->cmap->N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Supports only square matrix where A->A is diag block"); */ | |||
1403 | ierr = MatGetDiagonal(a->A,v);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1403,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1404 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1405 | } | |||
1406 | ||||
1407 | PetscErrorCode MatScale_MPISBAIJ(Mat A,PetscScalar aa) | |||
1408 | { | |||
1409 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1410 | PetscErrorCode ierr; | |||
1411 | ||||
1412 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1412; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1413 | ierr = MatScale(a->A,aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1413,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1414 | ierr = MatScale(a->B,aa);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1414,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1415 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1416 | } | |||
1417 | ||||
1418 | PetscErrorCode MatGetRow_MPISBAIJ(Mat matin,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v) | |||
1419 | { | |||
1420 | Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data; | |||
1421 | PetscScalar *vworkA,*vworkB,**pvA,**pvB,*v_p; | |||
1422 | PetscErrorCode ierr; | |||
1423 | PetscInt bs = matin->rmap->bs,bs2 = mat->bs2,i,*cworkA,*cworkB,**pcA,**pcB; | |||
1424 | PetscInt nztot,nzA,nzB,lrow,brstart = matin->rmap->rstart,brend = matin->rmap->rend; | |||
1425 | PetscInt *cmap,*idx_p,cstart = mat->rstartbs; | |||
1426 | ||||
1427 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1427; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1428 | if (mat->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Already active")return PetscError(((MPI_Comm)0x44000001),1428,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"Already active"); | |||
1429 | mat->getrowactive = PETSC_TRUE; | |||
1430 | ||||
1431 | if (!mat->rowvalues && (idx || v)) { | |||
1432 | /* | |||
1433 | allocate enough space to hold information from the longest row. | |||
1434 | */ | |||
1435 | Mat_SeqSBAIJ *Aa = (Mat_SeqSBAIJ*)mat->A->data; | |||
1436 | Mat_SeqBAIJ *Ba = (Mat_SeqBAIJ*)mat->B->data; | |||
1437 | PetscInt max = 1,mbs = mat->mbs,tmp; | |||
1438 | for (i=0; i<mbs; i++) { | |||
1439 | tmp = Aa->i[i+1] - Aa->i[i] + Ba->i[i+1] - Ba->i[i]; /* row length */ | |||
1440 | if (max < tmp) max = tmp; | |||
1441 | } | |||
1442 | ierr = PetscMalloc2(max*bs2,&mat->rowvalues,max*bs2,&mat->rowindices)PetscMallocA(2,PETSC_FALSE,1442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(max*bs2)*sizeof(**(&mat->rowvalues)),(&mat ->rowvalues),(size_t)(max*bs2)*sizeof(**(&mat->rowindices )),(&mat->rowindices));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1442,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1443 | } | |||
1444 | ||||
1445 | if (row < brstart || row >= brend) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only local rows")return PetscError(((MPI_Comm)0x44000001),1445,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Only local rows"); | |||
1446 | lrow = row - brstart; /* local row index */ | |||
1447 | ||||
1448 | pvA = &vworkA; pcA = &cworkA; pvB = &vworkB; pcB = &cworkB; | |||
1449 | if (!v) {pvA = 0; pvB = 0;} | |||
1450 | if (!idx) {pcA = 0; if (!v) pcB = 0;} | |||
1451 | ierr = (*mat->A->ops->getrow)(mat->A,lrow,&nzA,pcA,pvA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1451,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1452 | ierr = (*mat->B->ops->getrow)(mat->B,lrow,&nzB,pcB,pvB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1452,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1453 | nztot = nzA + nzB; | |||
1454 | ||||
1455 | cmap = mat->garray; | |||
1456 | if (v || idx) { | |||
1457 | if (nztot) { | |||
1458 | /* Sort by increasing column numbers, assuming A and B already sorted */ | |||
1459 | PetscInt imark = -1; | |||
1460 | if (v) { | |||
1461 | *v = v_p = mat->rowvalues; | |||
1462 | for (i=0; i<nzB; i++) { | |||
1463 | if (cmap[cworkB[i]/bs] < cstart) v_p[i] = vworkB[i]; | |||
1464 | else break; | |||
1465 | } | |||
1466 | imark = i; | |||
1467 | for (i=0; i<nzA; i++) v_p[imark+i] = vworkA[i]; | |||
1468 | for (i=imark; i<nzB; i++) v_p[nzA+i] = vworkB[i]; | |||
1469 | } | |||
1470 | if (idx) { | |||
1471 | *idx = idx_p = mat->rowindices; | |||
1472 | if (imark > -1) { | |||
1473 | for (i=0; i<imark; i++) { | |||
1474 | idx_p[i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs; | |||
1475 | } | |||
1476 | } else { | |||
1477 | for (i=0; i<nzB; i++) { | |||
1478 | if (cmap[cworkB[i]/bs] < cstart) idx_p[i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs; | |||
1479 | else break; | |||
1480 | } | |||
1481 | imark = i; | |||
1482 | } | |||
1483 | for (i=0; i<nzA; i++) idx_p[imark+i] = cstart*bs + cworkA[i]; | |||
1484 | for (i=imark; i<nzB; i++) idx_p[nzA+i] = cmap[cworkB[i]/bs]*bs + cworkB[i]%bs ; | |||
1485 | } | |||
1486 | } else { | |||
1487 | if (idx) *idx = 0; | |||
1488 | if (v) *v = 0; | |||
1489 | } | |||
1490 | } | |||
1491 | *nz = nztot; | |||
1492 | ierr = (*mat->A->ops->restorerow)(mat->A,lrow,&nzA,pcA,pvA);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1492,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1493 | ierr = (*mat->B->ops->restorerow)(mat->B,lrow,&nzB,pcB,pvB);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1493,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1494 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1495 | } | |||
1496 | ||||
1497 | PetscErrorCode MatRestoreRow_MPISBAIJ(Mat mat,PetscInt row,PetscInt *nz,PetscInt **idx,PetscScalar **v) | |||
1498 | { | |||
1499 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
1500 | ||||
1501 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1501; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1502 | if (!baij->getrowactive) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"MatGetRow() must be called first")return PetscError(((MPI_Comm)0x44000001),1502,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"MatGetRow() must be called first"); | |||
1503 | baij->getrowactive = PETSC_FALSE; | |||
1504 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1505 | } | |||
1506 | ||||
1507 | PetscErrorCode MatGetRowUpperTriangular_MPISBAIJ(Mat A) | |||
1508 | { | |||
1509 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1510 | Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data; | |||
1511 | ||||
1512 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1512; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1513 | aA->getrow_utriangular = PETSC_TRUE; | |||
1514 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1515 | } | |||
1516 | PetscErrorCode MatRestoreRowUpperTriangular_MPISBAIJ(Mat A) | |||
1517 | { | |||
1518 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1519 | Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data; | |||
1520 | ||||
1521 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1521; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1522 | aA->getrow_utriangular = PETSC_FALSE; | |||
1523 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1524 | } | |||
1525 | ||||
1526 | PetscErrorCode MatRealPart_MPISBAIJ(Mat A) | |||
1527 | { | |||
1528 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1529 | PetscErrorCode ierr; | |||
1530 | ||||
1531 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1531; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1532 | ierr = MatRealPart(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1532,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1533 | ierr = MatRealPart(a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1533,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1534 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1535 | } | |||
1536 | ||||
1537 | PetscErrorCode MatImaginaryPart_MPISBAIJ(Mat A) | |||
1538 | { | |||
1539 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1540 | PetscErrorCode ierr; | |||
1541 | ||||
1542 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1542; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1543 | ierr = MatImaginaryPart(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1543,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1544 | ierr = MatImaginaryPart(a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1544,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1545 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1546 | } | |||
1547 | ||||
1548 | /* Check if isrow is a subset of iscol_local, called by MatCreateSubMatrix_MPISBAIJ() | |||
1549 | Input: isrow - distributed(parallel), | |||
1550 | iscol_local - locally owned (seq) | |||
1551 | */ | |||
1552 | PetscErrorCode ISEqual_private(IS isrow,IS iscol_local,PetscBool *flg) | |||
1553 | { | |||
1554 | PetscErrorCode ierr; | |||
1555 | PetscInt sz1,sz2,*a1,*a2,i,j,k,nmatch; | |||
1556 | const PetscInt *ptr1,*ptr2; | |||
1557 | ||||
1558 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1558; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1559 | ierr = ISGetLocalSize(isrow,&sz1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1559,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1560 | ierr = ISGetLocalSize(iscol_local,&sz2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1560,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1561 | if (sz1 > sz2) { | |||
1562 | *flg = PETSC_FALSE; | |||
1563 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1564 | } | |||
1565 | ||||
1566 | ierr = ISGetIndices(isrow,&ptr1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1566,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1567 | ierr = ISGetIndices(iscol_local,&ptr2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1567,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1568 | ||||
1569 | ierr = PetscMalloc1(sz1,&a1)PetscMallocA(1,PETSC_FALSE,1569,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(sz1)*sizeof(**(&a1)),(&a1));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1569,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1570 | ierr = PetscMalloc1(sz2,&a2)PetscMallocA(1,PETSC_FALSE,1570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(sz2)*sizeof(**(&a2)),(&a2));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1570,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1571 | ierr = PetscMemcpy(a1,ptr1,sz1*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1571,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1572 | ierr = PetscMemcpy(a2,ptr2,sz2*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1572,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1573 | ierr = PetscSortInt(sz1,a1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1573,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1574 | ierr = PetscSortInt(sz2,a2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1574,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1575 | ||||
1576 | nmatch=0; | |||
1577 | k = 0; | |||
1578 | for (i=0; i<sz1; i++){ | |||
1579 | for (j=k; j<sz2; j++){ | |||
1580 | if (a1[i] == a2[j]) { | |||
1581 | k = j; nmatch++; | |||
1582 | break; | |||
1583 | } | |||
1584 | } | |||
1585 | } | |||
1586 | ierr = ISRestoreIndices(isrow,&ptr1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1586,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1587 | ierr = ISRestoreIndices(iscol_local,&ptr2);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1587,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1588 | ierr = PetscFree(a1)((*PetscTrFree)((void*)(a1),1588,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((a1) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1588,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1589 | ierr = PetscFree(a2)((*PetscTrFree)((void*)(a2),1589,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((a2) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1589,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1590 | if (nmatch < sz1) { | |||
1591 | *flg = PETSC_FALSE; | |||
1592 | } else { | |||
1593 | *flg = PETSC_TRUE; | |||
1594 | } | |||
1595 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1596 | } | |||
1597 | ||||
1598 | PetscErrorCode MatCreateSubMatrix_MPISBAIJ(Mat mat,IS isrow,IS iscol,MatReuse call,Mat *newmat) | |||
1599 | { | |||
1600 | PetscErrorCode ierr; | |||
1601 | IS iscol_local; | |||
1602 | PetscInt csize; | |||
1603 | PetscBool isequal; | |||
1604 | ||||
1605 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1605; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1606 | ierr = ISGetLocalSize(iscol,&csize);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1606,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1607 | if (call == MAT_REUSE_MATRIX) { | |||
1608 | ierr = PetscObjectQuery((PetscObject)*newmat,"ISAllGather",(PetscObject*)&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1609 | if (!iscol_local) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Submatrix passed in was not used before, cannot reuse")return PetscError(((MPI_Comm)0x44000001),1609,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"Submatrix passed in was not used before, cannot reuse" ); | |||
1610 | } else { | |||
1611 | ierr = ISAllGather(iscol,&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1611,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1612 | ierr = ISEqual_private(isrow,iscol_local,&isequal);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1613 | if (!isequal) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"For symmetric format, iscol must equal isrow")return PetscError(((MPI_Comm)0x44000001),1613,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,75,PETSC_ERROR_INITIAL,"For symmetric format, iscol must equal isrow" ); | |||
1614 | } | |||
1615 | ||||
1616 | /* now call MatCreateSubMatrix_MPIBAIJ() */ | |||
1617 | ierr = MatCreateSubMatrix_MPIBAIJ_Private(mat,isrow,iscol_local,csize,call,newmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1617,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1618 | if (call == MAT_INITIAL_MATRIX) { | |||
1619 | ierr = PetscObjectCompose((PetscObject)*newmat,"ISAllGather",(PetscObject)iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1619,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1620 | ierr = ISDestroy(&iscol_local);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1620,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1621 | } | |||
1622 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1623 | } | |||
1624 | ||||
1625 | PetscErrorCode MatZeroEntries_MPISBAIJ(Mat A) | |||
1626 | { | |||
1627 | Mat_MPISBAIJ *l = (Mat_MPISBAIJ*)A->data; | |||
1628 | PetscErrorCode ierr; | |||
1629 | ||||
1630 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1630; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1631 | ierr = MatZeroEntries(l->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1632 | ierr = MatZeroEntries(l->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1633 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1634 | } | |||
1635 | ||||
1636 | PetscErrorCode MatGetInfo_MPISBAIJ(Mat matin,MatInfoType flag,MatInfo *info) | |||
1637 | { | |||
1638 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)matin->data; | |||
1639 | Mat A = a->A,B = a->B; | |||
1640 | PetscErrorCode ierr; | |||
1641 | PetscReal isend[5],irecv[5]; | |||
1642 | ||||
1643 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1643; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1644 | info->block_size = (PetscReal)matin->rmap->bs; | |||
1645 | ||||
1646 | ierr = MatGetInfo(A,MAT_LOCAL,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1646,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1647 | ||||
1648 | isend[0] = info->nz_used; isend[1] = info->nz_allocated; isend[2] = info->nz_unneeded; | |||
1649 | isend[3] = info->memory; isend[4] = info->mallocs; | |||
1650 | ||||
1651 | ierr = MatGetInfo(B,MAT_LOCAL,info);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1651,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1652 | ||||
1653 | isend[0] += info->nz_used; isend[1] += info->nz_allocated; isend[2] += info->nz_unneeded; | |||
1654 | isend[3] += info->memory; isend[4] += info->mallocs; | |||
1655 | if (flag == MAT_LOCAL) { | |||
1656 | info->nz_used = isend[0]; | |||
1657 | info->nz_allocated = isend[1]; | |||
1658 | info->nz_unneeded = isend[2]; | |||
1659 | info->memory = isend[3]; | |||
1660 | info->mallocs = isend[4]; | |||
1661 | } else if (flag == MAT_GLOBAL_MAX) { | |||
1662 | ierr = MPIU_Allreduce(isend,irecv,5,MPIU_REAL,MPIU_MAX,PetscObjectComm((PetscObject)matin))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)matin ),5,1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)matin))),0) || MPI_Allreduce((isend),(irecv),(5 ),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000001)),(PetscObjectComm ((PetscObject)matin)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1662,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1663 | ||||
1664 | info->nz_used = irecv[0]; | |||
1665 | info->nz_allocated = irecv[1]; | |||
1666 | info->nz_unneeded = irecv[2]; | |||
1667 | info->memory = irecv[3]; | |||
1668 | info->mallocs = irecv[4]; | |||
1669 | } else if (flag == MAT_GLOBAL_SUM) { | |||
1670 | ierr = MPIU_Allreduce(isend,irecv,5,MPIU_REAL,MPIU_SUM,PetscObjectComm((PetscObject)matin))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)matin ),5,1670,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)matin))),0) || MPI_Allreduce((isend),(irecv),(5 ),(((MPI_Datatype)0x4c00080b)),((MPI_Op)(0x58000003)),(PetscObjectComm ((PetscObject)matin)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1670,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1671 | ||||
1672 | info->nz_used = irecv[0]; | |||
1673 | info->nz_allocated = irecv[1]; | |||
1674 | info->nz_unneeded = irecv[2]; | |||
1675 | info->memory = irecv[3]; | |||
1676 | info->mallocs = irecv[4]; | |||
1677 | } else SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Unknown MatInfoType argument %d",(int)flag)return PetscError(((MPI_Comm)0x44000001),1677,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Unknown MatInfoType argument %d",(int )flag); | |||
1678 | info->fill_ratio_given = 0; /* no parallel LU/ILU/Cholesky */ | |||
1679 | info->fill_ratio_needed = 0; | |||
1680 | info->factor_mallocs = 0; | |||
1681 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1682 | } | |||
1683 | ||||
1684 | PetscErrorCode MatSetOption_MPISBAIJ(Mat A,MatOption op,PetscBool flg) | |||
1685 | { | |||
1686 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1687 | Mat_SeqSBAIJ *aA = (Mat_SeqSBAIJ*)a->A->data; | |||
1688 | PetscErrorCode ierr; | |||
1689 | ||||
1690 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1690; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1691 | switch (op) { | |||
1692 | case MAT_NEW_NONZERO_LOCATIONS: | |||
1693 | case MAT_NEW_NONZERO_ALLOCATION_ERR: | |||
1694 | case MAT_UNUSED_NONZERO_LOCATION_ERR: | |||
1695 | case MAT_KEEP_NONZERO_PATTERN: | |||
1696 | case MAT_SUBMAT_SINGLEIS: | |||
1697 | case MAT_NEW_NONZERO_LOCATION_ERR: | |||
1698 | MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return PetscError(((MPI_Comm)0x44000001),1698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()" ,(1),"A",__func__); } while (0); | |||
1699 | ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1699,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1700 | ierr = MatSetOption(a->B,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1700,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1701 | break; | |||
1702 | case MAT_ROW_ORIENTED: | |||
1703 | MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return PetscError(((MPI_Comm)0x44000001),1703,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()" ,(1),"A",__func__); } while (0); | |||
1704 | a->roworiented = flg; | |||
1705 | ||||
1706 | ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1706,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1707 | ierr = MatSetOption(a->B,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1707,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1708 | break; | |||
1709 | case MAT_NEW_DIAGONALS: | |||
1710 | ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions [op]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1710,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1711 | break; | |||
1712 | case MAT_IGNORE_OFF_PROC_ENTRIES: | |||
1713 | a->donotstash = flg; | |||
1714 | break; | |||
1715 | case MAT_USE_HASH_TABLE: | |||
1716 | a->ht_flag = flg; | |||
1717 | break; | |||
1718 | case MAT_HERMITIAN: | |||
1719 | MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return PetscError(((MPI_Comm)0x44000001),1719,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()" ,(1),"A",__func__); } while (0); | |||
1720 | if (!A->assembled) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONGSTATE,"Must call MatAssemblyEnd() first")return PetscError(((MPI_Comm)0x44000001),1720,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"Must call MatAssemblyEnd() first"); | |||
1721 | ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1721,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1722 | #if defined(PETSC_USE_COMPLEX) | |||
1723 | A->ops->mult = MatMult_MPISBAIJ_Hermitian; | |||
1724 | #endif | |||
1725 | break; | |||
1726 | case MAT_SPD: | |||
1727 | A->spd_set = PETSC_TRUE; | |||
1728 | A->spd = flg; | |||
1729 | if (flg) { | |||
1730 | A->symmetric = PETSC_TRUE; | |||
1731 | A->structurally_symmetric = PETSC_TRUE; | |||
1732 | A->symmetric_set = PETSC_TRUE; | |||
1733 | A->structurally_symmetric_set = PETSC_TRUE; | |||
1734 | } | |||
1735 | break; | |||
1736 | case MAT_SYMMETRIC: | |||
1737 | MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return PetscError(((MPI_Comm)0x44000001),1737,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()" ,(1),"A",__func__); } while (0); | |||
1738 | ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1738,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1739 | break; | |||
1740 | case MAT_STRUCTURALLY_SYMMETRIC: | |||
1741 | MatCheckPreallocated(A,1)do { if (__builtin_expect(!!(!(A)->preallocated),0)) return PetscError(((MPI_Comm)0x44000001),1741,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"Must call MatXXXSetPreallocation() or MatSetUp() on argument %D \"%s\" before %s()" ,(1),"A",__func__); } while (0); | |||
1742 | ierr = MatSetOption(a->A,op,flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1742,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1743 | break; | |||
1744 | case MAT_SYMMETRY_ETERNAL: | |||
1745 | if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Matrix must be symmetric")return PetscError(((MPI_Comm)0x44000001),1745,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Matrix must be symmetric"); | |||
1746 | ierr = PetscInfo1(A,"Option %s ignored\n",MatOptions[op])PetscInfo_Private(__func__,A,"Option %s ignored\n",MatOptions [op]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1747 | break; | |||
1748 | case MAT_IGNORE_LOWER_TRIANGULAR: | |||
1749 | aA->ignore_ltriangular = flg; | |||
1750 | break; | |||
1751 | case MAT_ERROR_LOWER_TRIANGULAR: | |||
1752 | aA->ignore_ltriangular = flg; | |||
1753 | break; | |||
1754 | case MAT_GETROW_UPPERTRIANGULAR: | |||
1755 | aA->getrow_utriangular = flg; | |||
1756 | break; | |||
1757 | default: | |||
1758 | SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"unknown option %d",op)return PetscError(((MPI_Comm)0x44000001),1758,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"unknown option %d",op); | |||
1759 | } | |||
1760 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1761 | } | |||
1762 | ||||
1763 | PetscErrorCode MatTranspose_MPISBAIJ(Mat A,MatReuse reuse,Mat *B) | |||
1764 | { | |||
1765 | PetscErrorCode ierr; | |||
1766 | ||||
1767 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1767; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1768 | if (reuse == MAT_INITIAL_MATRIX) { | |||
1769 | ierr = MatDuplicate(A,MAT_COPY_VALUES,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1769,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1770 | } else if (reuse == MAT_REUSE_MATRIX) { | |||
1771 | ierr = MatCopy(A,*B,SAME_NONZERO_PATTERN);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1771,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1772 | } | |||
1773 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1774 | } | |||
1775 | ||||
1776 | PetscErrorCode MatDiagonalScale_MPISBAIJ(Mat mat,Vec ll,Vec rr) | |||
1777 | { | |||
1778 | Mat_MPISBAIJ *baij = (Mat_MPISBAIJ*)mat->data; | |||
1779 | Mat a = baij->A, b=baij->B; | |||
1780 | PetscErrorCode ierr; | |||
1781 | PetscInt nv,m,n; | |||
1782 | PetscBool flg; | |||
1783 | ||||
1784 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1784; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1785 | if (ll != rr) { | |||
1786 | ierr = VecEqual(ll,rr,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1786,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1787 | if (!flg) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"For symmetric format, left and right scaling vectors must be same\n")return PetscError(((MPI_Comm)0x44000001),1787,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"For symmetric format, left and right scaling vectors must be same\n" ); | |||
1788 | } | |||
1789 | if (!ll) PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1790 | ||||
1791 | ierr = MatGetLocalSize(mat,&m,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1791,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1792 | if (m != n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"For symmetric format, local size %d %d must be same",m,n)return PetscError(((MPI_Comm)0x44000001),1792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,60,PETSC_ERROR_INITIAL,"For symmetric format, local size %d %d must be same" ,m,n); | |||
1793 | ||||
1794 | ierr = VecGetLocalSize(rr,&nv);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1794,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1795 | if (nv!=n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Left and right vector non-conforming local size")return PetscError(((MPI_Comm)0x44000001),1795,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,60,PETSC_ERROR_INITIAL,"Left and right vector non-conforming local size" ); | |||
1796 | ||||
1797 | ierr = VecScatterBegin(baij->Mvctx,rr,baij->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1797,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1798 | ||||
1799 | /* left diagonalscale the off-diagonal part */ | |||
1800 | ierr = (*b->ops->diagonalscale)(b,ll,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1800,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1801 | ||||
1802 | /* scale the diagonal part */ | |||
1803 | ierr = (*a->ops->diagonalscale)(a,ll,rr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1803,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1804 | ||||
1805 | /* right diagonalscale the off-diagonal part */ | |||
1806 | ierr = VecScatterEnd(baij->Mvctx,rr,baij->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1806,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1807 | ierr = (*b->ops->diagonalscale)(b,NULL((void*)0),baij->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1808 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1809 | } | |||
1810 | ||||
1811 | PetscErrorCode MatSetUnfactored_MPISBAIJ(Mat A) | |||
1812 | { | |||
1813 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1814 | PetscErrorCode ierr; | |||
1815 | ||||
1816 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1816; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1817 | ierr = MatSetUnfactored(a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1817,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1818 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1819 | } | |||
1820 | ||||
1821 | static PetscErrorCode MatDuplicate_MPISBAIJ(Mat,MatDuplicateOption,Mat*); | |||
1822 | ||||
1823 | PetscErrorCode MatEqual_MPISBAIJ(Mat A,Mat B,PetscBool *flag) | |||
1824 | { | |||
1825 | Mat_MPISBAIJ *matB = (Mat_MPISBAIJ*)B->data,*matA = (Mat_MPISBAIJ*)A->data; | |||
1826 | Mat a,b,c,d; | |||
1827 | PetscBool flg; | |||
1828 | PetscErrorCode ierr; | |||
1829 | ||||
1830 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1830; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1831 | a = matA->A; b = matA->B; | |||
1832 | c = matB->A; d = matB->B; | |||
1833 | ||||
1834 | ierr = MatEqual(a,c,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1834,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1835 | if (flg) { | |||
1836 | ierr = MatEqual(b,d,&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1836,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1837 | } | |||
1838 | ierr = MPIU_Allreduce(&flg,flag,1,MPIU_BOOL,MPI_LAND,PetscObjectComm((PetscObject)A))(PetscAllreduceBarrierCheck(PetscObjectComm((PetscObject)A),1 ,1838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)A))),0) || MPI_Allreduce((&flg),(flag),(1), (MPIU_BOOL),((MPI_Op)(0x58000005)),(PetscObjectComm((PetscObject )A)))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1839 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1840 | } | |||
1841 | ||||
1842 | PetscErrorCode MatCopy_MPISBAIJ(Mat A,Mat B,MatStructure str) | |||
1843 | { | |||
1844 | PetscErrorCode ierr; | |||
1845 | PetscBool isbaij; | |||
1846 | ||||
1847 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1847; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1848 | ierr = PetscObjectTypeCompareAny((PetscObject)B,&isbaij,MATSEQSBAIJ"seqsbaij",MATMPISBAIJ"mpisbaij","");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1848,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1849 | if (!isbaij) SETERRQ1(PetscObjectComm((PetscObject)B),PETSC_ERR_SUP,"Not for matrix type %s",((PetscObject)B)->type_name)return PetscError(PetscObjectComm((PetscObject)B),1849,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Not for matrix type %s",((PetscObject )B)->type_name); | |||
1850 | /* If the two matrices don't have the same copy implementation, they aren't compatible for fast copy. */ | |||
1851 | if ((str != SAME_NONZERO_PATTERN) || (A->ops->copy != B->ops->copy)) { | |||
1852 | ierr = MatGetRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1852,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1853 | ierr = MatCopy_Basic(A,B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1853,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1854 | ierr = MatRestoreRowUpperTriangular(A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1854,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1855 | } else { | |||
1856 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1857 | Mat_MPISBAIJ *b = (Mat_MPISBAIJ*)B->data; | |||
1858 | ||||
1859 | ierr = MatCopy(a->A,b->A,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1859,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1860 | ierr = MatCopy(a->B,b->B,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1860,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1861 | } | |||
1862 | ierr = PetscObjectStateIncrease((PetscObject)B)(((PetscObject)B)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1862,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1863 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1864 | } | |||
1865 | ||||
1866 | PetscErrorCode MatSetUp_MPISBAIJ(Mat A) | |||
1867 | { | |||
1868 | PetscErrorCode ierr; | |||
1869 | ||||
1870 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1870; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1871 | ierr = MatMPISBAIJSetPreallocation(A,A->rmap->bs,PETSC_DEFAULT-2,0,PETSC_DEFAULT-2,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1871,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1872 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1873 | } | |||
1874 | ||||
1875 | PetscErrorCode MatAXPY_MPISBAIJ(Mat Y,PetscScalar a,Mat X,MatStructure str) | |||
1876 | { | |||
1877 | PetscErrorCode ierr; | |||
1878 | Mat_MPISBAIJ *xx=(Mat_MPISBAIJ*)X->data,*yy=(Mat_MPISBAIJ*)Y->data; | |||
1879 | PetscBLASInt bnz,one=1; | |||
1880 | Mat_SeqSBAIJ *xa,*ya; | |||
1881 | Mat_SeqBAIJ *xb,*yb; | |||
1882 | ||||
1883 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1883; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1884 | if (str == SAME_NONZERO_PATTERN) { | |||
1885 | PetscScalar alpha = a; | |||
1886 | xa = (Mat_SeqSBAIJ*)xx->A->data; | |||
1887 | ya = (Mat_SeqSBAIJ*)yy->A->data; | |||
1888 | ierr = PetscBLASIntCast(xa->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1888,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1889 | PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,xa->a,&one,ya->a,&one))do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "BLASaxpy"; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1889; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); daxpy_(&bnz,&alpha,xa->a,&one,ya->a,&one ); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(1889 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),1889,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
1890 | xb = (Mat_SeqBAIJ*)xx->B->data; | |||
1891 | yb = (Mat_SeqBAIJ*)yy->B->data; | |||
1892 | ierr = PetscBLASIntCast(xb->nz,&bnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1892,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1893 | PetscStackCallBLAS("BLASaxpy",BLASaxpy_(&bnz,&alpha,xb->a,&one,yb->a,&one))do { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = "BLASaxpy"; petscstack->file[petscstack->currentsize ] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1893; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_TRUE || petscstack->hotdepth); } ; } while (0); daxpy_(&bnz,&alpha,xb->a,&one,yb->a,&one ); do { do {PetscErrorCode _7_ierr = PetscMallocValidate(1893 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" );do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError( ((MPI_Comm)0x44000001),1893,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0);} while(0); do { ; if (petscstack && petscstack->currentsize > 0 ) { petscstack->currentsize--; petscstack->function[petscstack ->currentsize] = 0; petscstack->file[petscstack->currentsize ] = 0; petscstack->line[petscstack->currentsize] = 0; petscstack ->petscroutine[petscstack->currentsize] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack-> hotdepth-1)<(0)) ? (0) : (petscstack->hotdepth-1)); } ; } while (0); } while (0); } while(0); | |||
1894 | ierr = PetscObjectStateIncrease((PetscObject)Y)(((PetscObject)Y)->state++,0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1894,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1895 | } else if (str == SUBSET_NONZERO_PATTERN) { /* nonzeros of X is a subset of Y's */ | |||
1896 | ierr = MatSetOption(X,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1896,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1897 | ierr = MatAXPY_Basic(Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1897,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1898 | ierr = MatSetOption(X,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1898,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1899 | } else { | |||
1900 | Mat B; | |||
1901 | PetscInt *nnz_d,*nnz_o,bs=Y->rmap->bs; | |||
1902 | if (bs != X->rmap->bs) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"Matrices must have same block size")return PetscError(((MPI_Comm)0x44000001),1902,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,60,PETSC_ERROR_INITIAL,"Matrices must have same block size"); | |||
1903 | ierr = MatGetRowUpperTriangular(X);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1903,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1904 | ierr = MatGetRowUpperTriangular(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1904,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1905 | ierr = PetscMalloc1(yy->A->rmap->N,&nnz_d)PetscMallocA(1,PETSC_FALSE,1905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(yy->A->rmap->N)*sizeof(**(&nnz_d)),(& nnz_d));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1906 | ierr = PetscMalloc1(yy->B->rmap->N,&nnz_o)PetscMallocA(1,PETSC_FALSE,1906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(yy->B->rmap->N)*sizeof(**(&nnz_o)),(& nnz_o));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1906,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1907 | ierr = MatCreate(PetscObjectComm((PetscObject)Y),&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1907,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1908 | ierr = PetscObjectSetName((PetscObject)B,((PetscObject)Y)->name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1908,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1909 | ierr = MatSetSizes(B,Y->rmap->n,Y->cmap->n,Y->rmap->N,Y->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1909,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1910 | ierr = MatSetBlockSizesFromMats(B,Y,Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1910,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1911 | ierr = MatSetType(B,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1911,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1912 | ierr = MatAXPYGetPreallocation_SeqSBAIJ(yy->A,xx->A,nnz_d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1912,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1913 | ierr = MatAXPYGetPreallocation_MPIBAIJ(yy->B,yy->garray,xx->B,xx->garray,nnz_o);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1913,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1914 | ierr = MatMPISBAIJSetPreallocation(B,bs,0,nnz_d,0,nnz_o);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1914,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1915 | ierr = MatAXPY_BasicWithPreallocation(B,Y,a,X,str);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1915,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1916 | ierr = MatHeaderReplace(Y,&B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1916,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1917 | ierr = PetscFree(nnz_d)((*PetscTrFree)((void*)(nnz_d),1917,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((nnz_d) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1917,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1918 | ierr = PetscFree(nnz_o)((*PetscTrFree)((void*)(nnz_o),1918,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((nnz_o) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1918,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1919 | ierr = MatRestoreRowUpperTriangular(X);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1919,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1920 | ierr = MatRestoreRowUpperTriangular(Y);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1920,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1921 | } | |||
1922 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1923 | } | |||
1924 | ||||
1925 | PetscErrorCode MatCreateSubMatrices_MPISBAIJ(Mat A,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *B[]) | |||
1926 | { | |||
1927 | PetscErrorCode ierr; | |||
1928 | PetscInt i; | |||
1929 | PetscBool flg; | |||
1930 | ||||
1931 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1931; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1932 | ierr = MatCreateSubMatrices_MPIBAIJ(A,n,irow,icol,scall,B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1932,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); /* B[] are sbaij matrices */ | |||
1933 | for (i=0; i<n; i++) { | |||
1934 | ierr = ISEqual(irow[i],icol[i],&flg);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1934,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1935 | if (!flg) { | |||
1936 | ierr = MatSeqSBAIJZeroOps_Private(*B[i]);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1936,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1937 | } | |||
1938 | } | |||
1939 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1940 | } | |||
1941 | ||||
1942 | PetscErrorCode MatShift_MPISBAIJ(Mat Y,PetscScalar a) | |||
1943 | { | |||
1944 | PetscErrorCode ierr; | |||
1945 | Mat_MPISBAIJ *maij = (Mat_MPISBAIJ*)Y->data; | |||
1946 | Mat_SeqSBAIJ *aij = (Mat_SeqSBAIJ*)maij->A->data; | |||
1947 | ||||
1948 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1948; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1949 | if (!Y->preallocated) { | |||
1950 | ierr = MatMPISBAIJSetPreallocation(Y,Y->rmap->bs,1,NULL((void*)0),0,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1951 | } else if (!aij->nz) { | |||
1952 | PetscInt nonew = aij->nonew; | |||
1953 | ierr = MatSeqSBAIJSetPreallocation(maij->A,Y->rmap->bs,1,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1953,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1954 | aij->nonew = nonew; | |||
1955 | } | |||
1956 | ierr = MatShift_Basic(Y,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1956,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1957 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1958 | } | |||
1959 | ||||
1960 | PetscErrorCode MatMissingDiagonal_MPISBAIJ(Mat A,PetscBool *missing,PetscInt *d) | |||
1961 | { | |||
1962 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
1963 | PetscErrorCode ierr; | |||
1964 | ||||
1965 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1965; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1966 | if (A->rmap->n != A->cmap->n) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Only works for square matrices")return PetscError(((MPI_Comm)0x44000001),1966,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Only works for square matrices"); | |||
1967 | ierr = MatMissingDiagonal(a->A,missing,d);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1967,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1968 | if (d) { | |||
1969 | PetscInt rstart; | |||
1970 | ierr = MatGetOwnershipRange(A,&rstart,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),1970,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
1971 | *d += rstart/A->rmap->bs; | |||
1972 | ||||
1973 | } | |||
1974 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1975 | } | |||
1976 | ||||
1977 | PetscErrorCode MatGetDiagonalBlock_MPISBAIJ(Mat A,Mat *a) | |||
1978 | { | |||
1979 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 1979; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
1980 | *a = ((Mat_MPISBAIJ*)A->data)->A; | |||
1981 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
1982 | } | |||
1983 | ||||
1984 | /* -------------------------------------------------------------------*/ | |||
1985 | static struct _MatOps MatOps_Values = {MatSetValues_MPISBAIJ, | |||
1986 | MatGetRow_MPISBAIJ, | |||
1987 | MatRestoreRow_MPISBAIJ, | |||
1988 | MatMult_MPISBAIJ, | |||
1989 | /* 4*/ MatMultAdd_MPISBAIJ, | |||
1990 | MatMult_MPISBAIJ, /* transpose versions are same as non-transpose */ | |||
1991 | MatMultAdd_MPISBAIJ, | |||
1992 | 0, | |||
1993 | 0, | |||
1994 | 0, | |||
1995 | /* 10*/ 0, | |||
1996 | 0, | |||
1997 | 0, | |||
1998 | MatSOR_MPISBAIJ, | |||
1999 | MatTranspose_MPISBAIJ, | |||
2000 | /* 15*/ MatGetInfo_MPISBAIJ, | |||
2001 | MatEqual_MPISBAIJ, | |||
2002 | MatGetDiagonal_MPISBAIJ, | |||
2003 | MatDiagonalScale_MPISBAIJ, | |||
2004 | MatNorm_MPISBAIJ, | |||
2005 | /* 20*/ MatAssemblyBegin_MPISBAIJ, | |||
2006 | MatAssemblyEnd_MPISBAIJ, | |||
2007 | MatSetOption_MPISBAIJ, | |||
2008 | MatZeroEntries_MPISBAIJ, | |||
2009 | /* 24*/ 0, | |||
2010 | 0, | |||
2011 | 0, | |||
2012 | 0, | |||
2013 | 0, | |||
2014 | /* 29*/ MatSetUp_MPISBAIJ, | |||
2015 | 0, | |||
2016 | 0, | |||
2017 | MatGetDiagonalBlock_MPISBAIJ, | |||
2018 | 0, | |||
2019 | /* 34*/ MatDuplicate_MPISBAIJ, | |||
2020 | 0, | |||
2021 | 0, | |||
2022 | 0, | |||
2023 | 0, | |||
2024 | /* 39*/ MatAXPY_MPISBAIJ, | |||
2025 | MatCreateSubMatrices_MPISBAIJ, | |||
2026 | MatIncreaseOverlap_MPISBAIJ, | |||
2027 | MatGetValues_MPISBAIJ, | |||
2028 | MatCopy_MPISBAIJ, | |||
2029 | /* 44*/ 0, | |||
2030 | MatScale_MPISBAIJ, | |||
2031 | MatShift_MPISBAIJ, | |||
2032 | 0, | |||
2033 | 0, | |||
2034 | /* 49*/ 0, | |||
2035 | 0, | |||
2036 | 0, | |||
2037 | 0, | |||
2038 | 0, | |||
2039 | /* 54*/ 0, | |||
2040 | 0, | |||
2041 | MatSetUnfactored_MPISBAIJ, | |||
2042 | 0, | |||
2043 | MatSetValuesBlocked_MPISBAIJ, | |||
2044 | /* 59*/ MatCreateSubMatrix_MPISBAIJ, | |||
2045 | 0, | |||
2046 | 0, | |||
2047 | 0, | |||
2048 | 0, | |||
2049 | /* 64*/ 0, | |||
2050 | 0, | |||
2051 | 0, | |||
2052 | 0, | |||
2053 | 0, | |||
2054 | /* 69*/ MatGetRowMaxAbs_MPISBAIJ, | |||
2055 | 0, | |||
2056 | 0, | |||
2057 | 0, | |||
2058 | 0, | |||
2059 | /* 74*/ 0, | |||
2060 | 0, | |||
2061 | 0, | |||
2062 | 0, | |||
2063 | 0, | |||
2064 | /* 79*/ 0, | |||
2065 | 0, | |||
2066 | 0, | |||
2067 | 0, | |||
2068 | MatLoad_MPISBAIJ, | |||
2069 | /* 84*/ 0, | |||
2070 | 0, | |||
2071 | 0, | |||
2072 | 0, | |||
2073 | 0, | |||
2074 | /* 89*/ 0, | |||
2075 | 0, | |||
2076 | 0, | |||
2077 | 0, | |||
2078 | 0, | |||
2079 | /* 94*/ 0, | |||
2080 | 0, | |||
2081 | 0, | |||
2082 | 0, | |||
2083 | 0, | |||
2084 | /* 99*/ 0, | |||
2085 | 0, | |||
2086 | 0, | |||
2087 | 0, | |||
2088 | 0, | |||
2089 | /*104*/ 0, | |||
2090 | MatRealPart_MPISBAIJ, | |||
2091 | MatImaginaryPart_MPISBAIJ, | |||
2092 | MatGetRowUpperTriangular_MPISBAIJ, | |||
2093 | MatRestoreRowUpperTriangular_MPISBAIJ, | |||
2094 | /*109*/ 0, | |||
2095 | 0, | |||
2096 | 0, | |||
2097 | 0, | |||
2098 | MatMissingDiagonal_MPISBAIJ, | |||
2099 | /*114*/ 0, | |||
2100 | 0, | |||
2101 | 0, | |||
2102 | 0, | |||
2103 | 0, | |||
2104 | /*119*/ 0, | |||
2105 | 0, | |||
2106 | 0, | |||
2107 | 0, | |||
2108 | 0, | |||
2109 | /*124*/ 0, | |||
2110 | 0, | |||
2111 | 0, | |||
2112 | 0, | |||
2113 | 0, | |||
2114 | /*129*/ 0, | |||
2115 | 0, | |||
2116 | 0, | |||
2117 | 0, | |||
2118 | 0, | |||
2119 | /*134*/ 0, | |||
2120 | 0, | |||
2121 | 0, | |||
2122 | 0, | |||
2123 | 0, | |||
2124 | /*139*/ MatSetBlockSizes_Default, | |||
2125 | 0, | |||
2126 | 0, | |||
2127 | 0, | |||
2128 | 0, | |||
2129 | /*144*/MatCreateMPIMatConcatenateSeqMat_MPISBAIJ | |||
2130 | }; | |||
2131 | ||||
2132 | PetscErrorCode MatMPISBAIJSetPreallocation_MPISBAIJ(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt *d_nnz,PetscInt o_nz,const PetscInt *o_nnz) | |||
2133 | { | |||
2134 | Mat_MPISBAIJ *b; | |||
2135 | PetscErrorCode ierr; | |||
2136 | PetscInt i,mbs,Mbs; | |||
2137 | PetscMPIInt size; | |||
2138 | ||||
2139 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 2139; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2140 | ierr = MatSetBlockSize(B,PetscAbs(bs)(((bs) >= 0) ? (bs) : (-(bs))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2140,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2141 | ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2141,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2142 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2142,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2143 | ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2143,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2144 | ||||
2145 | b = (Mat_MPISBAIJ*)B->data; | |||
2146 | mbs = B->rmap->n/bs; | |||
2147 | Mbs = B->rmap->N/bs; | |||
2148 | if (mbs*bs != B->rmap->n) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_SIZ,"No of local rows %D must be divisible by blocksize %D",B->rmap->N,bs)return PetscError(((MPI_Comm)0x44000001),2148,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,60,PETSC_ERROR_INITIAL,"No of local rows %D must be divisible by blocksize %D" ,B->rmap->N,bs); | |||
2149 | ||||
2150 | B->rmap->bs = bs; | |||
2151 | b->bs2 = bs*bs; | |||
2152 | b->mbs = mbs; | |||
2153 | b->Mbs = Mbs; | |||
2154 | b->nbs = B->cmap->n/bs; | |||
2155 | b->Nbs = B->cmap->N/bs; | |||
2156 | ||||
2157 | for (i=0; i<=b->size; i++) { | |||
2158 | b->rangebs[i] = B->rmap->range[i]/bs; | |||
2159 | } | |||
2160 | b->rstartbs = B->rmap->rstart/bs; | |||
2161 | b->rendbs = B->rmap->rend/bs; | |||
2162 | ||||
2163 | b->cstartbs = B->cmap->rstart/bs; | |||
2164 | b->cendbs = B->cmap->rend/bs; | |||
2165 | ||||
2166 | #if defined(PETSC_USE_CTABLE1) | |||
2167 | ierr = PetscTableDestroy(&b->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2167,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2168 | #else | |||
2169 | ierr = PetscFree(b->colmap)((*PetscTrFree)((void*)(b->colmap),2169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((b->colmap) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2169,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2170 | #endif | |||
2171 | ierr = PetscFree(b->garray)((*PetscTrFree)((void*)(b->garray),2171,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((b->garray) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2171,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2172 | ierr = VecDestroy(&b->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2172,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2173 | ierr = VecScatterDestroy(&b->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2173,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2174 | ierr = VecDestroy(&b->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2174,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2175 | ierr = VecDestroy(&b->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2175,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2176 | ierr = VecDestroy(&b->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2177 | ierr = VecDestroy(&b->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2177,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2178 | ierr = VecDestroy(&b->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2178,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2179 | ierr = VecScatterDestroy(&b->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2180 | ||||
2181 | /* Because the B will have been resized we simply destroy it and create a new one each time */ | |||
2182 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2182,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2183 | ierr = MatDestroy(&b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2183,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2184 | ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2184,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2185 | ierr = MatSetSizes(b->B,B->rmap->n,size > 1 ? B->cmap->N : 0,B->rmap->n,size > 1 ? B->cmap->N : 0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2185,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2186 | ierr = MatSetType(b->B,MATSEQBAIJ"seqbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2186,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2187 | ierr = PetscLogObjectParent((PetscObject)B,(PetscObject)b->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2187,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2188 | ||||
2189 | if (!B->preallocated) { | |||
2190 | ierr = MatCreate(PETSC_COMM_SELF((MPI_Comm)0x44000001),&b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2190,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2191 | ierr = MatSetSizes(b->A,B->rmap->n,B->cmap->n,B->rmap->n,B->cmap->n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2192 | ierr = MatSetType(b->A,MATSEQSBAIJ"seqsbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2192,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2193 | ierr = PetscLogObjectParent((PetscObject)B,(PetscObject)b->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2194 | ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)B),bs,&B->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2194,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2195 | } | |||
2196 | ||||
2197 | ierr = MatSeqSBAIJSetPreallocation(b->A,bs,d_nz,d_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2197,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2198 | ierr = MatSeqBAIJSetPreallocation(b->B,bs,o_nz,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2199 | ||||
2200 | B->preallocated = PETSC_TRUE; | |||
2201 | B->was_assembled = PETSC_FALSE; | |||
2202 | B->assembled = PETSC_FALSE; | |||
2203 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2204 | } | |||
2205 | ||||
2206 | PetscErrorCode MatMPISBAIJSetPreallocationCSR_MPISBAIJ(Mat B,PetscInt bs,const PetscInt ii[],const PetscInt jj[],const PetscScalar V[]) | |||
2207 | { | |||
2208 | PetscInt m,rstart,cstart,cend; | |||
2209 | PetscInt i,j,d,nz,nz_max=0,*d_nnz=0,*o_nnz=0; | |||
2210 | const PetscInt *JJ =0; | |||
2211 | PetscScalar *values=0; | |||
2212 | PetscErrorCode ierr; | |||
2213 | ||||
2214 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 2214; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2215 | if (bs < 1) SETERRQ1(PetscObjectComm((PetscObject)B),PETSC_ERR_ARG_OUTOFRANGE,"Invalid block size specified, must be positive but it is %D",bs)return PetscError(PetscObjectComm((PetscObject)B),2215,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Invalid block size specified, must be positive but it is %D" ,bs); | |||
2216 | ierr = PetscLayoutSetBlockSize(B->rmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2217 | ierr = PetscLayoutSetBlockSize(B->cmap,bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2217,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2218 | ierr = PetscLayoutSetUp(B->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2218,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2219 | ierr = PetscLayoutSetUp(B->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2219,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2220 | ierr = PetscLayoutGetBlockSize(B->rmap,&bs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2220,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2221 | m = B->rmap->n/bs; | |||
2222 | rstart = B->rmap->rstart/bs; | |||
2223 | cstart = B->cmap->rstart/bs; | |||
2224 | cend = B->cmap->rend/bs; | |||
2225 | ||||
2226 | if (ii[0]) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"ii[0] must be 0 but it is %D",ii[0])return PetscError(((MPI_Comm)0x44000001),2226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"ii[0] must be 0 but it is %D",ii[0]); | |||
2227 | ierr = PetscMalloc2(m,&d_nnz,m,&o_nnz)PetscMallocA(2,PETSC_FALSE,2227,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(m)*sizeof(**(&d_nnz)),(&d_nnz),(size_t)(m)* sizeof(**(&o_nnz)),(&o_nnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2227,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2228 | for (i=0; i<m; i++) { | |||
2229 | nz = ii[i+1] - ii[i]; | |||
2230 | if (nz < 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Local row %D has a negative number of columns %D",i,nz)return PetscError(((MPI_Comm)0x44000001),2230,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Local row %D has a negative number of columns %D" ,i,nz); | |||
2231 | nz_max = PetscMax(nz_max,nz)(((nz_max)<(nz)) ? (nz) : (nz_max)); | |||
2232 | JJ = jj + ii[i]; | |||
2233 | for (j=0; j<nz; j++) { | |||
2234 | if (*JJ >= cstart) break; | |||
2235 | JJ++; | |||
2236 | } | |||
2237 | d = 0; | |||
2238 | for (; j<nz; j++) { | |||
2239 | if (*JJ++ >= cend) break; | |||
2240 | d++; | |||
2241 | } | |||
2242 | d_nnz[i] = d; | |||
2243 | o_nnz[i] = nz - d; | |||
2244 | } | |||
2245 | ierr = MatMPISBAIJSetPreallocation(B,bs,0,d_nnz,0,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2245,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2246 | ierr = PetscFree2(d_nnz,o_nnz)PetscFreeA(2,2246,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,&(d_nnz),&(o_nnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2246,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2247 | ||||
2248 | values = (PetscScalar*)V; | |||
2249 | if (!values) { | |||
2250 | ierr = PetscMalloc1(bs*bs*nz_max,&values)PetscMallocA(1,PETSC_FALSE,2250,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs*bs*nz_max)*sizeof(**(&values)),(&values) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2250,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2251 | ierr = PetscMemzero(values,bs*bs*nz_max*sizeof(PetscScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2251,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2252 | } | |||
2253 | for (i=0; i<m; i++) { | |||
2254 | PetscInt row = i + rstart; | |||
2255 | PetscInt ncols = ii[i+1] - ii[i]; | |||
2256 | const PetscInt *icols = jj + ii[i]; | |||
2257 | const PetscScalar *svals = values + (V ? (bs*bs*ii[i]) : 0); | |||
2258 | ierr = MatSetValuesBlocked_MPISBAIJ(B,1,&row,ncols,icols,svals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2258,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2259 | } | |||
2260 | ||||
2261 | if (!V) { ierr = PetscFree(values)((*PetscTrFree)((void*)(values),2261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((values) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2261,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); } | |||
2262 | ierr = MatAssemblyBegin(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2262,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2263 | ierr = MatAssemblyEnd(B,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2263,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2264 | ierr = MatSetOption(B,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2264,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2265 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2266 | } | |||
2267 | ||||
2268 | /*MC | |||
2269 | MATMPISBAIJ - MATMPISBAIJ = "mpisbaij" - A matrix type to be used for distributed symmetric sparse block matrices, | |||
2270 | based on block compressed sparse row format. Only the upper triangular portion of the "diagonal" portion of | |||
2271 | the matrix is stored. | |||
2272 | ||||
2273 | For complex numbers by default this matrix is symmetric, NOT Hermitian symmetric. To make it Hermitian symmetric you | |||
2274 | can call MatSetOption(Mat, MAT_HERMITIAN); | |||
2275 | ||||
2276 | Options Database Keys: | |||
2277 | . -mat_type mpisbaij - sets the matrix type to "mpisbaij" during a call to MatSetFromOptions() | |||
2278 | ||||
2279 | Level: beginner | |||
2280 | ||||
2281 | .seealso: MatCreateMPISBAIJ | |||
2282 | M*/ | |||
2283 | ||||
2284 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode MatCreate_MPISBAIJ(Mat B) | |||
2285 | { | |||
2286 | Mat_MPISBAIJ *b; | |||
2287 | PetscErrorCode ierr; | |||
2288 | PetscBool flg = PETSC_FALSE; | |||
2289 | ||||
2290 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 2290; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2291 | ierr = PetscNewLog(B,&b)(PetscMallocA(1,PETSC_TRUE,2291,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(1)*sizeof(**(((&b)))),(((&b)))) || PetscLogObjectMemory ((PetscObject)B,sizeof(**(&b))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2291,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2292 | B->data = (void*)b; | |||
2293 | ierr = PetscMemcpy(B->ops,&MatOps_Values,sizeof(struct _MatOps));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2293,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2294 | ||||
2295 | B->ops->destroy = MatDestroy_MPISBAIJ; | |||
2296 | B->ops->view = MatView_MPISBAIJ; | |||
2297 | B->assembled = PETSC_FALSE; | |||
2298 | B->insertmode = NOT_SET_VALUES; | |||
2299 | ||||
2300 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)B),&b->rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2300,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2301 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)B),&b->size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2301,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2302 | ||||
2303 | /* build local table of row and column ownerships */ | |||
2304 | ierr = PetscMalloc1(b->size+2,&b->rangebs)PetscMallocA(1,PETSC_FALSE,2304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(b->size+2)*sizeof(**(&b->rangebs)),(& b->rangebs));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2304,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2305 | ||||
2306 | /* build cache for off array entries formed */ | |||
2307 | ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)B),1,&B->stash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2307,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2308 | ||||
2309 | b->donotstash = PETSC_FALSE; | |||
2310 | b->colmap = NULL((void*)0); | |||
2311 | b->garray = NULL((void*)0); | |||
2312 | b->roworiented = PETSC_TRUE; | |||
2313 | ||||
2314 | /* stuff used in block assembly */ | |||
2315 | b->barray = 0; | |||
2316 | ||||
2317 | /* stuff used for matrix vector multiply */ | |||
2318 | b->lvec = 0; | |||
2319 | b->Mvctx = 0; | |||
2320 | b->slvec0 = 0; | |||
2321 | b->slvec0b = 0; | |||
2322 | b->slvec1 = 0; | |||
2323 | b->slvec1a = 0; | |||
2324 | b->slvec1b = 0; | |||
2325 | b->sMvctx = 0; | |||
2326 | ||||
2327 | /* stuff for MatGetRow() */ | |||
2328 | b->rowindices = 0; | |||
2329 | b->rowvalues = 0; | |||
2330 | b->getrowactive = PETSC_FALSE; | |||
2331 | ||||
2332 | /* hash table stuff */ | |||
2333 | b->ht = 0; | |||
2334 | b->hd = 0; | |||
2335 | b->ht_size = 0; | |||
2336 | b->ht_flag = PETSC_FALSE; | |||
2337 | b->ht_fact = 0; | |||
2338 | b->ht_total_ct = 0; | |||
2339 | b->ht_insert_ct = 0; | |||
2340 | ||||
2341 | /* stuff for MatCreateSubMatrices_MPIBAIJ_local() */ | |||
2342 | b->ijonly = PETSC_FALSE; | |||
2343 | ||||
2344 | b->in_loc = 0; | |||
2345 | b->v_loc = 0; | |||
2346 | b->n_loc = 0; | |||
2347 | ||||
2348 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatStoreValues_C",MatStoreValues_MPISBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatStoreValues_C" ,(PetscVoidFunction)(MatStoreValues_MPISBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2348,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2349 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatRetrieveValues_C",MatRetrieveValues_MPISBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatRetrieveValues_C" ,(PetscVoidFunction)(MatRetrieveValues_MPISBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2349,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2350 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatMPISBAIJSetPreallocation_C",MatMPISBAIJSetPreallocation_MPISBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMPISBAIJSetPreallocation_C" ,(PetscVoidFunction)(MatMPISBAIJSetPreallocation_MPISBAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2351 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatMPISBAIJSetPreallocationCSR_C",MatMPISBAIJSetPreallocationCSR_MPISBAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatMPISBAIJSetPreallocationCSR_C" ,(PetscVoidFunction)(MatMPISBAIJSetPreallocationCSR_MPISBAIJ) );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2351,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2352 | #if defined(PETSC_HAVE_ELEMENTAL) | |||
2353 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_mpisbaij_elemental_C",MatConvert_MPISBAIJ_Elemental)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_mpisbaij_elemental_C" ,(PetscVoidFunction)(MatConvert_MPISBAIJ_Elemental));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2354 | #endif | |||
2355 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_mpisbaij_mpiaij_C",MatConvert_MPISBAIJ_XAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_mpisbaij_mpiaij_C" ,(PetscVoidFunction)(MatConvert_MPISBAIJ_XAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2355,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2356 | ierr = PetscObjectComposeFunction((PetscObject)B,"MatConvert_mpisbaij_mpibaij_C",MatConvert_MPISBAIJ_XAIJ)PetscObjectComposeFunction_Private((PetscObject)B,"MatConvert_mpisbaij_mpibaij_C" ,(PetscVoidFunction)(MatConvert_MPISBAIJ_XAIJ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2356,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2357 | ||||
2358 | B->symmetric = PETSC_TRUE; | |||
2359 | B->structurally_symmetric = PETSC_TRUE; | |||
2360 | B->symmetric_set = PETSC_TRUE; | |||
2361 | B->structurally_symmetric_set = PETSC_TRUE; | |||
2362 | B->symmetric_eternal = PETSC_TRUE; | |||
2363 | ||||
2364 | B->hermitian = PETSC_FALSE; | |||
2365 | B->hermitian_set = PETSC_FALSE; | |||
2366 | ||||
2367 | ierr = PetscObjectChangeTypeName((PetscObject)B,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2367,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2368 | ierr = PetscOptionsBegin(PetscObjectComm((PetscObject)B),NULL,"Options for loading MPISBAIJ matrix 1","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero (PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject ->count=(PetscOptionsPublish?-1:1); PetscOptionsObject-> count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr = PetscOptionsBegin_Private(PetscOptionsObject,PetscObjectComm ((PetscObject)B),((void*)0),"Options for loading MPISBAIJ matrix 1" ,"Mat");do {if (__builtin_expect(!!(_5_ierr),0)) return PetscError (((MPI_Comm)0x44000001),2368,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2368,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2369 | ierr = PetscOptionsBool("-mat_use_hash_table","Use hash table to save memory in constructing matrix","MatSetOption",flg,&flg,NULL)PetscOptionsBool_Private(PetscOptionsObject,"-mat_use_hash_table" ,"Use hash table to save memory in constructing matrix","MatSetOption" ,flg,&flg,((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2369,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2370 | if (flg) { | |||
2371 | PetscReal fact = 1.39; | |||
2372 | ierr = MatSetOption(B,MAT_USE_HASH_TABLE,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2372,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2373 | ierr = PetscOptionsReal("-mat_use_hash_table","Use hash table factor","MatMPIBAIJSetHashTableFactor",fact,&fact,NULL)PetscOptionsReal_Private(PetscOptionsObject,"-mat_use_hash_table" ,"Use hash table factor","MatMPIBAIJSetHashTableFactor",fact, &fact,((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2373,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2374 | if (fact <= 1.0) fact = 1.39; | |||
2375 | ierr = MatMPIBAIJSetHashTableFactor(B,fact);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2375,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2376 | ierr = PetscInfo1(B,"Hash table Factor used %5.2f\n",fact)PetscInfo_Private(__func__,B,"Hash table Factor used %5.2f\n" ,fact);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2376,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2377 | } | |||
2378 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm )0x44000001),2378,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2378,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2379 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2380 | } | |||
2381 | ||||
2382 | /*MC | |||
2383 | MATSBAIJ - MATSBAIJ = "sbaij" - A matrix type to be used for symmetric block sparse matrices. | |||
2384 | ||||
2385 | This matrix type is identical to MATSEQSBAIJ when constructed with a single process communicator, | |||
2386 | and MATMPISBAIJ otherwise. | |||
2387 | ||||
2388 | Options Database Keys: | |||
2389 | . -mat_type sbaij - sets the matrix type to "sbaij" during a call to MatSetFromOptions() | |||
2390 | ||||
2391 | Level: beginner | |||
2392 | ||||
2393 | .seealso: MatCreateMPISBAIJ,MATSEQSBAIJ,MATMPISBAIJ | |||
2394 | M*/ | |||
2395 | ||||
2396 | /*@C | |||
2397 | MatMPISBAIJSetPreallocation - For good matrix assembly performance | |||
2398 | the user should preallocate the matrix storage by setting the parameters | |||
2399 | d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately, | |||
2400 | performance can be increased by more than a factor of 50. | |||
2401 | ||||
2402 | Collective on Mat | |||
2403 | ||||
2404 | Input Parameters: | |||
2405 | + B - the matrix | |||
2406 | . bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row | |||
2407 | blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() | |||
2408 | . d_nz - number of block nonzeros per block row in diagonal portion of local | |||
2409 | submatrix (same for all local rows) | |||
2410 | . d_nnz - array containing the number of block nonzeros in the various block rows | |||
2411 | in the upper triangular and diagonal part of the in diagonal portion of the local | |||
2412 | (possibly different for each block row) or NULL. If you plan to factor the matrix you must leave room | |||
2413 | for the diagonal entry and set a value even if it is zero. | |||
2414 | . o_nz - number of block nonzeros per block row in the off-diagonal portion of local | |||
2415 | submatrix (same for all local rows). | |||
2416 | - o_nnz - array containing the number of nonzeros in the various block rows of the | |||
2417 | off-diagonal portion of the local submatrix that is right of the diagonal | |||
2418 | (possibly different for each block row) or NULL. | |||
2419 | ||||
2420 | ||||
2421 | Options Database Keys: | |||
2422 | . -mat_no_unroll - uses code that does not unroll the loops in the | |||
2423 | block calculations (much slower) | |||
2424 | . -mat_block_size - size of the blocks to use | |||
2425 | ||||
2426 | Notes: | |||
2427 | ||||
2428 | If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor | |||
2429 | than it must be used on all processors that share the object for that argument. | |||
2430 | ||||
2431 | If the *_nnz parameter is given then the *_nz parameter is ignored | |||
2432 | ||||
2433 | Storage Information: | |||
2434 | For a square global matrix we define each processor's diagonal portion | |||
2435 | to be its local rows and the corresponding columns (a square submatrix); | |||
2436 | each processor's off-diagonal portion encompasses the remainder of the | |||
2437 | local matrix (a rectangular submatrix). | |||
2438 | ||||
2439 | The user can specify preallocated storage for the diagonal part of | |||
2440 | the local submatrix with either d_nz or d_nnz (not both). Set | |||
2441 | d_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic | |||
2442 | memory allocation. Likewise, specify preallocated storage for the | |||
2443 | off-diagonal part of the local submatrix with o_nz or o_nnz (not both). | |||
2444 | ||||
2445 | You can call MatGetInfo() to get information on how effective the preallocation was; | |||
2446 | for example the fields mallocs,nz_allocated,nz_used,nz_unneeded; | |||
2447 | You can also run with the option -info and look for messages with the string | |||
2448 | malloc in them to see if additional memory allocation was needed. | |||
2449 | ||||
2450 | Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In | |||
2451 | the figure below we depict these three local rows and all columns (0-11). | |||
2452 | ||||
2453 | .vb | |||
2454 | 0 1 2 3 4 5 6 7 8 9 10 11 | |||
2455 | -------------------------- | |||
2456 | row 3 |. . . d d d o o o o o o | |||
2457 | row 4 |. . . d d d o o o o o o | |||
2458 | row 5 |. . . d d d o o o o o o | |||
2459 | -------------------------- | |||
2460 | .ve | |||
2461 | ||||
2462 | Thus, any entries in the d locations are stored in the d (diagonal) | |||
2463 | submatrix, and any entries in the o locations are stored in the | |||
2464 | o (off-diagonal) submatrix. Note that the d matrix is stored in | |||
2465 | MatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format. | |||
2466 | ||||
2467 | Now d_nz should indicate the number of block nonzeros per row in the upper triangular | |||
2468 | plus the diagonal part of the d matrix, | |||
2469 | and o_nz should indicate the number of block nonzeros per row in the o matrix | |||
2470 | ||||
2471 | In general, for PDE problems in which most nonzeros are near the diagonal, | |||
2472 | one expects d_nz >> o_nz. For large problems you MUST preallocate memory | |||
2473 | or you will get TERRIBLE performance; see the users' manual chapter on | |||
2474 | matrices. | |||
2475 | ||||
2476 | Level: intermediate | |||
2477 | ||||
2478 | .keywords: matrix, block, aij, compressed row, sparse, parallel | |||
2479 | ||||
2480 | .seealso: MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ(), PetscSplitOwnership() | |||
2481 | @*/ | |||
2482 | PetscErrorCode MatMPISBAIJSetPreallocation(Mat B,PetscInt bs,PetscInt d_nz,const PetscInt d_nnz[],PetscInt o_nz,const PetscInt o_nnz[]) | |||
2483 | { | |||
2484 | PetscErrorCode ierr; | |||
2485 | ||||
2486 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 2486; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2487 | PetscValidHeaderSpecific(B,MAT_CLASSID,1)do { if (!B) return PetscError(((MPI_Comm)0x44000001),2487,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,85,PETSC_ERROR_INITIAL,"Null Object: Parameter # %d",1); if ( !PetscCheckPointer(B,PETSC_OBJECT)) return PetscError(((MPI_Comm )0x44000001),2487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,64,PETSC_ERROR_INITIAL,"Invalid Pointer to Object: Parameter # %d" ,1); if (((PetscObject)(B))->classid != MAT_CLASSID) { if ( ((PetscObject)(B))->classid == -1) return PetscError(((MPI_Comm )0x44000001),2487,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,64,PETSC_ERROR_INITIAL,"Object already free: Parameter # %d" ,1); else return PetscError(((MPI_Comm)0x44000001),2487,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Wrong type of object: Parameter # %d" ,1); } } while (0); | |||
2488 | PetscValidType(B,1)if (!((PetscObject)B)->type_name) return PetscError(((MPI_Comm )0x44000001),2488,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,73,PETSC_ERROR_INITIAL,"%s object's type is not set: Argument # %d" ,((PetscObject)B)->class_name,1);; | |||
2489 | PetscValidLogicalCollectiveInt(B,bs,2)do { PetscErrorCode _7_ierr; PetscInt b1[2],b2[2]; b1[0] = -bs ; b1[1] = bs; _7_ierr = (PetscAllreduceBarrierCheck(PetscObjectComm ((PetscObject)B),2,2489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((PetscObjectComm ((PetscObject)B))),0) || MPI_Allreduce((b1),(b2),(2),(((MPI_Datatype )0x4c000405)),((MPI_Op)(0x58000001)),(PetscObjectComm((PetscObject )B)))));do {if (__builtin_expect(!!(_7_ierr),0)) return PetscError (((MPI_Comm)0x44000001),2489,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_7_ierr,PETSC_ERROR_REPEAT," ");} while (0); if (-b2[0] != b2 [1]) return PetscError(PetscObjectComm((PetscObject)B),2489,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Int value must be same on all processes, argument # %d" ,2); } while (0); | |||
2490 | ierr = PetscTryMethod(B,"MatMPISBAIJSetPreallocation_C",(Mat,PetscInt,PetscInt,const PetscInt[],PetscInt,const PetscInt[]),(B,bs,d_nz,d_nnz,o_nz,o_nnz))0;{ PetscErrorCode (*f)(Mat,PetscInt,PetscInt,const PetscInt[ ],PetscInt,const PetscInt[]), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)B),("MatMPISBAIJSetPreallocation_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),2490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(B,bs,d_nz,d_nnz,o_nz,o_nnz);do {if (__builtin_expect(!! (__ierr),0)) return PetscError(((MPI_Comm)0x44000001),2490,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} };CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2490,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2491 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2492 | } | |||
2493 | ||||
2494 | /*@C | |||
2495 | MatCreateSBAIJ - Creates a sparse parallel matrix in symmetric block AIJ format | |||
2496 | (block compressed row). For good matrix assembly performance | |||
2497 | the user should preallocate the matrix storage by setting the parameters | |||
2498 | d_nz (or d_nnz) and o_nz (or o_nnz). By setting these parameters accurately, | |||
2499 | performance can be increased by more than a factor of 50. | |||
2500 | ||||
2501 | Collective on MPI_Comm | |||
2502 | ||||
2503 | Input Parameters: | |||
2504 | + comm - MPI communicator | |||
2505 | . bs - size of block, the blocks are ALWAYS square. One can use MatSetBlockSizes() to set a different row and column blocksize but the row | |||
2506 | blocksize always defines the size of the blocks. The column blocksize sets the blocksize of the vectors obtained with MatCreateVecs() | |||
2507 | . m - number of local rows (or PETSC_DECIDE to have calculated if M is given) | |||
2508 | This value should be the same as the local size used in creating the | |||
2509 | y vector for the matrix-vector product y = Ax. | |||
2510 | . n - number of local columns (or PETSC_DECIDE to have calculated if N is given) | |||
2511 | This value should be the same as the local size used in creating the | |||
2512 | x vector for the matrix-vector product y = Ax. | |||
2513 | . M - number of global rows (or PETSC_DETERMINE to have calculated if m is given) | |||
2514 | . N - number of global columns (or PETSC_DETERMINE to have calculated if n is given) | |||
2515 | . d_nz - number of block nonzeros per block row in diagonal portion of local | |||
2516 | submatrix (same for all local rows) | |||
2517 | . d_nnz - array containing the number of block nonzeros in the various block rows | |||
2518 | in the upper triangular portion of the in diagonal portion of the local | |||
2519 | (possibly different for each block block row) or NULL. | |||
2520 | If you plan to factor the matrix you must leave room for the diagonal entry and | |||
2521 | set its value even if it is zero. | |||
2522 | . o_nz - number of block nonzeros per block row in the off-diagonal portion of local | |||
2523 | submatrix (same for all local rows). | |||
2524 | - o_nnz - array containing the number of nonzeros in the various block rows of the | |||
2525 | off-diagonal portion of the local submatrix (possibly different for | |||
2526 | each block row) or NULL. | |||
2527 | ||||
2528 | Output Parameter: | |||
2529 | . A - the matrix | |||
2530 | ||||
2531 | Options Database Keys: | |||
2532 | . -mat_no_unroll - uses code that does not unroll the loops in the | |||
2533 | block calculations (much slower) | |||
2534 | . -mat_block_size - size of the blocks to use | |||
2535 | . -mat_mpi - use the parallel matrix data structures even on one processor | |||
2536 | (defaults to using SeqBAIJ format on one processor) | |||
2537 | ||||
2538 | It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(), | |||
2539 | MatXXXXSetPreallocation() paradigm instead of this routine directly. | |||
2540 | [MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation] | |||
2541 | ||||
2542 | Notes: | |||
2543 | The number of rows and columns must be divisible by blocksize. | |||
2544 | This matrix type does not support complex Hermitian operation. | |||
2545 | ||||
2546 | The user MUST specify either the local or global matrix dimensions | |||
2547 | (possibly both). | |||
2548 | ||||
2549 | If PETSC_DECIDE or PETSC_DETERMINE is used for a particular argument on one processor | |||
2550 | than it must be used on all processors that share the object for that argument. | |||
2551 | ||||
2552 | If the *_nnz parameter is given then the *_nz parameter is ignored | |||
2553 | ||||
2554 | Storage Information: | |||
2555 | For a square global matrix we define each processor's diagonal portion | |||
2556 | to be its local rows and the corresponding columns (a square submatrix); | |||
2557 | each processor's off-diagonal portion encompasses the remainder of the | |||
2558 | local matrix (a rectangular submatrix). | |||
2559 | ||||
2560 | The user can specify preallocated storage for the diagonal part of | |||
2561 | the local submatrix with either d_nz or d_nnz (not both). Set | |||
2562 | d_nz=PETSC_DEFAULT and d_nnz=NULL for PETSc to control dynamic | |||
2563 | memory allocation. Likewise, specify preallocated storage for the | |||
2564 | off-diagonal part of the local submatrix with o_nz or o_nnz (not both). | |||
2565 | ||||
2566 | Consider a processor that owns rows 3, 4 and 5 of a parallel matrix. In | |||
2567 | the figure below we depict these three local rows and all columns (0-11). | |||
2568 | ||||
2569 | .vb | |||
2570 | 0 1 2 3 4 5 6 7 8 9 10 11 | |||
2571 | -------------------------- | |||
2572 | row 3 |. . . d d d o o o o o o | |||
2573 | row 4 |. . . d d d o o o o o o | |||
2574 | row 5 |. . . d d d o o o o o o | |||
2575 | -------------------------- | |||
2576 | .ve | |||
2577 | ||||
2578 | Thus, any entries in the d locations are stored in the d (diagonal) | |||
2579 | submatrix, and any entries in the o locations are stored in the | |||
2580 | o (off-diagonal) submatrix. Note that the d matrix is stored in | |||
2581 | MatSeqSBAIJ format and the o submatrix in MATSEQBAIJ format. | |||
2582 | ||||
2583 | Now d_nz should indicate the number of block nonzeros per row in the upper triangular | |||
2584 | plus the diagonal part of the d matrix, | |||
2585 | and o_nz should indicate the number of block nonzeros per row in the o matrix. | |||
2586 | In general, for PDE problems in which most nonzeros are near the diagonal, | |||
2587 | one expects d_nz >> o_nz. For large problems you MUST preallocate memory | |||
2588 | or you will get TERRIBLE performance; see the users' manual chapter on | |||
2589 | matrices. | |||
2590 | ||||
2591 | Level: intermediate | |||
2592 | ||||
2593 | .keywords: matrix, block, aij, compressed row, sparse, parallel | |||
2594 | ||||
2595 | .seealso: MatCreate(), MatCreateSeqSBAIJ(), MatSetValues(), MatCreateBAIJ() | |||
2596 | @*/ | |||
2597 | ||||
2598 | PetscErrorCode MatCreateSBAIJ(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,PetscInt d_nz,const PetscInt d_nnz[],PetscInt o_nz,const PetscInt o_nnz[],Mat *A) | |||
2599 | { | |||
2600 | PetscErrorCode ierr; | |||
2601 | PetscMPIInt size; | |||
2602 | ||||
2603 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 2603; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2604 | ierr = MatCreate(comm,A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2604,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2605 | ierr = MatSetSizes(*A,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2605,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2606 | ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2606,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2607 | if (size > 1) { | |||
2608 | ierr = MatSetType(*A,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2608,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2609 | ierr = MatMPISBAIJSetPreallocation(*A,bs,d_nz,d_nnz,o_nz,o_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2609,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2610 | } else { | |||
2611 | ierr = MatSetType(*A,MATSEQSBAIJ"seqsbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2611,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2612 | ierr = MatSeqSBAIJSetPreallocation(*A,bs,d_nz,d_nnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2612,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2613 | } | |||
2614 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2615 | } | |||
2616 | ||||
2617 | ||||
2618 | static PetscErrorCode MatDuplicate_MPISBAIJ(Mat matin,MatDuplicateOption cpvalues,Mat *newmat) | |||
2619 | { | |||
2620 | Mat mat; | |||
2621 | Mat_MPISBAIJ *a,*oldmat = (Mat_MPISBAIJ*)matin->data; | |||
2622 | PetscErrorCode ierr; | |||
2623 | PetscInt len=0,nt,bs=matin->rmap->bs,mbs=oldmat->mbs; | |||
2624 | PetscScalar *array; | |||
2625 | ||||
2626 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 2626; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2627 | *newmat = 0; | |||
2628 | ||||
2629 | ierr = MatCreate(PetscObjectComm((PetscObject)matin),&mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2629,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2630 | ierr = MatSetSizes(mat,matin->rmap->n,matin->cmap->n,matin->rmap->N,matin->cmap->N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2630,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2631 | ierr = MatSetType(mat,((PetscObject)matin)->type_name);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2631,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2632 | ierr = PetscLayoutReference(matin->rmap,&mat->rmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2632,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2633 | ierr = PetscLayoutReference(matin->cmap,&mat->cmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2633,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2634 | ||||
2635 | mat->factortype = matin->factortype; | |||
2636 | mat->preallocated = PETSC_TRUE; | |||
2637 | mat->assembled = PETSC_TRUE; | |||
2638 | mat->insertmode = NOT_SET_VALUES; | |||
2639 | ||||
2640 | a = (Mat_MPISBAIJ*)mat->data; | |||
2641 | a->bs2 = oldmat->bs2; | |||
2642 | a->mbs = oldmat->mbs; | |||
2643 | a->nbs = oldmat->nbs; | |||
2644 | a->Mbs = oldmat->Mbs; | |||
2645 | a->Nbs = oldmat->Nbs; | |||
2646 | ||||
2647 | a->size = oldmat->size; | |||
2648 | a->rank = oldmat->rank; | |||
2649 | a->donotstash = oldmat->donotstash; | |||
2650 | a->roworiented = oldmat->roworiented; | |||
2651 | a->rowindices = 0; | |||
2652 | a->rowvalues = 0; | |||
2653 | a->getrowactive = PETSC_FALSE; | |||
2654 | a->barray = 0; | |||
2655 | a->rstartbs = oldmat->rstartbs; | |||
2656 | a->rendbs = oldmat->rendbs; | |||
2657 | a->cstartbs = oldmat->cstartbs; | |||
2658 | a->cendbs = oldmat->cendbs; | |||
2659 | ||||
2660 | /* hash table stuff */ | |||
2661 | a->ht = 0; | |||
2662 | a->hd = 0; | |||
2663 | a->ht_size = 0; | |||
2664 | a->ht_flag = oldmat->ht_flag; | |||
2665 | a->ht_fact = oldmat->ht_fact; | |||
2666 | a->ht_total_ct = 0; | |||
2667 | a->ht_insert_ct = 0; | |||
2668 | ||||
2669 | ierr = PetscMemcpy(a->rangebs,oldmat->rangebs,(a->size+2)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2669,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2670 | if (oldmat->colmap) { | |||
2671 | #if defined(PETSC_USE_CTABLE1) | |||
2672 | ierr = PetscTableCreateCopy(oldmat->colmap,&a->colmap);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2672,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2673 | #else | |||
2674 | ierr = PetscMalloc1(a->Nbs,&a->colmap)PetscMallocA(1,PETSC_FALSE,2674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(a->Nbs)*sizeof(**(&a->colmap)),(&a-> colmap));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2674,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2675 | ierr = PetscLogObjectMemory((PetscObject)mat,(a->Nbs)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2675,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2676 | ierr = PetscMemcpy(a->colmap,oldmat->colmap,(a->Nbs)*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2676,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2677 | #endif | |||
2678 | } else a->colmap = 0; | |||
2679 | ||||
2680 | if (oldmat->garray && (len = ((Mat_SeqBAIJ*)(oldmat->B->data))->nbs)) { | |||
2681 | ierr = PetscMalloc1(len,&a->garray)PetscMallocA(1,PETSC_FALSE,2681,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(len)*sizeof(**(&a->garray)),(&a->garray ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2681,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2682 | ierr = PetscLogObjectMemory((PetscObject)mat,len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2682,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2683 | ierr = PetscMemcpy(a->garray,oldmat->garray,len*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2683,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2684 | } else a->garray = 0; | |||
2685 | ||||
2686 | ierr = MatStashCreate_Private(PetscObjectComm((PetscObject)matin),matin->rmap->bs,&mat->bstash);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2686,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2687 | ierr = VecDuplicate(oldmat->lvec,&a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2687,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2688 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->lvec);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2688,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2689 | ierr = VecScatterCopy(oldmat->Mvctx,&a->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2689,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2690 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->Mvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2690,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2691 | ||||
2692 | ierr = VecDuplicate(oldmat->slvec0,&a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2692,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2693 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2693,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2694 | ierr = VecDuplicate(oldmat->slvec1,&a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2694,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2695 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2695,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2696 | ||||
2697 | ierr = VecGetLocalSize(a->slvec1,&nt);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2697,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2698 | ierr = VecGetArray(a->slvec1,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2698,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2699 | ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,bs*mbs,array,&a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2699,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2700 | ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,nt-bs*mbs,array+bs*mbs,&a->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2700,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2701 | ierr = VecRestoreArray(a->slvec1,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2701,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2702 | ierr = VecGetArray(a->slvec0,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2702,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2703 | ierr = VecCreateSeqWithArray(PETSC_COMM_SELF((MPI_Comm)0x44000001),1,nt-bs*mbs,array+bs*mbs,&a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2703,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2704 | ierr = VecRestoreArray(a->slvec0,&array);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2704,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2705 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2705,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2706 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2706,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2707 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2707,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2708 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2708,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2709 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->slvec1b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2709,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2710 | ||||
2711 | /* ierr = VecScatterCopy(oldmat->sMvctx,&a->sMvctx); - not written yet, replaced by the lazy trick: */ | |||
2712 | ierr = PetscObjectReference((PetscObject)oldmat->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2712,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2713 | a->sMvctx = oldmat->sMvctx; | |||
2714 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->sMvctx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2714,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2715 | ||||
2716 | ierr = MatDuplicate(oldmat->A,cpvalues,&a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2716,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2717 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->A);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2717,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2718 | ierr = MatDuplicate(oldmat->B,cpvalues,&a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2718,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2719 | ierr = PetscLogObjectParent((PetscObject)mat,(PetscObject)a->B);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2719,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2720 | ierr = PetscFunctionListDuplicate(((PetscObject)matin)->qlist,&((PetscObject)mat)->qlist);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2720,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2721 | *newmat = mat; | |||
2722 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2723 | } | |||
2724 | ||||
2725 | PetscErrorCode MatLoad_MPISBAIJ(Mat newmat,PetscViewer viewer) | |||
2726 | { | |||
2727 | PetscErrorCode ierr; | |||
2728 | PetscInt i,nz,j,rstart,rend; | |||
2729 | PetscScalar *vals,*buf; | |||
2730 | MPI_Comm comm; | |||
2731 | MPI_Status status; | |||
2732 | PetscMPIInt rank,size,tag = ((PetscObject)viewer)->tag,*sndcounts = 0,*browners,maxnz,*rowners,mmbs; | |||
2733 | PetscInt header[4],*rowlengths = 0,M,N,m,*cols,*locrowlens; | |||
2734 | PetscInt *procsnz = 0,jj,*mycols,*ibuf; | |||
2735 | PetscInt bs = newmat->rmap->bs,Mbs,mbs,extra_rows; | |||
2736 | PetscInt *dlens,*odlens,*mask,*masked1,*masked2,rowcount,odcount; | |||
2737 | PetscInt dcount,kmax,k,nzcount,tmp; | |||
2738 | int fd; | |||
2739 | PetscBool isbinary; | |||
2740 | ||||
2741 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 2741; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
2742 | ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY"binary",&isbinary);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2742,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2743 | if (!isbinary) SETERRQ2(PetscObjectComm((PetscObject)newmat),PETSC_ERR_SUP,"Viewer type %s not yet supported for reading %s matrices",((PetscObject)viewer)->type_name,((PetscObject)newmat)->type_name)return PetscError(PetscObjectComm((PetscObject)newmat),2743,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Viewer type %s not yet supported for reading %s matrices" ,((PetscObject)viewer)->type_name,((PetscObject)newmat)-> type_name); | |||
2744 | ||||
2745 | /* force binary viewer to load .info file if it has not yet done so */ | |||
2746 | ierr = PetscViewerSetUp(viewer);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2746,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2747 | ierr = PetscObjectGetComm((PetscObject)viewer,&comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2747,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2748 | ierr = PetscOptionsBegin(comm,NULL,"Options for loading MPISBAIJ matrix 2","Mat")0; do { PetscOptionItems PetscOptionsObjectBase; PetscOptionItems *PetscOptionsObject = &PetscOptionsObjectBase; PetscMemzero (PetscOptionsObject,sizeof(PetscOptionItems)); for (PetscOptionsObject ->count=(PetscOptionsPublish?-1:1); PetscOptionsObject-> count<2; PetscOptionsObject->count++) { PetscErrorCode _5_ierr = PetscOptionsBegin_Private(PetscOptionsObject,comm,((void*) 0),"Options for loading MPISBAIJ matrix 2","Mat");do {if (__builtin_expect (!!(_5_ierr),0)) return PetscError(((MPI_Comm)0x44000001),2748 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2748,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2749 | ierr = PetscOptionsInt("-matload_block_size","Set the blocksize used to store the matrix","MatLoad",bs,&bs,NULL)PetscOptionsInt_Private(PetscOptionsObject,"-matload_block_size" ,"Set the blocksize used to store the matrix","MatLoad",bs,& bs,((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2749,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2750 | ierr = PetscOptionsEnd()_5_ierr = PetscOptionsEnd_Private(PetscOptionsObject);do {if ( __builtin_expect(!!(_5_ierr),0)) return PetscError(((MPI_Comm )0x44000001),2750,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_5_ierr,PETSC_ERROR_REPEAT," ");} while (0);}} while (0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2750,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2751 | if (bs < 0) bs = 1; | |||
2752 | ||||
2753 | ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2753,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2754 | ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2754,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2755 | ierr = PetscViewerBinaryGetDescriptor(viewer,&fd);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2755,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2756 | if (!rank) { | |||
2757 | ierr = PetscBinaryRead(fd,(char*)header,4,PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2757,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2758 | if (header[0] != MAT_FILE_CLASSID1211216) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"not matrix object")return PetscError(((MPI_Comm)0x44000001),2758,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,79,PETSC_ERROR_INITIAL,"not matrix object"); | |||
2759 | if (header[3] < 0) SETERRQ(PetscObjectComm((PetscObject)newmat),PETSC_ERR_FILE_UNEXPECTED,"Matrix stored in special format, cannot load as MPISBAIJ")return PetscError(PetscObjectComm((PetscObject)newmat),2759,__func__ ,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,79,PETSC_ERROR_INITIAL,"Matrix stored in special format, cannot load as MPISBAIJ" ); | |||
2760 | } | |||
2761 | ||||
2762 | ierr = MPI_Bcast(header+1,3,MPIU_INT,0,comm)((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Bcast ((header+1),(3),(((MPI_Datatype)0x4c000405)),(0),(comm)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2762,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2763 | M = header[1]; | |||
2764 | N = header[2]; | |||
2765 | ||||
2766 | /* If global sizes are set, check if they are consistent with that given in the file */ | |||
2767 | if (newmat->rmap->N >= 0 && newmat->rmap->N != M) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED, "Inconsistent # of rows:Matrix in file has (%D) and input matrix has (%D)",newmat->rmap->N,M)return PetscError(((MPI_Comm)0x44000001),2767,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,79,PETSC_ERROR_INITIAL,"Inconsistent # of rows:Matrix in file has (%D) and input matrix has (%D)" ,newmat->rmap->N,M); | |||
2768 | if (newmat->cmap->N >= 0 && newmat->cmap->N != N) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED, "Inconsistent # of cols:Matrix in file has (%D) and input matrix has (%D)",newmat->cmap->N,N)return PetscError(((MPI_Comm)0x44000001),2768,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,79,PETSC_ERROR_INITIAL,"Inconsistent # of cols:Matrix in file has (%D) and input matrix has (%D)" ,newmat->cmap->N,N); | |||
2769 | ||||
2770 | if (M != N) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Can only do square matrices")return PetscError(((MPI_Comm)0x44000001),2770,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Can only do square matrices"); | |||
2771 | ||||
2772 | /* | |||
2773 | This code adds extra rows to make sure the number of rows is | |||
2774 | divisible by the blocksize | |||
2775 | */ | |||
2776 | Mbs = M/bs; | |||
2777 | extra_rows = bs - M + bs*(Mbs); | |||
2778 | if (extra_rows == bs) extra_rows = 0; | |||
2779 | else Mbs++; | |||
2780 | if (extra_rows &&!rank) { | |||
2781 | ierr = PetscInfo(viewer,"Padding loaded matrix to match blocksize\n")PetscInfo_Private(__func__,viewer,"Padding loaded matrix to match blocksize\n" );CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2781,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2782 | } | |||
2783 | ||||
2784 | /* determine ownership of all rows */ | |||
2785 | if (newmat->rmap->n < 0) { /* PETSC_DECIDE */ | |||
2786 | mbs = Mbs/size + ((Mbs % size) > rank); | |||
2787 | m = mbs*bs; | |||
2788 | } else { /* User Set */ | |||
2789 | m = newmat->rmap->n; | |||
2790 | mbs = m/bs; | |||
2791 | } | |||
2792 | ierr = PetscMalloc2(size+1,&rowners,size+1,&browners)PetscMallocA(2,PETSC_FALSE,2792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(size+1)*sizeof(**(&rowners)),(&rowners),(size_t )(size+1)*sizeof(**(&browners)),(&browners));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2792,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2793 | ierr = PetscMPIIntCast(mbs,&mmbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2793,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2794 | ierr = MPI_Allgather(&mmbs,1,MPI_INT,rowners+1,1,MPI_INT,comm)((petsc_gather_ct += PetscMPIParallelComm((comm)),0) || MPI_Allgather ((&mmbs),(1),(((MPI_Datatype)0x4c000405)),(rowners+1),(1) ,(((MPI_Datatype)0x4c000405)),(comm)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2794,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2795 | rowners[0] = 0; | |||
2796 | for (i=2; i<=size; i++) rowners[i] += rowners[i-1]; | |||
2797 | for (i=0; i<=size; i++) browners[i] = rowners[i]*bs; | |||
2798 | rstart = rowners[rank]; | |||
2799 | rend = rowners[rank+1]; | |||
2800 | ||||
2801 | /* distribute row lengths to all processors */ | |||
2802 | ierr = PetscMalloc1((rend-rstart)*bs,&locrowlens)PetscMallocA(1,PETSC_FALSE,2802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)((rend-rstart)*bs)*sizeof(**(&locrowlens)),(& locrowlens));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2802,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2803 | if (!rank) { | |||
2804 | ierr = PetscMalloc1(M+extra_rows,&rowlengths)PetscMallocA(1,PETSC_FALSE,2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(M+extra_rows)*sizeof(**(&rowlengths)),(&rowlengths ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2804,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2805 | ierr = PetscBinaryRead(fd,rowlengths,M,PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2805,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2806 | for (i=0; i<extra_rows; i++) rowlengths[M+i] = 1; | |||
2807 | ierr = PetscMalloc1(size,&sndcounts)PetscMallocA(1,PETSC_FALSE,2807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(size)*sizeof(**(&sndcounts)),(&sndcounts));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2807,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2808 | for (i=0; i<size; i++) sndcounts[i] = browners[i+1] - browners[i]; | |||
2809 | ierr = MPI_Scatterv(rowlengths,sndcounts,browners,MPIU_INT,locrowlens,(rend-rstart)*bs,MPIU_INT,0,comm)((petsc_scatter_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),((rend-rstart)*bs),(((MPI_Datatype)0x4c000405))) || MPI_Scatterv ((rowlengths),(sndcounts),(browners),(((MPI_Datatype)0x4c000405 )),(locrowlens),((rend-rstart)*bs),(((MPI_Datatype)0x4c000405 )),(0),(comm)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2809,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2810 | ierr = PetscFree(sndcounts)((*PetscTrFree)((void*)(sndcounts),2810,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((sndcounts) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2810,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2811 | } else { | |||
2812 | ierr = MPI_Scatterv(0,0,0,MPIU_INT,locrowlens,(rend-rstart)*bs,MPIU_INT,0,comm)((petsc_scatter_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),((rend-rstart)*bs),(((MPI_Datatype)0x4c000405))) || MPI_Scatterv ((0),(0),(0),(((MPI_Datatype)0x4c000405)),(locrowlens),((rend -rstart)*bs),(((MPI_Datatype)0x4c000405)),(0),(comm)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2812,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2813 | } | |||
2814 | ||||
2815 | if (!rank) { /* procs[0] */ | |||
2816 | /* calculate the number of nonzeros on each processor */ | |||
2817 | ierr = PetscMalloc1(size,&procsnz)PetscMallocA(1,PETSC_FALSE,2817,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(size)*sizeof(**(&procsnz)),(&procsnz));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2817,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2818 | ierr = PetscMemzero(procsnz,size*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2818,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2819 | for (i=0; i<size; i++) { | |||
2820 | for (j=rowners[i]*bs; j< rowners[i+1]*bs; j++) { | |||
2821 | procsnz[i] += rowlengths[j]; | |||
2822 | } | |||
2823 | } | |||
2824 | ierr = PetscFree(rowlengths)((*PetscTrFree)((void*)(rowlengths),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((rowlengths) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2824,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2825 | ||||
2826 | /* determine max buffer needed and allocate it */ | |||
2827 | maxnz = 0; | |||
2828 | for (i=0; i<size; i++) { | |||
2829 | maxnz = PetscMax(maxnz,procsnz[i])(((maxnz)<(procsnz[i])) ? (procsnz[i]) : (maxnz)); | |||
2830 | } | |||
2831 | ierr = PetscMalloc1(maxnz,&cols)PetscMallocA(1,PETSC_FALSE,2831,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(maxnz)*sizeof(**(&cols)),(&cols));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2831,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2832 | ||||
2833 | /* read in my part of the matrix column indices */ | |||
2834 | nz = procsnz[0]; | |||
2835 | ierr = PetscMalloc1(nz,&ibuf)PetscMallocA(1,PETSC_FALSE,2835,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(nz)*sizeof(**(&ibuf)),(&ibuf));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2835,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2836 | mycols = ibuf; | |||
2837 | if (size == 1) nz -= extra_rows; | |||
2838 | ierr = PetscBinaryRead(fd,mycols,nz,PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2838,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2839 | if (size == 1) { | |||
2840 | for (i=0; i< extra_rows; i++) mycols[nz+i] = M+i; | |||
2841 | } | |||
2842 | ||||
2843 | /* read in every ones (except the last) and ship off */ | |||
2844 | for (i=1; i<size-1; i++) { | |||
2845 | nz = procsnz[i]; | |||
2846 | ierr = PetscBinaryRead(fd,cols,nz,PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2846,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2847 | ierr = MPI_Send(cols,nz,MPIU_INT,i,tag,comm)((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(nz),(((MPI_Datatype)0x4c000405))) || MPI_Send((cols),(nz), (((MPI_Datatype)0x4c000405)),(i),(tag),(comm)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2847,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2848 | } | |||
2849 | /* read in the stuff for the last proc */ | |||
2850 | if (size != 1) { | |||
2851 | nz = procsnz[size-1] - extra_rows; /* the extra rows are not on the disk */ | |||
2852 | ierr = PetscBinaryRead(fd,cols,nz,PETSC_INT);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2852,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2853 | for (i=0; i<extra_rows; i++) cols[nz+i] = M+i; | |||
2854 | ierr = MPI_Send(cols,nz+extra_rows,MPIU_INT,size-1,tag,comm)((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(nz+extra_rows),(((MPI_Datatype)0x4c000405))) || MPI_Send(( cols),(nz+extra_rows),(((MPI_Datatype)0x4c000405)),(size-1),( tag),(comm)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2854,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2855 | } | |||
2856 | ierr = PetscFree(cols)((*PetscTrFree)((void*)(cols),2856,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((cols) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2856,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2857 | } else { /* procs[i], i>0 */ | |||
2858 | /* determine buffer space needed for message */ | |||
2859 | nz = 0; | |||
2860 | for (i=0; i<m; i++) nz += locrowlens[i]; | |||
2861 | ierr = PetscMalloc1(nz,&ibuf)PetscMallocA(1,PETSC_FALSE,2861,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(nz)*sizeof(**(&ibuf)),(&ibuf));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2861,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2862 | mycols = ibuf; | |||
2863 | /* receive message of column indices*/ | |||
2864 | ierr = MPI_Recv(mycols,nz,MPIU_INT,0,tag,comm,&status)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),(nz),(((MPI_Datatype)0x4c000405))) || MPI_Recv((mycols),(nz ),(((MPI_Datatype)0x4c000405)),(0),(tag),(comm),(&status) ));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2864,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2865 | ierr = MPI_Get_count(&status,MPIU_INT((MPI_Datatype)0x4c000405),&maxnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2865,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2866 | if (maxnz != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"something is wrong with file")return PetscError(((MPI_Comm)0x44000001),2866,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,79,PETSC_ERROR_INITIAL,"something is wrong with file"); | |||
2867 | } | |||
2868 | ||||
2869 | /* loop over local rows, determining number of off diagonal entries */ | |||
2870 | ierr = PetscMalloc2(rend-rstart,&dlens,rend-rstart,&odlens)PetscMallocA(2,PETSC_FALSE,2870,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(rend-rstart)*sizeof(**(&dlens)),(&dlens),(size_t )(rend-rstart)*sizeof(**(&odlens)),(&odlens));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2870,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2871 | ierr = PetscMalloc3(Mbs,&mask,Mbs,&masked1,Mbs,&masked2)PetscMallocA(3,PETSC_FALSE,2871,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(Mbs)*sizeof(**(&mask)),(&mask),(size_t)(Mbs )*sizeof(**(&masked1)),(&masked1),(size_t)(Mbs)*sizeof (**(&masked2)),(&masked2));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2871,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2872 | ierr = PetscMemzero(mask,Mbs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2872,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2873 | ierr = PetscMemzero(masked1,Mbs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2873,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2874 | ierr = PetscMemzero(masked2,Mbs*sizeof(PetscInt));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2874,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2875 | rowcount = 0; | |||
2876 | nzcount = 0; | |||
2877 | for (i=0; i<mbs; i++) { | |||
2878 | dcount = 0; | |||
2879 | odcount = 0; | |||
2880 | for (j=0; j<bs; j++) { | |||
2881 | kmax = locrowlens[rowcount]; | |||
2882 | for (k=0; k<kmax; k++) { | |||
2883 | tmp = mycols[nzcount++]/bs; /* block col. index */ | |||
2884 | if (!mask[tmp]) { | |||
2885 | mask[tmp] = 1; | |||
2886 | if (tmp < rstart || tmp >= rend) masked2[odcount++] = tmp; /* entry in off-diag portion */ | |||
2887 | else masked1[dcount++] = tmp; /* entry in diag portion */ | |||
2888 | } | |||
2889 | } | |||
2890 | rowcount++; | |||
2891 | } | |||
2892 | ||||
2893 | dlens[i] = dcount; /* d_nzz[i] */ | |||
2894 | odlens[i] = odcount; /* o_nzz[i] */ | |||
2895 | ||||
2896 | /* zero out the mask elements we set */ | |||
2897 | for (j=0; j<dcount; j++) mask[masked1[j]] = 0; | |||
2898 | for (j=0; j<odcount; j++) mask[masked2[j]] = 0; | |||
2899 | } | |||
2900 | ierr = MatSetSizes(newmat,m,m,M+extra_rows,N+extra_rows);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2900,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2901 | ierr = MatMPISBAIJSetPreallocation(newmat,bs,0,dlens,0,odlens);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2901,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2902 | ierr = MatSetOption(newmat,MAT_IGNORE_LOWER_TRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2902,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2903 | ||||
2904 | if (!rank) { | |||
2905 | ierr = PetscMalloc1(maxnz,&buf)PetscMallocA(1,PETSC_FALSE,2905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(maxnz)*sizeof(**(&buf)),(&buf));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2905,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2906 | /* read in my part of the matrix numerical values */ | |||
2907 | nz = procsnz[0]; | |||
2908 | vals = buf; | |||
2909 | mycols = ibuf; | |||
2910 | if (size == 1) nz -= extra_rows; | |||
2911 | ierr = PetscBinaryRead(fd,vals,nz,PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2911,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2912 | if (size == 1) { | |||
2913 | for (i=0; i< extra_rows; i++) vals[nz+i] = 1.0; | |||
2914 | } | |||
2915 | ||||
2916 | /* insert into matrix */ | |||
2917 | jj = rstart*bs; | |||
2918 | for (i=0; i<m; i++) { | |||
2919 | ierr = MatSetValues(newmat,1,&jj,locrowlens[i],mycols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2919,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2920 | mycols += locrowlens[i]; | |||
2921 | vals += locrowlens[i]; | |||
2922 | jj++; | |||
2923 | } | |||
2924 | ||||
2925 | /* read in other processors (except the last one) and ship out */ | |||
2926 | for (i=1; i<size-1; i++) { | |||
2927 | nz = procsnz[i]; | |||
2928 | vals = buf; | |||
2929 | ierr = PetscBinaryRead(fd,vals,nz,PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2929,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2930 | ierr = MPI_Send(vals,nz,MPIU_SCALAR,i,((PetscObject)newmat)->tag,comm)((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(nz),(((MPI_Datatype)0x4c00080b))) || MPI_Send((vals),(nz), (((MPI_Datatype)0x4c00080b)),(i),(((PetscObject)newmat)->tag ),(comm)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2930,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2931 | } | |||
2932 | /* the last proc */ | |||
2933 | if (size != 1) { | |||
2934 | nz = procsnz[i] - extra_rows; | |||
2935 | vals = buf; | |||
2936 | ierr = PetscBinaryRead(fd,vals,nz,PETSC_SCALARPETSC_DOUBLE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2936,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2937 | for (i=0; i<extra_rows; i++) vals[nz+i] = 1.0; | |||
2938 | ierr = MPI_Send(vals,nz+extra_rows,MPIU_SCALAR,size-1,((PetscObject)newmat)->tag,comm)((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(nz+extra_rows),(((MPI_Datatype)0x4c00080b))) || MPI_Send(( vals),(nz+extra_rows),(((MPI_Datatype)0x4c00080b)),(size-1),( ((PetscObject)newmat)->tag),(comm)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2938,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2939 | } | |||
2940 | ierr = PetscFree(procsnz)((*PetscTrFree)((void*)(procsnz),2940,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((procsnz) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2940,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2941 | ||||
2942 | } else { | |||
2943 | /* receive numeric values */ | |||
2944 | ierr = PetscMalloc1(nz,&buf)PetscMallocA(1,PETSC_FALSE,2944,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(nz)*sizeof(**(&buf)),(&buf));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2944,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2945 | ||||
2946 | /* receive message of values*/ | |||
2947 | vals = buf; | |||
2948 | mycols = ibuf; | |||
2949 | ierr = MPI_Recv(vals,nz,MPIU_SCALAR,0,((PetscObject)newmat)->tag,comm,&status)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),(nz),(((MPI_Datatype)0x4c00080b))) || MPI_Recv((vals),(nz), (((MPI_Datatype)0x4c00080b)),(0),(((PetscObject)newmat)->tag ),(comm),(&status)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2949,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2950 | ierr = MPI_Get_count(&status,MPIU_SCALAR((MPI_Datatype)0x4c00080b),&maxnz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2950,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2951 | if (maxnz != nz) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_FILE_UNEXPECTED,"something is wrong with file")return PetscError(((MPI_Comm)0x44000001),2951,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,79,PETSC_ERROR_INITIAL,"something is wrong with file"); | |||
2952 | ||||
2953 | /* insert into matrix */ | |||
2954 | jj = rstart*bs; | |||
2955 | for (i=0; i<m; i++) { | |||
2956 | ierr = MatSetValues_MPISBAIJ(newmat,1,&jj,locrowlens[i],mycols,vals,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2956,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2957 | mycols += locrowlens[i]; | |||
2958 | vals += locrowlens[i]; | |||
2959 | jj++; | |||
2960 | } | |||
2961 | } | |||
2962 | ||||
2963 | ierr = PetscFree(locrowlens)((*PetscTrFree)((void*)(locrowlens),2963,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((locrowlens) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2963,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2964 | ierr = PetscFree(buf)((*PetscTrFree)((void*)(buf),2964,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((buf) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2964,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2965 | ierr = PetscFree(ibuf)((*PetscTrFree)((void*)(ibuf),2965,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((ibuf) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2965,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2966 | ierr = PetscFree2(rowners,browners)PetscFreeA(2,2966,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,&(rowners),&(browners));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2966,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2967 | ierr = PetscFree2(dlens,odlens)PetscFreeA(2,2967,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,&(dlens),&(odlens));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2967,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2968 | ierr = PetscFree3(mask,masked1,masked2)PetscFreeA(3,2968,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,&(mask),&(masked1),&(masked2));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2968,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2969 | ierr = MatAssemblyBegin(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2969,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2970 | ierr = MatAssemblyEnd(newmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),2970,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
2971 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
2972 | } | |||
2973 | ||||
2974 | /*XXXXX@ | |||
2975 | MatMPISBAIJSetHashTableFactor - Sets the factor required to compute the size of the HashTable. | |||
2976 | ||||
2977 | Input Parameters: | |||
2978 | . mat - the matrix | |||
2979 | . fact - factor | |||
2980 | ||||
2981 | Not Collective on Mat, each process can have a different hash factor | |||
2982 | ||||
2983 | Level: advanced | |||
2984 | ||||
2985 | Notes: | |||
2986 | This can also be set by the command line option: -mat_use_hash_table fact | |||
2987 | ||||
2988 | .keywords: matrix, hashtable, factor, HT | |||
2989 | ||||
2990 | .seealso: MatSetOption() | |||
2991 | @XXXXX*/ | |||
2992 | ||||
2993 | ||||
2994 | PetscErrorCode MatGetRowMaxAbs_MPISBAIJ(Mat A,Vec v,PetscInt idx[]) | |||
2995 | { | |||
2996 | Mat_MPISBAIJ *a = (Mat_MPISBAIJ*)A->data; | |||
2997 | Mat_SeqBAIJ *b = (Mat_SeqBAIJ*)(a->B)->data; | |||
2998 | PetscReal atmp; | |||
2999 | PetscReal *work,*svalues,*rvalues; | |||
3000 | PetscErrorCode ierr; | |||
3001 | PetscInt i,bs,mbs,*bi,*bj,brow,j,ncols,krow,kcol,col,row,Mbs,bcol; | |||
3002 | PetscMPIInt rank,size; | |||
3003 | PetscInt *rowners_bs,dest,count,source; | |||
3004 | PetscScalar *va; | |||
3005 | MatScalar *ba; | |||
3006 | MPI_Status stat; | |||
3007 | ||||
3008 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 3008; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3009 | if (idx) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Send email to [email protected]")return PetscError(((MPI_Comm)0x44000001),3009,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"Send email to [email protected]" ); | |||
3010 | ierr = MatGetRowMaxAbs(a->A,v,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3010,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3011 | ierr = VecGetArray(v,&va);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3011,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3012 | ||||
3013 | ierr = MPI_Comm_size(PetscObjectComm((PetscObject)A),&size);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3013,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3014 | ierr = MPI_Comm_rank(PetscObjectComm((PetscObject)A),&rank);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3014,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3015 | ||||
3016 | bs = A->rmap->bs; | |||
3017 | mbs = a->mbs; | |||
3018 | Mbs = a->Mbs; | |||
3019 | ba = b->a; | |||
3020 | bi = b->i; | |||
3021 | bj = b->j; | |||
3022 | ||||
3023 | /* find ownerships */ | |||
3024 | rowners_bs = A->rmap->range; | |||
3025 | ||||
3026 | /* each proc creates an array to be distributed */ | |||
3027 | ierr = PetscMalloc1(bs*Mbs,&work)PetscMallocA(1,PETSC_FALSE,3027,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(bs*Mbs)*sizeof(**(&work)),(&work));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3027,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3028 | ierr = PetscMemzero(work,bs*Mbs*sizeof(PetscReal));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3028,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3029 | ||||
3030 | /* row_max for B */ | |||
3031 | if (rank != size-1) { | |||
3032 | for (i=0; i<mbs; i++) { | |||
3033 | ncols = bi[1] - bi[0]; bi++; | |||
3034 | brow = bs*i; | |||
3035 | for (j=0; j<ncols; j++) { | |||
3036 | bcol = bs*(*bj); | |||
3037 | for (kcol=0; kcol<bs; kcol++) { | |||
3038 | col = bcol + kcol; /* local col index */ | |||
3039 | col += rowners_bs[rank+1]; /* global col index */ | |||
3040 | for (krow=0; krow<bs; krow++) { | |||
3041 | atmp = PetscAbsScalar(*ba); ba++; | |||
3042 | row = brow + krow; /* local row index */ | |||
3043 | if (PetscRealPart(va[row])(va[row]) < atmp) va[row] = atmp; | |||
3044 | if (work[col] < atmp) work[col] = atmp; | |||
3045 | } | |||
3046 | } | |||
3047 | bj++; | |||
3048 | } | |||
3049 | } | |||
3050 | ||||
3051 | /* send values to its owners */ | |||
3052 | for (dest=rank+1; dest<size; dest++) { | |||
3053 | svalues = work + rowners_bs[dest]; | |||
3054 | count = rowners_bs[dest+1]-rowners_bs[dest]; | |||
3055 | ierr = MPI_Send(svalues,count,MPIU_REAL,dest,rank,PetscObjectComm((PetscObject)A))((petsc_send_ct++,0) || PetscMPITypeSize((&petsc_send_len ),(count),(((MPI_Datatype)0x4c00080b))) || MPI_Send((svalues) ,(count),(((MPI_Datatype)0x4c00080b)),(dest),(rank),(PetscObjectComm ((PetscObject)A))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3055,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3056 | } | |||
3057 | } | |||
3058 | ||||
3059 | /* receive values */ | |||
3060 | if (rank) { | |||
3061 | rvalues = work; | |||
3062 | count = rowners_bs[rank+1]-rowners_bs[rank]; | |||
3063 | for (source=0; source<rank; source++) { | |||
3064 | ierr = MPI_Recv(rvalues,count,MPIU_REAL,MPI_ANY_SOURCE,MPI_ANY_TAG,PetscObjectComm((PetscObject)A),&stat)((petsc_recv_ct++,0) || PetscMPITypeSize((&petsc_recv_len ),(count),(((MPI_Datatype)0x4c00080b))) || MPI_Recv((rvalues) ,(count),(((MPI_Datatype)0x4c00080b)),((-2)),((-1)),(PetscObjectComm ((PetscObject)A)),(&stat)));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3064,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3065 | /* process values */ | |||
3066 | for (i=0; i<count; i++) { | |||
3067 | if (PetscRealPart(va[i])(va[i]) < rvalues[i]) va[i] = rvalues[i]; | |||
3068 | } | |||
3069 | } | |||
3070 | } | |||
3071 | ||||
3072 | ierr = VecRestoreArray(v,&va);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3072,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3073 | ierr = PetscFree(work)((*PetscTrFree)((void*)(work),3073,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((work) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3073,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3074 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3075 | } | |||
3076 | ||||
3077 | PetscErrorCode MatSOR_MPISBAIJ(Mat matin,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx) | |||
3078 | { | |||
3079 | Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data; | |||
3080 | PetscErrorCode ierr; | |||
3081 | PetscInt mbs=mat->mbs,bs=matin->rmap->bs; | |||
3082 | PetscScalar *x,*ptr,*from; | |||
3083 | Vec bb1; | |||
3084 | const PetscScalar *b; | |||
3085 | ||||
3086 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 3086; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3087 | if (its <= 0 || lits <= 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Relaxation requires global its %D and local its %D both positive",its,lits)return PetscError(((MPI_Comm)0x44000001),3087,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive" ,its,lits); | |||
3088 | if (bs > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SSOR for block size > 1 is not yet implemented")return PetscError(((MPI_Comm)0x44000001),3088,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"SSOR for block size > 1 is not yet implemented" ); | |||
3089 | ||||
3090 | if (flag == SOR_APPLY_UPPER) { | |||
3091 | ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,1,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3091,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3092 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3093 | } | |||
3094 | ||||
3095 | if ((flag & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) { | |||
3096 | if (flag & SOR_ZERO_INITIAL_GUESS) { | |||
3097 | ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,lits,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3097,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3098 | its--; | |||
3099 | } | |||
3100 | ||||
3101 | ierr = VecDuplicate(bb,&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3101,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3102 | while (its--) { | |||
3103 | ||||
3104 | /* lower triangular part: slvec0b = - B^T*xx */ | |||
3105 | ierr = (*mat->B->ops->multtranspose)(mat->B,xx,mat->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3105,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3106 | ||||
3107 | /* copy xx into slvec0a */ | |||
3108 | ierr = VecGetArray(mat->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3108,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3109 | ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3109,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3110 | ierr = PetscMemcpy(ptr,x,bs*mbs*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3110,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3111 | ierr = VecRestoreArray(mat->slvec0,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3111,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3112 | ||||
3113 | ierr = VecScale(mat->slvec0,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3113,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3114 | ||||
3115 | /* copy bb into slvec1a */ | |||
3116 | ierr = VecGetArray(mat->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3116,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3117 | ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3117,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3118 | ierr = PetscMemcpy(ptr,b,bs*mbs*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3118,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3119 | ierr = VecRestoreArray(mat->slvec1,&ptr);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3119,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3120 | ||||
3121 | /* set slvec1b = 0 */ | |||
3122 | ierr = VecSet(mat->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3122,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3123 | ||||
3124 | ierr = VecScatterBegin(mat->sMvctx,mat->slvec0,mat->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3124,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3125 | ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3125,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3126 | ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3126,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3127 | ierr = VecScatterEnd(mat->sMvctx,mat->slvec0,mat->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3127,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3128 | ||||
3129 | /* upper triangular part: bb1 = bb1 - B*x */ | |||
3130 | ierr = (*mat->B->ops->multadd)(mat->B,mat->slvec1b,mat->slvec1a,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3130,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3131 | ||||
3132 | /* local diagonal sweep */ | |||
3133 | ierr = (*mat->A->ops->sor)(mat->A,bb1,omega,SOR_SYMMETRIC_SWEEP,fshift,lits,lits,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3133,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3134 | } | |||
3135 | ierr = VecDestroy(&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3135,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3136 | } else if ((flag & SOR_LOCAL_FORWARD_SWEEP) && (its == 1) && (flag & SOR_ZERO_INITIAL_GUESS)) { | |||
3137 | ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,1,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3137,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3138 | } else if ((flag & SOR_LOCAL_BACKWARD_SWEEP) && (its == 1) && (flag & SOR_ZERO_INITIAL_GUESS)) { | |||
3139 | ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,1,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3139,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3140 | } else if (flag & SOR_EISENSTAT) { | |||
3141 | Vec xx1; | |||
3142 | PetscBool hasop; | |||
3143 | const PetscScalar *diag; | |||
3144 | PetscScalar *sl,scale = (omega - 2.0)/omega; | |||
3145 | PetscInt i,n; | |||
3146 | ||||
3147 | if (!mat->xx1) { | |||
3148 | ierr = VecDuplicate(bb,&mat->xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3148,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3149 | ierr = VecDuplicate(bb,&mat->bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3149,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3150 | } | |||
3151 | xx1 = mat->xx1; | |||
3152 | bb1 = mat->bb1; | |||
3153 | ||||
3154 | ierr = (*mat->A->ops->sor)(mat->A,bb,omega,(MatSORType)(SOR_ZERO_INITIAL_GUESS | SOR_LOCAL_BACKWARD_SWEEP),fshift,lits,1,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3154,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3155 | ||||
3156 | if (!mat->diag) { | |||
3157 | /* this is wrong for same matrix with new nonzero values */ | |||
3158 | ierr = MatCreateVecs(matin,&mat->diag,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3158,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3159 | ierr = MatGetDiagonal(matin,mat->diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3159,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3160 | } | |||
3161 | ierr = MatHasOperation(matin,MATOP_MULT_DIAGONAL_BLOCK,&hasop);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3161,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3162 | ||||
3163 | if (hasop) { | |||
3164 | ierr = MatMultDiagonalBlock(matin,xx,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3164,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3165 | ierr = VecAYPX(mat->slvec1a,scale,bb);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3165,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3166 | } else { | |||
3167 | /* | |||
3168 | These two lines are replaced by code that may be a bit faster for a good compiler | |||
3169 | ierr = VecPointwiseMult(mat->slvec1a,mat->diag,xx);CHKERRQ(ierr); | |||
3170 | ierr = VecAYPX(mat->slvec1a,scale,bb);CHKERRQ(ierr); | |||
3171 | */ | |||
3172 | ierr = VecGetArray(mat->slvec1a,&sl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3172,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3173 | ierr = VecGetArrayRead(mat->diag,&diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3173,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3174 | ierr = VecGetArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3174,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3175 | ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3175,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3176 | ierr = VecGetLocalSize(xx,&n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3176,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3177 | if (omega == 1.0) { | |||
3178 | for (i=0; i<n; i++) sl[i] = b[i] - diag[i]*x[i]; | |||
3179 | ierr = PetscLogFlops(2.0*n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3179,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3180 | } else { | |||
3181 | for (i=0; i<n; i++) sl[i] = b[i] + scale*diag[i]*x[i]; | |||
3182 | ierr = PetscLogFlops(3.0*n);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3182,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3183 | } | |||
3184 | ierr = VecRestoreArray(mat->slvec1a,&sl);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3184,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3185 | ierr = VecRestoreArrayRead(mat->diag,&diag);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3185,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3186 | ierr = VecRestoreArrayRead(bb,&b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3186,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3187 | ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3187,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3188 | } | |||
3189 | ||||
3190 | /* multiply off-diagonal portion of matrix */ | |||
3191 | ierr = VecSet(mat->slvec1b,0.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3191,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3192 | ierr = (*mat->B->ops->multtranspose)(mat->B,xx,mat->slvec0b);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3192,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3193 | ierr = VecGetArray(mat->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3193,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3194 | ierr = VecGetArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3194,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3195 | ierr = PetscMemcpy(from,x,bs*mbs*sizeof(MatScalar));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3195,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3196 | ierr = VecRestoreArray(mat->slvec0,&from);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3196,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3197 | ierr = VecRestoreArray(xx,&x);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3197,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3198 | ierr = VecScatterBegin(mat->sMvctx,mat->slvec0,mat->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3198,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3199 | ierr = VecScatterEnd(mat->sMvctx,mat->slvec0,mat->slvec1,ADD_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3199,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3200 | ierr = (*mat->B->ops->multadd)(mat->B,mat->slvec1b,mat->slvec1a,mat->slvec1a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3200,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3201 | ||||
3202 | /* local sweep */ | |||
3203 | ierr = (*mat->A->ops->sor)(mat->A,mat->slvec1a,omega,(MatSORType)(SOR_ZERO_INITIAL_GUESS | SOR_LOCAL_FORWARD_SWEEP),fshift,lits,1,xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3203,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3204 | ierr = VecAXPY(xx,1.0,xx1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3204,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3205 | } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSORType is not supported for SBAIJ matrix format")return PetscError(((MPI_Comm)0x44000001),3205,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"MatSORType is not supported for SBAIJ matrix format" ); | |||
3206 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3207 | } | |||
3208 | ||||
3209 | PetscErrorCode MatSOR_MPISBAIJ_2comm(Mat matin,Vec bb,PetscReal omega,MatSORType flag,PetscReal fshift,PetscInt its,PetscInt lits,Vec xx) | |||
3210 | { | |||
3211 | Mat_MPISBAIJ *mat = (Mat_MPISBAIJ*)matin->data; | |||
3212 | PetscErrorCode ierr; | |||
3213 | Vec lvec1,bb1; | |||
3214 | ||||
3215 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 3215; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3216 | if (its <= 0 || lits <= 0) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_WRONG,"Relaxation requires global its %D and local its %D both positive",its,lits)return PetscError(((MPI_Comm)0x44000001),3216,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,62,PETSC_ERROR_INITIAL,"Relaxation requires global its %D and local its %D both positive" ,its,lits); | |||
3217 | if (matin->rmap->bs > 1) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"SSOR for block size > 1 is not yet implemented")return PetscError(((MPI_Comm)0x44000001),3217,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"SSOR for block size > 1 is not yet implemented" ); | |||
3218 | ||||
3219 | if ((flag & SOR_LOCAL_SYMMETRIC_SWEEP) == SOR_LOCAL_SYMMETRIC_SWEEP) { | |||
3220 | if (flag & SOR_ZERO_INITIAL_GUESS) { | |||
3221 | ierr = (*mat->A->ops->sor)(mat->A,bb,omega,flag,fshift,lits,lits,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3221,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3222 | its--; | |||
3223 | } | |||
3224 | ||||
3225 | ierr = VecDuplicate(mat->lvec,&lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3225,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3226 | ierr = VecDuplicate(bb,&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3226,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3227 | while (its--) { | |||
3228 | ierr = VecScatterBegin(mat->Mvctx,xx,mat->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3228,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3229 | ||||
3230 | /* lower diagonal part: bb1 = bb - B^T*xx */ | |||
3231 | ierr = (*mat->B->ops->multtranspose)(mat->B,xx,lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3231,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3232 | ierr = VecScale(lvec1,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3232,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3233 | ||||
3234 | ierr = VecScatterEnd(mat->Mvctx,xx,mat->lvec,INSERT_VALUES,SCATTER_FORWARD);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3234,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3235 | ierr = VecCopy(bb,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3235,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3236 | ierr = VecScatterBegin(mat->Mvctx,lvec1,bb1,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3236,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3237 | ||||
3238 | /* upper diagonal part: bb1 = bb1 - B*x */ | |||
3239 | ierr = VecScale(mat->lvec,-1.0);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3239,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3240 | ierr = (*mat->B->ops->multadd)(mat->B,mat->lvec,bb1,bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3240,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3241 | ||||
3242 | ierr = VecScatterEnd(mat->Mvctx,lvec1,bb1,ADD_VALUES,SCATTER_REVERSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3242,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3243 | ||||
3244 | /* diagonal sweep */ | |||
3245 | ierr = (*mat->A->ops->sor)(mat->A,bb1,omega,SOR_SYMMETRIC_SWEEP,fshift,lits,lits,xx);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3245,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3246 | } | |||
3247 | ierr = VecDestroy(&lvec1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3247,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3248 | ierr = VecDestroy(&bb1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3248,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3249 | } else SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"MatSORType is not supported for SBAIJ matrix format")return PetscError(((MPI_Comm)0x44000001),3249,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,56,PETSC_ERROR_INITIAL,"MatSORType is not supported for SBAIJ matrix format" ); | |||
3250 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3251 | } | |||
3252 | ||||
3253 | /*@ | |||
3254 | MatCreateMPISBAIJWithArrays - creates a MPI SBAIJ matrix using arrays that contain in standard | |||
3255 | CSR format the local rows. | |||
3256 | ||||
3257 | Collective on MPI_Comm | |||
3258 | ||||
3259 | Input Parameters: | |||
3260 | + comm - MPI communicator | |||
3261 | . bs - the block size, only a block size of 1 is supported | |||
3262 | . m - number of local rows (Cannot be PETSC_DECIDE) | |||
3263 | . n - This value should be the same as the local size used in creating the | |||
3264 | x vector for the matrix-vector product y = Ax. (or PETSC_DECIDE to have | |||
3265 | calculated if N is given) For square matrices n is almost always m. | |||
3266 | . M - number of global rows (or PETSC_DETERMINE to have calculated if m is given) | |||
3267 | . N - number of global columns (or PETSC_DETERMINE to have calculated if n is given) | |||
3268 | . i - row indices; that is i[0] = 0, i[row] = i[row-1] + number of block elements in that row block row of the matrix | |||
3269 | . j - column indices | |||
3270 | - a - matrix values | |||
3271 | ||||
3272 | Output Parameter: | |||
3273 | . mat - the matrix | |||
3274 | ||||
3275 | Level: intermediate | |||
3276 | ||||
3277 | Notes: | |||
3278 | The i, j, and a arrays ARE copied by this routine into the internal format used by PETSc; | |||
3279 | thus you CANNOT change the matrix entries by changing the values of a[] after you have | |||
3280 | called this routine. Use MatCreateMPIAIJWithSplitArrays() to avoid needing to copy the arrays. | |||
3281 | ||||
3282 | The i and j indices are 0 based, and i indices are indices corresponding to the local j array. | |||
3283 | ||||
3284 | .keywords: matrix, aij, compressed row, sparse, parallel | |||
3285 | ||||
3286 | .seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIAIJSetPreallocation(), MatMPIAIJSetPreallocationCSR(), | |||
3287 | MPIAIJ, MatCreateAIJ(), MatCreateMPIAIJWithSplitArrays() | |||
3288 | @*/ | |||
3289 | PetscErrorCode MatCreateMPISBAIJWithArrays(MPI_Comm comm,PetscInt bs,PetscInt m,PetscInt n,PetscInt M,PetscInt N,const PetscInt i[],const PetscInt j[],const PetscScalar a[],Mat *mat) | |||
3290 | { | |||
3291 | PetscErrorCode ierr; | |||
3292 | ||||
3293 | ||||
3294 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 3294; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3295 | if (i[0]) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"i (row indices) must start with 0")return PetscError(((MPI_Comm)0x44000001),3295,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"i (row indices) must start with 0"); | |||
3296 | if (m < 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"local number of rows (m) cannot be PETSC_DECIDE, or negative")return PetscError(((MPI_Comm)0x44000001),3296,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"local number of rows (m) cannot be PETSC_DECIDE, or negative" ); | |||
3297 | ierr = MatCreate(comm,mat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3297,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3298 | ierr = MatSetSizes(*mat,m,n,M,N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3298,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3299 | ierr = MatSetType(*mat,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3299,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3300 | ierr = MatMPISBAIJSetPreallocationCSR(*mat,bs,i,j,a);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3300,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3301 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3302 | } | |||
3303 | ||||
3304 | ||||
3305 | /*@C | |||
3306 | MatMPISBAIJSetPreallocationCSR - Allocates memory for a sparse parallel matrix in BAIJ format | |||
3307 | (the default parallel PETSc format). | |||
3308 | ||||
3309 | Collective on MPI_Comm | |||
3310 | ||||
3311 | Input Parameters: | |||
3312 | + B - the matrix | |||
3313 | . bs - the block size | |||
3314 | . i - the indices into j for the start of each local row (starts with zero) | |||
3315 | . j - the column indices for each local row (starts with zero) these must be sorted for each row | |||
3316 | - v - optional values in the matrix | |||
3317 | ||||
3318 | Level: developer | |||
3319 | ||||
3320 | .keywords: matrix, aij, compressed row, sparse, parallel | |||
3321 | ||||
3322 | .seealso: MatCreate(), MatCreateSeqAIJ(), MatSetValues(), MatMPIBAIJSetPreallocation(), MatCreateAIJ(), MPIAIJ | |||
3323 | @*/ | |||
3324 | PetscErrorCode MatMPISBAIJSetPreallocationCSR(Mat B,PetscInt bs,const PetscInt i[],const PetscInt j[], const PetscScalar v[]) | |||
3325 | { | |||
3326 | PetscErrorCode ierr; | |||
3327 | ||||
3328 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 3328; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3329 | ierr = PetscTryMethod(B,"MatMPISBAIJSetPreallocationCSR_C",(Mat,PetscInt,const PetscInt[],const PetscInt[],const PetscScalar[]),(B,bs,i,j,v))0;{ PetscErrorCode (*f)(Mat,PetscInt,const PetscInt[],const PetscInt [],const PetscScalar[]), __ierr; __ierr = PetscObjectQueryFunction_Private (((PetscObject)B),("MatMPISBAIJSetPreallocationCSR_C"),(PetscVoidFunction *)(&f));do {if (__builtin_expect(!!(__ierr),0)) return PetscError (((MPI_Comm)0x44000001),3329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0); if (f) {__ierr = (*f)(B,bs,i,j,v);do {if (__builtin_expect(!!(__ierr),0)) return PetscError(((MPI_Comm)0x44000001),3329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,__ierr,PETSC_ERROR_REPEAT," ");} while (0);} };CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3329,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3330 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3331 | } | |||
3332 | ||||
3333 | PetscErrorCode MatCreateMPIMatConcatenateSeqMat_MPISBAIJ(MPI_Comm comm,Mat inmat,PetscInt n,MatReuse scall,Mat *outmat) | |||
3334 | { | |||
3335 | PetscErrorCode ierr; | |||
3336 | PetscInt m,N,i,rstart,nnz,Ii,bs,cbs; | |||
3337 | PetscInt *indx; | |||
3338 | PetscScalar *values; | |||
3339 | ||||
3340 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ; petscstack->line[petscstack->currentsize] = 3340; petscstack ->petscroutine[petscstack->currentsize] = PETSC_TRUE; petscstack ->currentsize++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0) ; ; } while (0); | |||
3341 | ierr = MatGetSize(inmat,&m,&N);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3341,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3342 | if (scall == MAT_INITIAL_MATRIX) { /* symbolic phase */ | |||
3343 | Mat_SeqSBAIJ *a = (Mat_SeqSBAIJ*)inmat->data; | |||
3344 | PetscInt *dnz,*onz,sum,bs,cbs,mbs,Nbs; | |||
3345 | PetscInt *bindx,rmax=a->rmax,j; | |||
3346 | ||||
3347 | ierr = MatGetBlockSizes(inmat,&bs,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3347,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3348 | mbs = m/bs; Nbs = N/cbs; | |||
3349 | if (n == PETSC_DECIDE-1) { | |||
3350 | ierr = PetscSplitOwnership(comm,&n,&Nbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3350,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3351 | } | |||
3352 | /* Check sum(n) = Nbs */ | |||
3353 | ierr = MPIU_Allreduce(&n,&sum,1,MPIU_INT,MPI_SUM,comm)(PetscAllreduceBarrierCheck(comm,1,3353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((petsc_allreduce_ct += PetscMPIParallelComm((comm)),0) || MPI_Allreduce((&n),(&sum),(1),(((MPI_Datatype)0x4c000405 )),((MPI_Op)(0x58000003)),(comm))));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3353,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3354 | if (sum != Nbs) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_INCOMP,"Sum of local columns != global columns %d",Nbs)return PetscError(((MPI_Comm)0x44000001),3354,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,75,PETSC_ERROR_INITIAL,"Sum of local columns != global columns %d" ,Nbs); | |||
3355 | ||||
3356 | ierr = MPI_Scan(&mbs, &rstart,1,MPIU_INT((MPI_Datatype)0x4c000405),MPI_SUM(MPI_Op)(0x58000003),comm);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3356,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3357 | rstart -= mbs; | |||
3358 | ||||
3359 | ierr = PetscMalloc1(rmax,&bindx)PetscMallocA(1,PETSC_FALSE,3359,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)(rmax)*sizeof(**(&bindx)),(&bindx));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3359,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3360 | ierr = MatPreallocateInitialize(comm,mbs,n,dnz,onz)0; { PetscErrorCode _4_ierr; PetscInt __nrows = (mbs),__ncols = (n),__rstart,__start,__end; _4_ierr = PetscMallocA(2,PETSC_TRUE ,3360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,(size_t)((size_t)__nrows)*sizeof(**(&dnz)),(&dnz),(size_t )((size_t)__nrows)*sizeof(**(&onz)),(&onz));do {if (__builtin_expect (!!(_4_ierr),0)) return PetscError(((MPI_Comm)0x44000001),3360 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_4_ierr,PETSC_ERROR_REPEAT," ");} while (0); __start = 0; __end = __start; _4_ierr = MPI_Scan(&__ncols,&__end,1,((MPI_Datatype )0x4c000405),(MPI_Op)(0x58000003),comm);do {if (__builtin_expect (!!(_4_ierr),0)) return PetscError(((MPI_Comm)0x44000001),3360 ,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_4_ierr,PETSC_ERROR_REPEAT," ");} while (0); __start = __end - __ncols; _4_ierr = MPI_Scan(&__nrows,&__rstart,1,( (MPI_Datatype)0x4c000405),(MPI_Op)(0x58000003),comm);do {if ( __builtin_expect(!!(_4_ierr),0)) return PetscError(((MPI_Comm )0x44000001),3360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_4_ierr,PETSC_ERROR_REPEAT," ");} while (0); __rstart = __rstart - __nrows;;CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3360,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3361 | ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3361,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3362 | for (i=0; i<mbs; i++) { | |||
3363 | ierr = MatGetRow_SeqSBAIJ(inmat,i*bs,&nnz,&indx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3363,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); /* non-blocked nnz and indx */ | |||
3364 | nnz = nnz/bs; | |||
3365 | for (j=0; j<nnz; j++) bindx[j] = indx[j*bs]/bs; | |||
3366 | ierr = MatPreallocateSet(i+rstart,nnz,bindx,dnz,onz)0;{ PetscInt __i; if (i+rstart < __rstart) return PetscError (((MPI_Comm)0x44000001),3366,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Trying to set preallocation for row %D less than first local row %D" ,i+rstart,__rstart); if (i+rstart >= __rstart+__nrows) return PetscError(((MPI_Comm)0x44000001),3366,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,63,PETSC_ERROR_INITIAL,"Trying to set preallocation for row %D greater than last local row %D" ,i+rstart,__rstart+__nrows-1); for (__i=0; __i<nnz; __i++) { if ((bindx)[__i] < __start || (bindx)[__i] >= __end) onz[i+rstart - __rstart]++; else if (dnz[i+rstart - __rstart ] < __ncols) dnz[i+rstart - __rstart]++; }};CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3366,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3367 | ierr = MatRestoreRow_SeqSBAIJ(inmat,i*bs,&nnz,&indx,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3367,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3368 | } | |||
3369 | ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3369,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3370 | ierr = PetscFree(bindx)((*PetscTrFree)((void*)(bindx),3370,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ) || ((bindx) = 0,0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3370,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3371 | ||||
3372 | ierr = MatCreate(comm,outmat);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3372,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3373 | ierr = MatSetSizes(*outmat,m,n*bs,PETSC_DETERMINE-1,PETSC_DETERMINE-1);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3373,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3374 | ierr = MatSetBlockSizes(*outmat,bs,cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3374,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3375 | ierr = MatSetType(*outmat,MATMPISBAIJ"mpisbaij");CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3375,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3376 | ierr = MatMPISBAIJSetPreallocation(*outmat,bs,0,dnz,0,onz);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3376,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3377 | ierr = MatPreallocateFinalize(dnz,onz)0;_4_ierr = PetscFreeA(2,3377,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,&(dnz),&(onz));do {if (__builtin_expect(!!(_4_ierr), 0)) return PetscError(((MPI_Comm)0x44000001),3377,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,_4_ierr,PETSC_ERROR_REPEAT," ");} while (0);};CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3377,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3378 | } | |||
3379 | ||||
3380 | /* numeric phase */ | |||
3381 | ierr = MatGetBlockSizes(inmat,&bs,&cbs);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3381,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3382 | ierr = MatGetOwnershipRange(*outmat,&rstart,NULL((void*)0));CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3382,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3383 | ||||
3384 | ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_TRUE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3384,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3385 | for (i=0; i<m; i++) { | |||
3386 | ierr = MatGetRow_SeqSBAIJ(inmat,i,&nnz,&indx,&values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3386,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3387 | Ii = i + rstart; | |||
3388 | ierr = MatSetValues(*outmat,1,&Ii,nnz,indx,values,INSERT_VALUES);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3388,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3389 | ierr = MatRestoreRow_SeqSBAIJ(inmat,i,&nnz,&indx,&values);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3389,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3390 | } | |||
3391 | ierr = MatSetOption(inmat,MAT_GETROW_UPPERTRIANGULAR,PETSC_FALSE);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3391,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3392 | ierr = MatAssemblyBegin(*outmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3392,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3393 | ierr = MatAssemblyEnd(*outmat,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),3393,__func__,"/sandbox/petsc/petsc.next-tmp/src/mat/impls/sbaij/mpi/mpisbaij.c" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
3394 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
3395 | } |
1 | #ifndef PETSCCTABLE_H | |||
2 | #define PETSCCTABLE_H | |||
3 | #include <petscsys.h> | |||
4 | ||||
5 | struct _n_PetscTable { | |||
6 | PetscInt *keytable; | |||
7 | PetscInt *table; | |||
8 | PetscInt count; | |||
9 | PetscInt tablesize; | |||
10 | PetscInt head; | |||
11 | PetscInt maxkey; /* largest key allowed */ | |||
12 | }; | |||
13 | ||||
14 | typedef struct _n_PetscTable* PetscTable; | |||
15 | typedef PetscInt* PetscTablePosition; | |||
16 | ||||
17 | PETSC_STATIC_INLINEstatic inline unsigned long PetscHash(PetscTable ta,unsigned long x) | |||
18 | { | |||
19 | return(x%(unsigned long)ta->tablesize); | |||
20 | } | |||
21 | ||||
22 | PETSC_STATIC_INLINEstatic inline unsigned long PetscHashStep(PetscTable ta,unsigned long x) | |||
23 | { | |||
24 | return(1+(x%(unsigned long)(ta->tablesize-1))); | |||
| ||||
25 | } | |||
26 | ||||
27 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableCreate(const PetscInt,PetscInt,PetscTable*); | |||
28 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableCreateCopy(const PetscTable,PetscTable*); | |||
29 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableDestroy(PetscTable*); | |||
30 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetCount(const PetscTable,PetscInt*); | |||
31 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableIsEmpty(const PetscTable,PetscInt*); | |||
32 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableAddExpand(PetscTable,PetscInt,PetscInt,InsertMode); | |||
33 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableAddCountExpand(PetscTable,PetscInt); | |||
34 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetHeadPosition(PetscTable,PetscTablePosition*); | |||
35 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableGetNext(PetscTable,PetscTablePosition*,PetscInt*,PetscInt*); | |||
36 | PETSC_EXTERNextern __attribute__((visibility ("default"))) PetscErrorCode PetscTableRemoveAll(PetscTable); | |||
37 | ||||
38 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableAdd(PetscTable ta,PetscInt key,PetscInt data,InsertMode imode) | |||
39 | { | |||
40 | PetscErrorCode ierr; | |||
41 | PetscInt i,hash = (PetscInt)PetscHash(ta,(unsigned long)key); | |||
42 | PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key); | |||
43 | ||||
44 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscctable.h"; petscstack ->line[petscstack->currentsize] = 44; petscstack->petscroutine [petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize ++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
45 | if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key <= 0")return PetscError(((MPI_Comm)0x44000001),45,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"key <= 0"); | |||
46 | if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)return PetscError(((MPI_Comm)0x44000001),46,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D" ,key,ta->maxkey); | |||
47 | if (!data) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Null data")return PetscError(((MPI_Comm)0x44000001),47,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"Null data"); | |||
48 | ||||
49 | for (i=0; i<ta->tablesize; i++) { | |||
50 | if (ta->keytable[hash] == key) { | |||
51 | switch (imode) { | |||
52 | case INSERT_VALUES: | |||
53 | ta->table[hash] = data; /* over write */ | |||
54 | break; | |||
55 | case ADD_VALUES: | |||
56 | ta->table[hash] += data; | |||
57 | break; | |||
58 | case MAX_VALUES: | |||
59 | ta->table[hash] = PetscMax(ta->table[hash],data)(((ta->table[hash])<(data)) ? (data) : (ta->table[hash ])); | |||
60 | break; | |||
61 | case NOT_SET_VALUES: | |||
62 | case INSERT_ALL_VALUES: | |||
63 | case ADD_ALL_VALUES: | |||
64 | case INSERT_BC_VALUES: | |||
65 | case ADD_BC_VALUES: | |||
66 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Unsupported InsertMode")return PetscError(((MPI_Comm)0x44000001),66,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,56,PETSC_ERROR_INITIAL,"Unsupported InsertMode"); | |||
67 | } | |||
68 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
69 | } else if (!ta->keytable[hash]) { | |||
70 | if (ta->count < 5*(ta->tablesize/6) - 1) { | |||
71 | ta->count++; /* add */ | |||
72 | ta->keytable[hash] = key; | |||
73 | ta->table[hash] = data; | |||
74 | } else { | |||
75 | ierr = PetscTableAddExpand(ta,key,data,imode);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),75,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
76 | } | |||
77 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
78 | } | |||
79 | hash = (hash + hashstep)%ta->tablesize; | |||
80 | } | |||
81 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_COR,"Full table")return PetscError(((MPI_Comm)0x44000001),81,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,74,PETSC_ERROR_INITIAL,"Full table"); | |||
82 | /* PetscFunctionReturn(0); */ | |||
83 | } | |||
84 | ||||
85 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableAddCount(PetscTable ta,PetscInt key) | |||
86 | { | |||
87 | PetscErrorCode ierr; | |||
88 | PetscInt i,hash = (PetscInt)PetscHash(ta,(unsigned long)key); | |||
89 | PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key); | |||
90 | ||||
91 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscctable.h"; petscstack ->line[petscstack->currentsize] = 91; petscstack->petscroutine [petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize ++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
92 | if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key <= 0")return PetscError(((MPI_Comm)0x44000001),92,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"key <= 0"); | |||
93 | if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)return PetscError(((MPI_Comm)0x44000001),93,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D" ,key,ta->maxkey); | |||
94 | ||||
95 | for (i=0; i<ta->tablesize; i++) { | |||
96 | if (ta->keytable[hash] == key) { | |||
97 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
98 | } else if (!ta->keytable[hash]) { | |||
99 | if (ta->count < 5*(ta->tablesize/6) - 1) { | |||
100 | ta->count++; /* add */ | |||
101 | ta->keytable[hash] = key; | |||
102 | ta->table[hash] = ta->count; | |||
103 | } else { | |||
104 | ierr = PetscTableAddCountExpand(ta,key);CHKERRQ(ierr)do {if (__builtin_expect(!!(ierr),0)) return PetscError(((MPI_Comm )0x44000001),104,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,ierr,PETSC_ERROR_REPEAT," ");} while (0); | |||
105 | } | |||
106 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
107 | } | |||
108 | hash = (hash + hashstep)%ta->tablesize; | |||
109 | } | |||
110 | SETERRQ(PETSC_COMM_SELF,PETSC_ERR_COR,"Full table")return PetscError(((MPI_Comm)0x44000001),110,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,74,PETSC_ERROR_INITIAL,"Full table"); | |||
111 | /* PetscFunctionReturn(0); */ | |||
112 | } | |||
113 | ||||
114 | /* | |||
115 | PetscTableFind - checks if a key is in the table | |||
116 | ||||
117 | If data==0, then no table entry exists. | |||
118 | ||||
119 | */ | |||
120 | PETSC_STATIC_INLINEstatic inline PetscErrorCode PetscTableFind(PetscTable ta,PetscInt key,PetscInt *data) | |||
121 | { | |||
122 | PetscInt ii = 0; | |||
123 | PetscInt hash = (PetscInt)PetscHash(ta,(unsigned long)key); | |||
124 | PetscInt hashstep = (PetscInt)PetscHashStep(ta,(unsigned long)key); | |||
125 | ||||
126 | PetscFunctionBegindo { do { ; if (petscstack && (petscstack->currentsize < 64)) { petscstack->function[petscstack->currentsize ] = __func__; petscstack->file[petscstack->currentsize] = "/sandbox/petsc/petsc.next-tmp/include/petscctable.h"; petscstack ->line[petscstack->currentsize] = 126; petscstack->petscroutine [petscstack->currentsize] = PETSC_TRUE; petscstack->currentsize ++; } if (petscstack) { petscstack->hotdepth += (PETSC_FALSE || petscstack->hotdepth); } ; } while (0); ; } while (0); | |||
127 | *data = 0; | |||
128 | if (key <= 0) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Key <= 0")return PetscError(((MPI_Comm)0x44000001),128,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"Key <= 0"); | |||
129 | if (key > ta->maxkey) SETERRQ2(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"key %D is greater than largest key allowed %D",key,ta->maxkey)return PetscError(((MPI_Comm)0x44000001),129,__func__,"/sandbox/petsc/petsc.next-tmp/include/petscctable.h" ,63,PETSC_ERROR_INITIAL,"key %D is greater than largest key allowed %D" ,key,ta->maxkey); | |||
130 | ||||
131 | while (ii++ < ta->tablesize) { | |||
132 | if (!ta->keytable[hash]) break; | |||
133 | else if (ta->keytable[hash] == key) { | |||
134 | *data = ta->table[hash]; | |||
135 | break; | |||
136 | } | |||
137 | hash = (hash + hashstep)%ta->tablesize; | |||
138 | } | |||
139 | PetscFunctionReturn(0)do { do { ; if (petscstack && petscstack->currentsize > 0) { petscstack->currentsize--; petscstack->function [petscstack->currentsize] = 0; petscstack->file[petscstack ->currentsize] = 0; petscstack->line[petscstack->currentsize ] = 0; petscstack->petscroutine[petscstack->currentsize ] = PETSC_FALSE; } if (petscstack) { petscstack->hotdepth = (((petscstack->hotdepth-1)<(0)) ? (0) : (petscstack-> hotdepth-1)); } ; } while (0); return(0);} while (0); | |||
140 | } | |||
141 | ||||
142 | #endif |