source:
issm/oecreview/Archive/11730-11748/ISSM-11733-11734.diff
Last change on this file was 11991, checked in by , 13 years ago | |
---|---|
File size: 20.1 KB |
-
proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/Numerics/ElementMatrix.cpp
259 259 /*In debugging mode, check consistency (no NaN, and values not too big)*/ 260 260 this->CheckConsistency(); 261 261 262 #ifdef _HAVE_PETSC_ 263 if(this->dofsymmetrical){ 264 /*only use row dofs to add values into global matrices: */ 265 266 if(this->row_fsize){ 267 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 268 localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double)); 269 for(i=0;i<this->row_fsize;i++){ 270 for(j=0;j<this->row_fsize;j++){ 271 *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]); 272 } 273 } 274 /*add local values into global matrix, using the fglobaldoflist: */ 275 MatSetValues(Kff->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,(const double*)localvalues,ADD_VALUES); 262 if(this->dofsymmetrical){ 263 /*only use row dofs to add values into global matrices: */ 276 264 277 /*Free ressources:*/ 278 xfree((void**)&localvalues); 265 if(this->row_fsize){ 266 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 267 localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double)); 268 for(i=0;i<this->row_fsize;i++){ 269 for(j=0;j<this->row_fsize;j++){ 270 *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]); 271 } 279 272 } 273 /*add local values into global matrix, using the fglobaldoflist: */ 274 Kff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL); 280 275 276 /*Free ressources:*/ 277 xfree((void**)&localvalues); 278 } 281 279 282 if((this->row_ssize!=0) && (this->row_fsize!=0)){283 /*first, retrieve values that are in the f and s-set from the g-set values matrix: */284 localvalues=(double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double));285 for(i=0;i<this->row_fsize;i++){286 for(j=0;j<this->row_ssize;j++){287 *(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]);288 }289 }290 /*add local values into global matrix, using the fglobaldoflist: */291 MatSetValues(Kfs->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,(const double*)localvalues,ADD_VALUES);292 280 293 /*Free ressources:*/ 294 xfree((void**)&localvalues); 281 if((this->row_ssize!=0) && (this->row_fsize!=0)){ 282 /*first, retrieve values that are in the f and s-set from the g-set values matrix: */ 283 localvalues=(double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double)); 284 for(i=0;i<this->row_fsize;i++){ 285 for(j=0;j<this->row_ssize;j++){ 286 *(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]); 287 } 295 288 } 289 /*add local values into global matrix, using the fglobaldoflist: */ 290 Kfs->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,localvalues,ADD_VAL); 291 292 /*Free ressources:*/ 293 xfree((void**)&localvalues); 296 294 } 297 else{ 298 _error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!"); 299 } 300 #else 301 _error_("not supported yet!"); 302 #endif 295 } 296 else{ 297 _error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!"); 298 } 303 299 304 300 } 305 301 /*}}}*/ … … 315 311 /*In debugging mode, check consistency (no NaN, and values not too big)*/ 316 312 this->CheckConsistency(); 317 313 318 #ifdef _HAVE_PETSC_ 319 if(this->dofsymmetrical){ 320 /*only use row dofs to add values into global matrices: */ 314 if(this->dofsymmetrical){ 315 /*only use row dofs to add values into global matrices: */ 321 316 322 if(this->row_fsize){ 323 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 324 localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double)); 325 for(i=0;i<this->row_fsize;i++){ 326 for(j=0;j<this->row_fsize;j++){ 327 *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]); 328 } 317 if(this->row_fsize){ 318 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 319 localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double)); 320 for(i=0;i<this->row_fsize;i++){ 321 for(j=0;j<this->row_fsize;j++){ 322 *(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]); 329 323 } 330 /*add local values into global matrix, using the fglobaldoflist: */331 MatSetValues(Jff->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,(const double*)localvalues,ADD_VALUES);332 333 /*Free ressources:*/334 xfree((void**)&localvalues);335 324 } 325 /*add local values into global matrix, using the fglobaldoflist: */ 326 Jff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL); 336 327 328 /*Free ressources:*/ 329 xfree((void**)&localvalues); 337 330 } 338 else{339 _error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");340 }341 #else342 _error_("not supported yet!");343 #endif344 331 332 } 333 else{ 334 _error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!"); 335 } 336 345 337 } 346 338 /*}}}*/ 347 339 /*FUNCTION ElementMatrix::CheckConsistency{{{1*/ -
proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/Numerics/Vector.cpp
24 24 /*FUNCTION Vector::Vector(){{{1*/ 25 25 Vector::Vector(){ 26 26 27 this->M=0;28 27 #ifdef _HAVE_PETSC_ 29 28 this->vector=NULL; 30 29 #else … … 41 40 #ifdef _HAVE_PETSC_ 42 41 this->vector=NewVec(pM,fromlocalsize); 43 42 #else 44 this->M=pM; 45 this->vector=(double*)xcalloc(pM,sizeof(double)); 43 this->vector=new SeqVec(pM,fromlocalsize); 46 44 #endif 47 45 #ifdef _HAVE_ADOLC_ 48 46 this->avector=(adouble*)xmalloc(pM*sizeof(adouble)); … … 50 48 } 51 49 /*}}}*/ 52 50 /*FUNCTION Vector::Vector(double* serial_vec,int M){{{1*/ 53 Vector::Vector(double* serial_vec,int pM){51 Vector::Vector(double* serial_vec,int M){ 54 52 55 53 int i,j; 56 54 57 55 #ifdef _HAVE_PETSC_ 58 56 int* idxm=NULL; 59 57 60 this->vector=NewVec( pM);58 this->vector=NewVec(M); 61 59 62 60 idxm=(int*)xmalloc(M*sizeof(int)); 63 61 for(i=0;i<M;i++)idxm[i]=i; … … 69 67 xfree((void**)&idxm); 70 68 71 69 #else 72 this->M=pM; 73 this->vector=(double*)xcalloc(pM,sizeof(double)); 70 this->vector=new SeqVec(serial_vec,M); 74 71 #endif 75 72 #ifdef _HAVE_ADOLC_ 76 this->avector=(adouble*)xmalloc( pM*sizeof(adouble));73 this->avector=(adouble*)xmalloc(M*sizeof(adouble)); 77 74 #endif 78 75 } 79 76 /*}}}*/ … … 81 78 /*FUNCTION Vector::Vector(Vec petsc_vec){{{1*/ 82 79 Vector::Vector(Vec petsc_vec){ 83 80 84 /*Get Vector size*/85 VecGetSize(petsc_vec,&this->M);86 87 81 /*copy vector*/ 88 82 VecDuplicate(petsc_vec,&this->vector); 89 83 VecCopy(petsc_vec,this->vector); … … 97 91 #ifdef _HAVE_PETSC_ 98 92 VecFree(&this->vector); 99 93 #else 100 xfree((void**)&this->vector);94 delete this->vector; 101 95 #endif 102 96 #ifdef _HAVE_ADOLC_ 103 97 xfree((void**)&this->avector); … … 114 108 #ifdef _HAVE_PETSC_ 115 109 VecView(this->vector,PETSC_VIEWER_STDOUT_WORLD); 116 110 #else 117 printf("Vector size: %i\n",M); 118 for(i=0;i<M;i++){ 119 printf("%g\n ",*(vector+i)); 120 } 111 this->vector->Echo(); 121 112 #endif 122 113 123 114 #ifdef _HAVE_ADOLC_ 124 /*Not sure about that one. Should we use the overloaded operator >>?*/ 125 printf("ADOLC Vector equivalent:" ); 126 for(i=0;i<M;i++){ 127 printf("%g\n ",*(avector+i)); 128 } 115 /*do nothing for now: */ 129 116 #endif 130 117 } 131 118 /*}}}*/ … … 138 125 #ifdef _HAVE_PETSC_ 139 126 PetscVectorToMatlabVector(&dataref,this->vector); 140 127 #else 141 _error_("not implemented yet!");128 dataref=this->vector->ToMatlabVector(); 142 129 #endif 143 130 return dataref; 144 131 145 132 } 146 133 /*}}}*/ 134 /*FUNCTION MatlabVectorToVector{{{1*/ 135 Vector* MatlabVectorToVector(const mxArray* mxvector){ 136 137 int dummy; 138 Vector* vector=NULL; 139 140 /*allocate vector object: */ 141 vector=new Vector(); 142 143 #ifdef _HAVE_PETSC_ 144 MatlabVectorToPetscVector(&vector->vector,&dummy,mxvector); 145 #else 146 vector->vector=MatlabVectorToSeqVec(mxvector); 147 #endif 148 149 return vector; 150 } 151 /*}}}*/ 147 152 #endif 148 153 /*FUNCTION Vector::Assemble{{{1*/ 149 154 void Vector::Assemble(void){ … … 153 158 VecAssemblyBegin(this->vector); 154 159 VecAssemblyEnd(this->vector); 155 160 #else 156 /*do nothing*/161 this->vector->Assemble(); 157 162 #endif 158 163 159 164 } … … 166 171 _assert_(this->vector); 167 172 VecSetValues(this->vector,ssize,list,values,ISSMToPetscInsertMode(mode)); 168 173 #else 169 _error_("not implemented yet!");174 this->vector->SetValues(ssize,list,values,mode); 170 175 #endif 171 176 172 177 } … … 178 183 _assert_(this->vector); 179 184 VecSetValues(this->vector,1,&dof,&value,ISSMToPetscInsertMode(mode)); 180 185 #else 181 _error_("not implemented yet!");186 this->vector->SetValue(dof,value,mode); 182 187 #endif 183 188 184 189 } … … 190 195 _assert_(this->vector); 191 196 VecGetValues(this->vector,1,&dof,pvalue); 192 197 #else 193 _error_("not implemented yet!");198 this->vector->GetValue(pvalue,dof); 194 199 #endif 195 200 } 196 201 /*}}}*/ … … 201 206 _assert_(this->vector); 202 207 VecGetSize(this->vector,pM); 203 208 #else 204 _error_("not implemented yet!");209 this->vector->GetSize(pM); 205 210 #endif 206 211 207 212 } … … 213 218 _assert_(this->vector); 214 219 VecGetLocalSize(this->vector,pM); 215 220 #else 216 _error_("not implemented yet!");221 this->vector->GetLocalSize(pM); 217 222 #endif 218 223 219 224 } … … 228 233 _assert_(this->vector); 229 234 VecDuplicate(this->vector,&vec_output); 230 235 output->vector=vec_output; 231 VecGetSize(output->vector,&output->M);232 236 #else 233 _error_("not implemented yet!");237 output->vector=this->vector->Duplicate(); 234 238 #endif 235 239 return output; 236 240 … … 243 247 _assert_(this->vector); 244 248 VecSet(this->vector,value); 245 249 #else 246 _error_("not implemented yet!");250 this->vector->Set(value); 247 251 #endif 248 252 249 253 } … … 255 259 _assert_(this->vector); 256 260 VecAXPY(this->vector,a,X->vector); 257 261 #else 258 _error_("not implemented yet!");262 this->vector->AXPY(X->vector,a); 259 263 #endif 260 264 } 261 265 /*}}}*/ … … 266 270 _assert_(this->vector); 267 271 VecAYPX(this->vector,a,X->vector); 268 272 #else 269 _error_("not implemented yet!");273 this->vector->AYPX(X->vector,a); 270 274 #endif 271 275 272 276 } … … 279 283 #ifdef _HAVE_PETSC_ 280 284 VecToMPISerial(&vec_serial, this->vector); 281 285 #else 282 _error_("not implemented yet!");286 vec_serial=this->vector->ToMPISerial(); 283 287 #endif 284 288 285 289 return vec_serial; … … 292 296 #ifdef _HAVE_PETSC_ 293 297 VecCopy(this->vector,to->vector); 294 298 #else 295 _error_("not implemented yet!");299 this->vector->Copy(to->vector); 296 300 #endif 297 301 298 302 } … … 305 309 _assert_(this->vector); 306 310 VecNorm(this->vector,ISSMToPetscNormMode(norm_type),&norm); 307 311 #else 308 _error_("not implemented yet!");312 norm=this->vector->Norm(norm_type); 309 313 #endif 310 314 return norm; 311 315 } … … 317 321 _assert_(this->vector); 318 322 VecScale(this->vector,scale_factor); 319 323 #else 320 _error_("not implemented yet!");324 this->vector->Scale(scale_factor); 321 325 #endif 322 326 } 323 327 /*}}}*/ … … 329 333 _assert_(this->vector); 330 334 VecDot(this->vector,vector->vector,&dot); 331 335 #else 332 _error_("not implemented yet!");336 dot=this->vector->Dot(vector->vector); 333 337 #endif 334 338 return dot; 335 339 } … … 341 345 _assert_(this->vector); 342 346 VecPointwiseDivide(this->vector,x->vector,y->vector); 343 347 #else 344 _error_("not implemented yet!");348 this->vector->PointwiseDivide(x->vector,y->vector); 345 349 #endif 346 350 } 347 351 /*}}}*/ -
proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/Numerics/Matrix.cpp
47 47 #ifdef _HAVE_PETSC_ 48 48 this->matrix=NewMat(pM,pN); 49 49 #else 50 this->matrix= (double*)xcalloc(pM*pN,sizeof(double));50 this->matrix=new SeqMat(pM,pN); 51 51 #endif 52 52 #ifdef _HAVE_ADOLC_ 53 53 this->amatrix=(adouble*)xmalloc(pM*pN*sizeof(adouble)); … … 63 63 #ifdef _HAVE_PETSC_ 64 64 this->matrix=NewMat(pM,pN,sparsity); 65 65 #else 66 this->matrix= (double*)xcalloc(pM*pN,sizeof(double));66 this->matrix=new SeqMat(pM,pN,sparsity); 67 67 #endif 68 68 #ifdef _HAVE_ADOLC_ 69 69 this->amatrix=(adouble*)xmalloc(pM*pN*sizeof(adouble)); … … 96 96 xfree((void**)&idxm); 97 97 xfree((void**)&idxn); 98 98 #else 99 this->matrix= (double*)xcalloc(pM*pN,sizeof(double));99 this->matrix=new SeqMat(serial_mat,pM,pN,sparsity); 100 100 #endif 101 101 #ifdef _HAVE_ADOLC_ 102 102 this->amatrix=(adouble*)xmalloc(pM*pN*sizeof(adouble)); … … 112 112 #ifdef _HAVE_PETSC_ 113 113 this->matrix=NewMat(pM,pN,connectivity,numberofdofspernode); 114 114 #else 115 this->matrix= (double*)xcalloc(pM*pN,sizeof(double));115 this->matrix=new SeqMat(pM,pN,connectivity,numberofdofspernode); 116 116 #endif 117 117 #ifdef _HAVE_ADOLC_ 118 118 this->amatrix=(adouble*)xmalloc(pM*pN*sizeof(adouble)); … … 125 125 #ifdef _HAVE_PETSC_ 126 126 MatFree(&this->matrix); 127 127 #else 128 xfree((void**)&this->matrix);128 delete this->matrix; 129 129 #endif 130 130 #ifdef _HAVE_ADOLC_ 131 131 xfree((void**)&this->amatrix); … … 142 142 #ifdef _HAVE_PETSC_ 143 143 MatView(this->matrix,PETSC_VIEWER_STDOUT_WORLD); 144 144 #else 145 printf("Matrix size: %i-%i\n",M,N); 146 for(i=0;i<M;i++){ 147 for(j=0;j<N;j++){ 148 printf("%g ",*(matrix+N*i+j)); 149 } 150 printf("\n"); 151 } 145 this->matrix->Echo(); 152 146 #endif 153 147 154 148 #ifdef _HAVE_ADOLC_ … … 172 166 #ifdef _HAVE_PETSC_ 173 167 PetscMatrixToMatlabMatrix(&dataref,this->matrix); 174 168 #else 175 _error_("not implemented yet!");169 dataref=this->matrix->ToMatlabMatrix(); 176 170 #endif 177 171 return dataref; 178 172 179 173 } 180 174 /*}}}*/ 175 /*FUNCTION MatlabMatrixToMatrix{{{1*/ 176 Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix){ 177 178 int dummy; 179 Matrix* matrix=NULL; 180 181 /*allocate matrix object: */ 182 matrix=new Matrix(); 183 184 #ifdef _HAVE_PETSC_ 185 MatlabMatrixToPetscMatrix(&matrix->matrix,&matrix->M,&matrix->N,mxmatrix); 186 #else 187 matrix->matrix=MatlabMatrixToSeqMat(mxmatrix); 188 #endif 189 190 return matrix; 191 } 192 /*}}}*/ 181 193 #endif 182 194 /*FUNCTION Matrix::Assemble{{{1*/ 183 195 void Matrix::Assemble(void){ … … 189 201 MatCompress(this->matrix); 190 202 #endif 191 203 #else 192 /*do nothing:*/204 this->matrix->Assemble(); 193 205 #endif 194 206 195 207 } … … 202 214 _assert_(this->matrix); 203 215 MatNorm(this->matrix,ISSMToPetscNormMode(norm_type),&norm); 204 216 #else 205 _error_("not implemented yet!");217 norm=this->matrix->Norm(norm_type); 206 218 #endif 207 219 return norm; 208 220 } … … 214 226 _assert_(this->matrix); 215 227 MatGetSize(this->matrix,pM,pN); 216 228 #else 217 _error_("not implemented yet!");229 this->matrix->GetSize(pM,pN); 218 230 #endif 219 231 } 220 232 /*}}}*/ … … 225 237 _assert_(this->matrix); 226 238 MatGetLocalSize(this->matrix,pM,pN); 227 239 #else 228 _error_("not implemented yet!");240 this->matrix->GetLocalSize(pM,pN); 229 241 #endif 230 242 } 231 243 /*}}}*/ … … 237 249 _assert_(X->vector); 238 250 MatMultPatch(this->matrix,X->vector,AX->vector); 239 251 #else 240 _error_("not implemented yet!");252 this->matrix->MatMult(X->vector,AX->vector); 241 253 #endif 242 254 } 243 255 /*}}}*/ … … 248 260 249 261 output=new Matrix(); 250 262 251 #ifdef _HAVE_PETSC 263 #ifdef _HAVE_PETSC_ 252 264 _assert_(this->matrix); 253 265 MatDuplicate(this->matrix,MAT_COPY_VALUES,&output->matrix); 254 266 #else 255 _error_("not implemented yet!");267 output->matrix=this->matrix->Duplicate(); 256 268 #endif 257 269 } 258 270 /*}}}*/ … … 261 273 262 274 double* output=NULL; 263 275 264 #ifdef _HAVE_PETSC 276 #ifdef _HAVE_PETSC_ 265 277 MatToSerial(&output,this->matrix); 266 278 #else 267 _error_("not implemented yet!");279 output=this->matrix->ToSerial(); 268 280 #endif 269 281 return output; 270 282 } 271 283 /*}}}*/ 284 /*FUNCTION Matrix::SetValues{{{1*/ 285 void Matrix::SetValues(int m,int* idxm,int n,int* idxn,double* values,InsMode mode){ 286 287 #ifdef _HAVE_PETSC_ 288 MatSetValues(this->matrix,m,idxm,n,idxn,values,ISSMToPetscInsertMode(mode)); 289 #else 290 this->matrix->SetValues(m,idxm,n,idxn,values,mode); 291 #endif 292 } 293 /*}}}*/ -
proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/Numerics/Vector.h
30 30 31 31 public: 32 32 33 int M;34 35 33 #ifdef _HAVE_PETSC_ 36 34 Vec vector; 37 35 #else 38 double* vector;36 SeqVec* vector; 39 37 #endif 40 38 #ifdef _HAVE_ADOLC_ 41 39 adouble* avector; … … 73 71 double Dot(Vector* vector); 74 72 /*}}}*/ 75 73 }; 74 75 /*API: */ 76 #ifdef _SERIAL_ 77 Vector* MatlabVectorToVector(const mxArray* mxvector); 78 #endif 79 76 80 #endif //#ifndef _VECTOR_H_ -
proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/Numerics/Matrix.h
36 36 #ifdef _HAVE_PETSC_ 37 37 Mat matrix; 38 38 #else 39 double* matrix;39 SeqMat* matrix; 40 40 #endif 41 41 #ifdef _HAVE_ADOLC_ 42 42 adouble* amatrix; … … 62 62 void MatMult(Vector* X,Vector* AX); 63 63 Matrix* Duplicate(void); 64 64 double* ToSerial(void); 65 void SetValues(int m,int* idxm,int n,int* idxn,double* values,InsMode mode); 65 66 /*}}}*/ 66 67 67 68 }; 69 /*API: */ 70 #ifdef _SERIAL_ 71 Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix); 72 #endif 73 68 74 #endif //#ifndef _MATRIX_H_ -
proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/Numerics/ElementVector.cpp
165 165 int i; 166 166 double* localvalues=NULL; 167 167 168 #ifdef _HAVE_PETSC_ 169 if(this->fsize){ 170 /*first, retrieve values that are in the f-set from the g-set values vector: */ 171 localvalues=(double*)xmalloc(this->fsize*sizeof(double)); 172 for(i=0;i<this->fsize;i++){ 173 localvalues[i]=this->values[this->flocaldoflist[i]]; 174 } 175 /*add local values into global vector, using the fglobaldoflist: */ 176 VecSetValues(pf->vector,this->fsize,this->fglobaldoflist,(const double*)localvalues,ADD_VALUES); 177 178 /*Free ressources:*/ 179 xfree((void**)&localvalues); 168 if(this->fsize){ 169 /*first, retrieve values that are in the f-set from the g-set values vector: */ 170 localvalues=(double*)xmalloc(this->fsize*sizeof(double)); 171 for(i=0;i<this->fsize;i++){ 172 localvalues[i]=this->values[this->flocaldoflist[i]]; 180 173 } 181 #else 182 _error_("not supported yet!"); 183 #endif 174 /*add local values into global vector, using the fglobaldoflist: */ 175 pf->SetValues(this->fsize,this->fglobaldoflist,localvalues,ADD_VAL); 176 177 /*Free ressources:*/ 178 xfree((void**)&localvalues); 179 } 184 180 185 181 } 186 182 /*}}}*/ … … 190 186 int i; 191 187 double* localvalues=NULL; 192 188 193 #ifdef _HAVE_PETSC_ 194 if(this->fsize){ 195 /*first, retrieve values that are in the f-set from the g-set values vector: */ 196 localvalues=(double*)xmalloc(this->fsize*sizeof(double)); 197 for(i=0;i<this->fsize;i++){ 198 localvalues[i]=this->values[this->flocaldoflist[i]]; 199 } 200 /*add local values into global vector, using the fglobaldoflist: */ 201 VecSetValues(pf->vector,this->fsize,this->fglobaldoflist,(const double*)localvalues,INSERT_VALUES); 202 203 /*Free ressources:*/ 204 xfree((void**)&localvalues); 189 if(this->fsize){ 190 /*first, retrieve values that are in the f-set from the g-set values vector: */ 191 localvalues=(double*)xmalloc(this->fsize*sizeof(double)); 192 for(i=0;i<this->fsize;i++){ 193 localvalues[i]=this->values[this->flocaldoflist[i]]; 205 194 } 206 #else 207 _error_("not supported yet!"); 208 #endif 195 /*add local values into global vector, using the fglobaldoflist: */ 196 pf->SetValues(this->fsize,this->fglobaldoflist,localvalues,INS_VAL); 209 197 198 /*Free ressources:*/ 199 xfree((void**)&localvalues); 200 } 201 210 202 } 211 203 /*}}}*/ 212 204 /*FUNCTION ElementVector::Echo{{{1*/
Note:
See TracBrowser
for help on using the repository browser.