Changeset 13880
- Timestamp:
- 11/05/12 15:35:08 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/matrix/Matrix.h
r13869 r13880 76 76 } 77 77 /*}}}*/ 78 /*FUNCTION Matrix(int m,int n,int M,int N,int* d_nnz,int* o_nnz,int type){{{*/ 79 #ifdef _HAVE_PETSC_ 80 Matrix(int m,int n,int M,int N,int* d_nnz,int* o_nnz,int in_type=PetscMatType){ 81 #else 82 Matrix(int m,int n,int M,int N,int* d_nnz,int* o_nnz,int in_type=SeqMatType){ 83 #endif 84 85 #ifdef _HAVE_PETSC_ 86 pmatrix=NULL; 87 #endif 88 smatrix=NULL; 89 type=in_type; 90 91 if(type==PetscMatType){ 92 #ifdef _HAVE_PETSC_ 93 this->pmatrix=new PetscMat(m,n,M,N,d_nnz,o_nnz); 94 #else 95 _error_("Petsc matrix format not usable, as Petsc has not been compiled!"); 96 #endif 97 } 98 else if(type==SeqMatType){ 99 this->smatrix=new SeqMat<doubletype>(m,n,M,N,d_nnz,o_nnz); 100 } 101 else _error_("Matrix type: " << type << " not supported yet!"); 102 103 } 104 /*}}}*/ 78 105 /*FUNCTION Matrix(int M,int N,IssmDouble sparsity,int in_type){{{*/ 79 106 #ifdef _HAVE_PETSC_ -
issm/trunk-jpl/src/c/classes/matrix/Vector.h
r13801 r13880 75 75 } 76 76 /*}}}*/ 77 /*FUNCTION Vector(int m,int M,int in_type){{{*/ 78 #ifdef _HAVE_PETSC_ 79 Vector(int m,int M,int in_type=PetscVecType){ 80 #else 81 Vector(int m,int M,int in_type=SeqVecType){ 82 #endif 83 84 #ifdef _HAVE_PETSC_ 85 pvector=NULL; 86 #endif 87 svector=NULL; 88 type=in_type; 89 90 if(type==PetscVecType){ 91 #ifdef _HAVE_PETSC_ 92 this->pvector=new PetscVec(m,M); 93 #else 94 _error_("Petsc matrix format not usable, as Petsc has not been compiled!"); 95 #endif 96 } 97 else if(type==SeqVecType){ 98 this->svector=new SeqVec<doubletype>(m,M); 99 } 100 else _error_("Vector type: " << type << " not supported yet!"); 101 102 } 103 /*}}}*/ 77 104 /*FUNCTION Vector(doubletype* serial_vec,int M,int in_type){{{*/ 78 105 #ifdef _HAVE_PETSC_ -
issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h
r13760 r13880 59 59 this->matrix=NULL; 60 60 if(M*N) this->matrix=xNewZeroInit<doubletype>(pM*pN); 61 } 62 /*}}}*/ 63 /*FUNCTION SeqMat(int m,int n,int M,int N,int* d_nnz,int* o_nnz){{{*/ 64 SeqMat(int m,int n,int pM,int pN,int* d_nnz,int* o_nnz){ 65 66 this->M=pM; 67 this->N=pN; 68 this->matrix=NULL; 69 if(pM*pN) this->matrix=xNewZeroInit<doubletype>(pM*pN); 61 70 } 62 71 /*}}}*/ -
issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h
r13780 r13880 49 49 } 50 50 /*}}}*/ 51 /*FUNCTION SeqVec(int m,int M){{{*/ 52 SeqVec(int pm,int pM){ 53 54 this->M=pM; 55 this->vector=NULL; 56 if(this->M) this->vector=xNewZeroInit<doubletype>(pM); 57 } 58 /*}}}*/ 51 59 /*FUNCTION SeqVec(int M,bool fromlocalsize){{{*/ 52 60 SeqVec(int pM,bool fromlocalsize){ -
issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp
r13869 r13880 38 38 39 39 this->matrix=NewMat(M,N,sparsity,IssmComm::GetComm()); 40 } 41 /*}}}*/ 42 /*FUNCTION PetscMat::PetscMat(int M,int N, IssmDouble sparsity){{{*/ 43 PetscMat::PetscMat(int m,int n,int M,int N,int* d_nnz,int* o_nnz){ 44 45 MatCreate(IssmComm::GetComm(),&this->matrix); 46 MatSetSizes(this->matrix,m,n,M,N); 47 MatSetFromOptions(this->matrix); 48 MatMPIAIJSetPreallocation(this->matrix,0,d_nnz,0,o_nnz); 49 40 50 } 41 51 /*}}}*/ -
issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.h
r13869 r13880 31 31 #endif 32 32 33 /*PetscMat constructors, destructors {{{*/33 /*PetscMat constructors, destructors*/ 34 34 PetscMat(); 35 35 PetscMat(int M,int N); 36 36 PetscMat(int M,int N,IssmDouble sparsity); 37 PetscMat(int m,int n,int M,int N,int* d_nnz,int* o_nnz); 37 38 PetscMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity); 38 39 PetscMat(int M,int N,int connectivity,int numberofdofspernode); 39 40 ~PetscMat(); 40 /*}}}*/ 41 /*PetscMat specific routines {{{*/41 42 /*PetscMat specific routines*/ 42 43 void AllocationInfo(void); 43 44 void Echo(void); … … 51 52 void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode); 52 53 void Convert(MatrixType type); 53 /*}}}*/54 55 54 }; 56 55 -
issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp
r13784 r13880 31 31 32 32 this->vector=NewVec(M,IssmComm::GetComm(),fromlocalsize); 33 34 } 35 /*}}}*/ 36 /*FUNCTION PetscVec::PetscVec(int m,int M){{{*/ 37 PetscVec::PetscVec(int m,int M){ 38 39 VecCreate(IssmComm::GetComm(),&this->vector); 40 VecSetSizes(this->vector,m,M); 41 VecSetFromOptions(this->vector); 42 VecSet(this->vector,0.0); 33 43 34 44 } -
issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h
r13623 r13880 30 30 #endif 31 31 32 /*PetscVec constructors, destructors {{{*/32 /*PetscVec constructors, destructors*/ 33 33 PetscVec(); 34 34 PetscVec(int M,bool fromlocalsize=false); 35 PetscVec(int m,int M); 35 36 PetscVec(IssmDouble* buffer, int M); 36 37 PetscVec(Vec petsc_vec); 37 38 ~PetscVec(); 38 /*}}}*/ 39 /*PetscVec specific routines {{{*/39 40 /*PetscVec specific routines*/ 40 41 void Echo(void); 41 42 void Assemble(void); … … 55 56 void PointwiseDivide(PetscVec* x,PetscVec* y); 56 57 IssmDouble Dot(PetscVec* vector); 57 /*}}}*/58 58 }; 59 59
Note:
See TracChangeset
for help on using the changeset viewer.