Changeset 12860
- Timestamp:
- 08/01/12 17:08:52 (13 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/matrix/Matrix.cpp
r12851 r12860 168 168 this->smatrix->Assemble(); 169 169 } 170 else _error2_("Matrix type: " << type << " not supported yet!"); 170 else{ 171 _error2_("Matrix type: " << type << " not supported yet!"); 172 } 171 173 } 172 174 /*}}}*/ … … 302 304 /*}}}*/ 303 305 /*FUNCTION Matrix::Convert{{{*/ 304 void Matrix::Convert(MatrixType type){ 305 306 if((int)type==(int)PetscMatType){ 307 #ifdef _HAVE_PETSC_ 308 this->pmatrix->Convert(type); 309 #else 310 _error2_("Petsc matrix format not usable, as Petsc has not been compiled!"); 311 #endif 312 } 313 else if((int)type==(int)SeqMatType){ 314 this->smatrix->Convert(type); 315 } 316 else _error2_("Matrix type: " << type << " not supported yet!"); 317 318 } 319 /*}}}*/ 306 void Matrix::Convert(MatrixType newtype){ 307 308 if(type==PetscMatType){ 309 #ifdef _HAVE_PETSC_ 310 this->pmatrix->Convert(newtype); 311 #else 312 _error2_("Petsc matrix format not usable, as Petsc has not been compiled!"); 313 #endif 314 } 315 else if(type==SeqMatType){ 316 this->smatrix->Convert(newtype); 317 } 318 else{ 319 _error2_("Matrix type: " << type << " not supported yet!"); 320 } 321 322 } 323 /*}}}*/ -
issm/trunk-jpl/src/c/classes/matrix/Matrix.h
r12850 r12860 16 16 #include "../../toolkits/toolkits.h" 17 17 #include "../../EnumDefinitions/EnumDefinitions.h" 18 18 /*}}}*/ 19 19 class Vector; 20 /*}}}*/ 21 22 enum matrixtype { PetscMatType, SeqMatType }; 20 enum matrixtype{PetscMatType, SeqMatType}; 23 21 24 22 class Matrix{ … … 27 25 28 26 #ifdef _HAVE_PETSC_ 29 PetscMat *pmatrix;27 PetscMat *pmatrix; 30 28 #endif 31 SeqMat * smatrix;32 int type;29 SeqMat *smatrix; 30 int type; 33 31 34 32 /*Matrix constructors, destructors {{{*/ … … 41 39 /*}}}*/ 42 40 /*Matrix specific routines {{{*/ 43 void Echo(void);44 void Assemble(void);45 IssmDouble Norm(NormMode norm_type);46 void GetSize(int* pM,int*pN);47 void GetLocalSize(int* pM,int*pN);48 void MatMult(Vector* X,Vector*AX);49 Matrix *Duplicate(void);50 IssmDouble *ToSerial(void);51 void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble*values,InsMode mode);52 void Convert(MatrixTypetype);41 void Echo(void); 42 void Assemble(void); 43 IssmDouble Norm(NormMode norm_type); 44 void GetSize(int *pM,int*pN); 45 void GetLocalSize(int *pM,int*pN); 46 void MatMult(Vector *X,Vector*AX); 47 Matrix *Duplicate(void); 48 IssmDouble *ToSerial(void); 49 void SetValues(int m,int *idxm,int n,int*idxn,IssmDouble*values,InsMode mode); 50 void Convert(MatrixType newtype); 53 51 /*}}}*/ 54 55 52 }; 56 53 -
issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp
r12450 r12860 192 192 193 193 /*Output : */ 194 index_matrix=new Matrix(index,out.numberoftriangles,3,1); 195 index_matrix->Convert(DENSE_SEQUENTIAL); 194 index_matrix=new Matrix(index,out.numberoftriangles,3,1,SeqMatType); 196 195 *pindex=index_matrix; 197 196 198 segments_matrix=new Matrix(segments,out.numberofsegments,3,1 ); segments_matrix->Convert(DENSE_SEQUENTIAL);197 segments_matrix=new Matrix(segments,out.numberofsegments,3,1,SeqMatType); 199 198 *psegments=segments_matrix; 200 199 201 *px=new Vector(x,out.numberofpoints );202 *py=new Vector(y,out.numberofpoints );203 *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments );200 *px=new Vector(x,out.numberofpoints,SeqMatType); 201 *py=new Vector(y,out.numberofpoints,SeqMatType); 202 *psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments,SeqMatType); 204 203 } -
issm/trunk-jpl/src/c/toolkits/issm/SeqMat.cpp
r12520 r12860 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION SeqMat (IssmDouble* serial_mat,int M,int N,IssmDouble sparsity){{{*/47 /*FUNCTION SeqMat::SeqMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity){{{*/ 48 48 SeqMat::SeqMat(IssmDouble* serial_mat,int pM,int pN,IssmDouble sparsity){ 49 49
Note:
See TracChangeset
for help on using the changeset viewer.