- Timestamp:
- 04/16/12 14:57:18 (13 years ago)
- Location:
- issm/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk
- Property svn:ignore
-
old new 7 7 config.status 8 8 configure 9 doxygen10 9 ISSM.paf 11 10 ISSM.ppf 12 11 ISSM.ppf_cache 13 12 libtool 14 list15 13 Makefile 16 14 Makefile.in
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
issm/trunk/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
r11527 r11995 10 10 #include "../../EnumDefinitions/EnumDefinitions.h" 11 11 12 void SystemMatricesx(Mat * pKff, Mat* pKfs, Vec* ppf, Vec* pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){12 void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, double* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){ 13 13 14 14 /*intermediary: */ … … 21 21 22 22 /*output: */ 23 Mat Kff = NULL;24 Mat Kfs = NULL;25 Vec pf = NULL;26 Vec df=NULL;23 Matrix* Kff = NULL; 24 Matrix* Kfs = NULL; 25 Vector* pf = NULL; 26 Vector* df=NULL; 27 27 double kmax = 0; 28 28 … … 49 49 if(kflag){ 50 50 51 Kff= NewMat(fsize,fsize,connectivity,numberofdofspernode);52 Kfs= NewMat(fsize,ssize,connectivity,numberofdofspernode);53 df= NewVec(fsize);51 Kff=new Matrix(fsize,fsize,connectivity,numberofdofspernode); 52 Kfs=new Matrix(fsize,ssize,connectivity,numberofdofspernode); 53 df=new Vector(fsize); 54 54 55 55 /*Fill stiffness matrix from elements: */ … … 66 66 67 67 /*Assemble matrix and doftypes and compress matrix to save memory: */ 68 MatAssemblyBegin(Kff,MAT_FINAL_ASSEMBLY); 69 MatAssemblyEnd(Kff,MAT_FINAL_ASSEMBLY); 70 #if _PETSC_MAJOR_ == 2 71 MatCompress(Kff); 72 #endif 73 74 MatAssemblyBegin(Kfs,MAT_FINAL_ASSEMBLY); 75 MatAssemblyEnd(Kfs,MAT_FINAL_ASSEMBLY); 76 #if _PETSC_MAJOR_ == 2 77 MatCompress(Kfs); 78 #endif 79 VecAssemblyBegin(df); 80 VecAssemblyEnd(df); 81 68 Kff->Assemble(); 69 Kfs->Assemble(); 70 df->Assemble(); 82 71 } 83 72 84 73 if(pflag){ 85 74 86 pf= NewVec(fsize);75 pf=new Vector(fsize); 87 76 88 77 /*Fill right hand side vector, from elements: */ … … 97 86 if (load->InAnalysis(configuration_type)) load->CreatePVector(pf); 98 87 } 99 100 VecAssemblyBegin(pf); 101 VecAssemblyEnd(pf); 88 pf->Assemble(); 102 89 } 103 90 104 91 /*Now, figure out maximum value of K_gg, so that we can penalize it correctly: */ 105 MatNorm(Kff,NORM_INFINITY,&kmax);92 kmax=Kff->Norm(NORM_INF); 106 93 107 94 /*Now, deal with penalties*/ … … 115 102 116 103 /*Assemble matrix and compress matrix to save memory: */ 117 MatAssemblyBegin(Kff,MAT_FINAL_ASSEMBLY); 118 MatAssemblyEnd(Kff,MAT_FINAL_ASSEMBLY); 119 #if _PETSC_MAJOR_ == 2 120 MatCompress(Kff); 121 #endif 122 123 MatAssemblyBegin(Kfs,MAT_FINAL_ASSEMBLY); 124 MatAssemblyEnd(Kfs,MAT_FINAL_ASSEMBLY); 125 #if _PETSC_MAJOR_ == 2 126 MatCompress(Kfs); 127 #endif 104 Kff->Assemble(); 105 Kfs->Assemble(); 128 106 } 129 107 … … 137 115 } 138 116 139 VecAssemblyBegin(pf); 140 VecAssemblyEnd(pf); 117 pf->Assemble(); 141 118 } 142 119 143 120 /*Assign output pointers: */ 144 121 if(pKff) *pKff=Kff; 145 else MatFree(&Kff);122 else xdelete(&Kff); 146 123 if(pKfs) *pKfs=Kfs; 147 else MatFree(&Kfs);124 else xdelete(&Kfs); 148 125 if(ppf) *ppf=pf; 149 else VecFree(&pf);126 else xdelete(&pf); 150 127 if(pdf) *pdf=df; 151 else VecFree(&df);128 else xdelete(&df); 152 129 if(pkmax) *pkmax=kmax; 153 130 }
Note:
See TracChangeset
for help on using the changeset viewer.