Changeset 12472
- Timestamp:
- 06/20/12 09:19:54 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/objects
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/objects/Loads/Friction.cpp
r12455 r12472 34 34 this->inputs=inputs_in; 35 35 this->element_type=xNew<char>(strlen(element_type_in)+1); 36 memcpy(this->element_type,element_type_in,(strlen(element_type_in)+1)*sizeof(char));36 xMemCpy<char>(this->element_type,element_type_in,(strlen(element_type_in)+1)); 37 37 38 38 this->matpar=matpar_in; -
issm/trunk-jpl/src/c/objects/Loads/Icefront.cpp
r12455 r12472 279 279 /*}}}*/ 280 280 /*FUNCTION Icefront::PenaltyCreateKMatrix {{{*/ 281 void Icefront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){281 void Icefront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, IssmDouble kmax){ 282 282 /*do nothing: */ 283 283 return; … … 285 285 /*}}}*/ 286 286 /*FUNCTION Icefront::PenaltyCreatePVector{{{*/ 287 void Icefront::PenaltyCreatePVector(Vector* pf, double kmax){287 void Icefront::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 288 288 /*do nothing: */ 289 289 return; … … 291 291 /*}}}*/ 292 292 /*FUNCTION Icefront::PenaltyCreateJacobianMatrix{{{*/ 293 void Icefront::PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){293 void Icefront::PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){ 294 294 this->PenaltyCreateKMatrix(Jff,NULL,kmax); 295 295 } … … 303 303 304 304 /*Update virtual functions definitions:*/ 305 /*FUNCTION Icefront::InputUpdateFromVector( double* vector, int name, int type) {{{*/306 void Icefront::InputUpdateFromVector( double* vector, int name, int type){305 /*FUNCTION Icefront::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 306 void Icefront::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 307 307 /*Nothing updated yet*/ 308 308 } … … 318 318 } 319 319 /*}}}*/ 320 /*FUNCTION Icefront::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type) {{{*/321 void Icefront::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){322 /*Nothing updated yet*/ 323 } 324 /*}}}*/ 325 /*FUNCTION Icefront::InputUpdateFromVectorDakota( double* vector, int name, int type) {{{*/326 void Icefront::InputUpdateFromVectorDakota( double* vector, int name, int type){320 /*FUNCTION Icefront::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type) {{{*/ 321 void Icefront::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){ 322 /*Nothing updated yet*/ 323 } 324 /*}}}*/ 325 /*FUNCTION Icefront::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 326 void Icefront::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 327 327 /*Nothing updated yet*/ 328 328 } … … 338 338 } 339 339 /*}}}*/ 340 /*FUNCTION Icefront::InputUpdateFromConstant( double constant, int name) {{{*/341 void Icefront::InputUpdateFromConstant( double constant, int name){340 /*FUNCTION Icefront::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 341 void Icefront::InputUpdateFromConstant(IssmDouble constant, int name){ 342 342 /*Nothing updated yet*/ 343 343 } … … 354 354 /*}}}*/ 355 355 /*FUNCTION Icefront::InputUpdateFromSolution{{{*/ 356 void Icefront::InputUpdateFromSolution( double* solution){356 void Icefront::InputUpdateFromSolution(IssmDouble* solution){ 357 357 /*Nothing updated yet*/ 358 358 } … … 392 392 /*Intermediary*/ 393 393 int ig,index1,index2,fill; 394 double Jdet;395 double thickness,bed,pressure,ice_pressure,rho_water,rho_ice,gravity;396 double water_pressure,air_pressure,surface_under_water,base_under_water;397 double xyz_list[numnodes][3];398 double normal[2];399 double L[2];394 IssmDouble Jdet; 395 IssmDouble thickness,bed,pressure,ice_pressure,rho_water,rho_ice,gravity; 396 IssmDouble water_pressure,air_pressure,surface_under_water,base_under_water; 397 IssmDouble xyz_list[numnodes][3]; 398 IssmDouble normal[2]; 399 IssmDouble L[2]; 400 400 GaussTria *gauss; 401 401 … … 513 513 int i,j,ig,index1,index2,index3,index4; 514 514 int fill; 515 double surface,pressure,ice_pressure,rho_water,rho_ice,gravity;516 double water_pressure,air_pressure;517 double Jdet,z_g;518 double xyz_list[NUMVERTICESQUA][3];519 double normal[3];520 double l1l4[4];515 IssmDouble surface,pressure,ice_pressure,rho_water,rho_ice,gravity; 516 IssmDouble water_pressure,air_pressure; 517 IssmDouble Jdet,z_g; 518 IssmDouble xyz_list[NUMVERTICESQUA][3]; 519 IssmDouble normal[3]; 520 IssmDouble l1l4[4]; 521 521 GaussPenta *gauss = NULL; 522 522 … … 543 543 544 544 /* Start looping on the number of gaussian points: */ 545 double zmax=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];546 double zmin=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];545 IssmDouble zmax=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2]; 546 IssmDouble zmin=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2]; 547 547 if(zmax>0 && zmin<0) gauss=new GaussPenta(index1,index2,index3,index4,3,10); //refined in vertical because of the sea level discontinuity 548 548 else gauss=new GaussPenta(index1,index2,index3,index4,3,3); … … 590 590 int i,j,ig,index1,index2,index3,index4; 591 591 int fill; 592 double pressure,rho_water,gravity;593 double water_pressure,air_pressure;594 double Jdet,z_g;595 double xyz_list[NUMVERTICESQUA][3];596 double normal[3];597 double l1l4[4];592 IssmDouble pressure,rho_water,gravity; 593 IssmDouble water_pressure,air_pressure; 594 IssmDouble Jdet,z_g; 595 IssmDouble xyz_list[NUMVERTICESQUA][3]; 596 IssmDouble normal[3]; 597 IssmDouble l1l4[4]; 598 598 GaussPenta *gauss = NULL; 599 599 … … 618 618 619 619 /* Start looping on the number of gaussian points: */ 620 double zmax=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];621 double zmin=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];620 IssmDouble zmax=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2]; 621 IssmDouble zmin=xyz_list[0][2]; for(i=1;i<NUMVERTICESQUA;i++) if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2]; 622 622 if(zmax>0 && zmin<0) gauss=new GaussPenta(index1,index2,index3,index4,3,30); //refined in vertical because of the sea level discontinuity 623 623 else gauss=new GaussPenta(index1,index2,index3,index4,3,3); … … 705 705 /*}}}*/ 706 706 /*FUNCTION Icefront::GetSegmentNormal {{{*/ 707 void Icefront:: GetSegmentNormal( double* normal,double xyz_list[4][3]){707 void Icefront:: GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]){ 708 708 709 709 /*Build unit outward pointing vector*/ 710 710 const int numnodes=NUMVERTICESSEG; 711 double vector[2];712 double norm;711 IssmDouble vector[2]; 712 IssmDouble norm; 713 713 714 714 vector[0]=xyz_list[1][0] - xyz_list[0][0]; … … 722 722 /*}}}*/ 723 723 /*FUNCTION Icefront::GetQuadNormal {{{*/ 724 void Icefront:: GetQuadNormal( double* normal,double xyz_list[4][3]){724 void Icefront:: GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]){ 725 725 726 726 /*Build unit outward pointing vector*/ 727 double AB[3];728 double AC[3];729 double norm;727 IssmDouble AB[3]; 728 IssmDouble AC[3]; 729 IssmDouble norm; 730 730 731 731 AB[0]=xyz_list[1][0] - xyz_list[0][0]; -
issm/trunk-jpl/src/c/objects/Loads/Icefront.h
r12365 r12472 53 53 /*}}}*/ 54 54 /*Update virtual functions definitions: {{{*/ 55 void InputUpdateFromVector( double* vector, int name, int type);55 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 56 56 void InputUpdateFromVector(int* vector, int name, int type); 57 57 void InputUpdateFromVector(bool* vector, int name, int type); 58 void InputUpdateFromMatrixDakota( double* matrix,int ncols,int nrows, int name, int type);59 void InputUpdateFromVectorDakota( double* vector, int name, int type);58 void InputUpdateFromMatrixDakota(IssmDouble* matrix,int ncols,int nrows, int name, int type); 59 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 60 60 void InputUpdateFromVectorDakota(int* vector, int name, int type); 61 61 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 62 void InputUpdateFromConstant( double constant, int name);62 void InputUpdateFromConstant(IssmDouble constant, int name); 63 63 void InputUpdateFromConstant(int constant, int name); 64 64 void InputUpdateFromConstant(bool constant, int name); 65 void InputUpdateFromSolution( double* solution);65 void InputUpdateFromSolution(IssmDouble* solution); 66 66 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");}; 67 67 /*}}}*/ … … 72 72 void CreatePVector(Vector* pf); 73 73 void CreateJacobianMatrix(Matrix* Jff); 74 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, double kmax);75 void PenaltyCreatePVector(Vector* pf, double kmax);76 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax);74 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax); 75 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 76 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax); 77 77 bool InAnalysis(int analysis_type); 78 78 /*}}}*/ 79 79 /*Load management: {{{*/ 80 80 void GetDofList(int** pdoflist,int approximation_enum,int setenum); 81 void GetSegmentNormal( double* normal,double xyz_list[2][3]);82 void GetQuadNormal( double* normal,double xyz_list[4][3]);81 void GetSegmentNormal(IssmDouble* normal,IssmDouble xyz_list[2][3]); 82 void GetQuadNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]); 83 83 #ifdef _HAVE_CONTROL_ 84 84 ElementVector* CreatePVectorAdjointHoriz(void); -
issm/trunk-jpl/src/c/objects/Loads/Load.h
r12365 r12472 32 32 virtual void CreatePVector(Vector* pf)=0; 33 33 virtual void CreateJacobianMatrix(Matrix* Jff)=0; 34 virtual void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax)=0;35 virtual void PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax)=0;36 virtual void PenaltyCreatePVector(Vector* pf, double kmax)=0;34 virtual void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax)=0; 35 virtual void PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, IssmDouble kmax)=0; 36 virtual void PenaltyCreatePVector(Vector* pf, IssmDouble kmax)=0; 37 37 virtual bool InAnalysis(int analysis_type)=0; 38 38 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Loads/Numericalflux.cpp
r12365 r12472 60 60 61 61 /*First, see wether this is an internal or boundary edge (if e2=NaN)*/ 62 if (isnan(( double)iomodel->Data(MeshEdgesEnum)[4*i+3])){ //edges are [node1 node2 elem1 elem2]62 if (isnan((IssmDouble)iomodel->Data(MeshEdgesEnum)[4*i+3])){ //edges are [node1 node2 elem1 elem2] 63 63 /* Boundary edge, only one element */ 64 64 e1=(int)iomodel->Data(MeshEdgesEnum)[4*i+2]; … … 312 312 /*}}}*/ 313 313 /*FUNCTION Numericalflux::PenaltyCreateKMatrix {{{*/ 314 void Numericalflux::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){314 void Numericalflux::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){ 315 315 316 316 /*No stiffness loads applied, do nothing: */ … … 320 320 /*}}}*/ 321 321 /*FUNCTION Numericalflux::PenaltyCreatePVector{{{*/ 322 void Numericalflux::PenaltyCreatePVector(Vector* pf, double kmax){322 void Numericalflux::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 323 323 324 324 /*No penalty loads applied, do nothing: */ … … 359 359 /* Intermediaries*/ 360 360 int i,j,ig,index1,index2; 361 double DL1,DL2,Jdet,dt,vx,vy,UdotN;362 double xyz_list[NUMVERTICES_INTERNAL][3];363 double normal[2];364 double B[numdof];365 double Bprime[numdof];366 double Ke_g1[numdof][numdof];367 double Ke_g2[numdof][numdof];361 IssmDouble DL1,DL2,Jdet,dt,vx,vy,UdotN; 362 IssmDouble xyz_list[NUMVERTICES_INTERNAL][3]; 363 IssmDouble normal[2]; 364 IssmDouble B[numdof]; 365 IssmDouble Bprime[numdof]; 366 IssmDouble Ke_g1[numdof][numdof]; 367 IssmDouble Ke_g2[numdof][numdof]; 368 368 GaussTria *gauss; 369 369 … … 424 424 /* Intermediaries*/ 425 425 int i,j,ig,index1,index2; 426 double DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN;427 double xyz_list[NUMVERTICES_BOUNDARY][3];428 double normal[2];429 double L[numdof];430 double Ke_g[numdof][numdof];426 IssmDouble DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN; 427 IssmDouble xyz_list[NUMVERTICES_BOUNDARY][3]; 428 IssmDouble normal[2]; 429 IssmDouble L[numdof]; 430 IssmDouble Ke_g[numdof][numdof]; 431 431 GaussTria *gauss; 432 432 … … 512 512 /* Intermediaries*/ 513 513 int i,j,ig,index1,index2; 514 double DL1,DL2,Jdet,vx,vy,UdotN;515 double xyz_list[NUMVERTICES_INTERNAL][3];516 double normal[2];517 double B[numdof];518 double Bprime[numdof];519 double Ke_g1[numdof][numdof];520 double Ke_g2[numdof][numdof];514 IssmDouble DL1,DL2,Jdet,vx,vy,UdotN; 515 IssmDouble xyz_list[NUMVERTICES_INTERNAL][3]; 516 IssmDouble normal[2]; 517 IssmDouble B[numdof]; 518 IssmDouble Bprime[numdof]; 519 IssmDouble Ke_g1[numdof][numdof]; 520 IssmDouble Ke_g2[numdof][numdof]; 521 521 GaussTria *gauss; 522 522 … … 576 576 /* Intermediaries*/ 577 577 int i,j,ig,index1,index2; 578 double DL,Jdet,vx,vy,mean_vx,mean_vy,UdotN;579 double xyz_list[NUMVERTICES_BOUNDARY][3];580 double normal[2];581 double L[numdof];582 double Ke_g[numdof][numdof];578 IssmDouble DL,Jdet,vx,vy,mean_vx,mean_vy,UdotN; 579 IssmDouble xyz_list[NUMVERTICES_BOUNDARY][3]; 580 IssmDouble normal[2]; 581 IssmDouble L[numdof]; 582 IssmDouble Ke_g[numdof][numdof]; 583 583 GaussTria *gauss; 584 584 … … 703 703 /* Intermediaries*/ 704 704 int i,j,ig,index1,index2; 705 double DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN,thickness;706 double xyz_list[NUMVERTICES_BOUNDARY][3];707 double normal[2];708 double L[numdof];705 IssmDouble DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN,thickness; 706 IssmDouble xyz_list[NUMVERTICES_BOUNDARY][3]; 707 IssmDouble normal[2]; 708 IssmDouble L[numdof]; 709 709 GaussTria *gauss; 710 710 … … 797 797 /* Intermediaries*/ 798 798 int i,j,ig,index1,index2; 799 double DL,Jdet,vx,vy,mean_vx,mean_vy,UdotN,thickness;800 double xyz_list[NUMVERTICES_BOUNDARY][3];801 double normal[2];802 double L[numdof];799 IssmDouble DL,Jdet,vx,vy,mean_vx,mean_vy,UdotN,thickness; 800 IssmDouble xyz_list[NUMVERTICES_BOUNDARY][3]; 801 IssmDouble normal[2]; 802 IssmDouble L[numdof]; 803 803 GaussTria *gauss; 804 804 … … 864 864 /*}}}*/ 865 865 /*FUNCTION Numericalflux::GetNormal {{{*/ 866 void Numericalflux:: GetNormal( double* normal,double xyz_list[4][3]){866 void Numericalflux:: GetNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]){ 867 867 868 868 /*Build unit outward pointing vector*/ 869 double vector[2];870 double norm;869 IssmDouble vector[2]; 870 IssmDouble norm; 871 871 872 872 vector[0]=xyz_list[1][0] - xyz_list[0][0]; -
issm/trunk-jpl/src/c/objects/Loads/Numericalflux.h
r12365 r12472 49 49 /*}}}*/ 50 50 /*Update virtual functions resolution: {{{*/ 51 void InputUpdateFromVector( double* vector, int name, int type){/*Do nothing*/}51 void InputUpdateFromVector(IssmDouble* vector, int name, int type){/*Do nothing*/} 52 52 void InputUpdateFromVector(int* vector, int name, int type){_error_("Not implemented yet!");} 53 53 void InputUpdateFromVector(bool* vector, int name, int type){_error_("Not implemented yet!");} 54 void InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){/*Do nothing*/}55 void InputUpdateFromVectorDakota( double* vector, int name, int type){/*Do nothing*/}54 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){/*Do nothing*/} 55 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){/*Do nothing*/} 56 56 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error_("Not implemented yet!");} 57 57 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error_("Not implemented yet!");} 58 void InputUpdateFromConstant( double constant, int name){/*Do nothing*/};58 void InputUpdateFromConstant(IssmDouble constant, int name){/*Do nothing*/}; 59 59 void InputUpdateFromConstant(int constant, int name){/*Do nothing*/}; 60 60 void InputUpdateFromConstant(bool constant, int name){_error_("Not implemented yet!");} 61 void InputUpdateFromSolution( double* solution){_error_("Not implemented yet!");}61 void InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");} 62 62 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");}; 63 63 /*}}}*/ … … 68 68 void CreatePVector(Vector* pf); 69 69 void CreateJacobianMatrix(Matrix* Jff){_error_("Not implemented yet");}; 70 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){_error_("Not implemented yet");};71 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, double kmax);72 void PenaltyCreatePVector(Vector* pf, double kmax);70 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error_("Not implemented yet");}; 71 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax); 72 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 73 73 bool InAnalysis(int analysis_type); 74 74 /*}}}*/ 75 75 /*Numericalflux management:{{{*/ 76 void GetNormal( double* normal,double xyz_list[4][3]);76 void GetNormal(IssmDouble* normal,IssmDouble xyz_list[4][3]); 77 77 ElementMatrix* CreateKMatrixPrognostic(void); 78 78 ElementMatrix* CreateKMatrixPrognosticInternal(void); -
issm/trunk-jpl/src/c/objects/Loads/Pengrid.cpp
r12365 r12472 217 217 /*}}}*/ 218 218 /*FUNCTION Pengrid::PenaltyCreateMatrix {{{*/ 219 void Pengrid::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){219 void Pengrid::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){ 220 220 221 221 /*Retrieve parameters: */ … … 250 250 /*}}}*/ 251 251 /*FUNCTION Pengrid::PenaltyCreatePVector {{{*/ 252 void Pengrid::PenaltyCreatePVector(Vector* pf, double kmax){252 void Pengrid::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 253 253 254 254 /*Retrieve parameters: */ … … 289 289 290 290 /*Update virtual functions definitions:*/ 291 /*FUNCTION Pengrid::InputUpdateFromVector( double* vector, int name, int type) {{{*/292 void Pengrid::InputUpdateFromVector( double* vector, int name, int type){291 /*FUNCTION Pengrid::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 292 void Pengrid::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 293 293 /*Nothing updated yet*/ 294 294 } … … 304 304 } 305 305 /*}}}*/ 306 /*FUNCTION Pengrid::InputUpdateFromMatrixDakota( double* vector, int nrows, int ncols, int name, int type) {{{*/307 void Pengrid::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols, int name, int type){308 /*Nothing updated yet*/ 309 } 310 /*}}}*/ 311 /*FUNCTION Pengrid::InputUpdateFromVectorDakota( double* vector, int name, int type) {{{*/312 void Pengrid::InputUpdateFromVectorDakota( double* vector, int name, int type){306 /*FUNCTION Pengrid::InputUpdateFromMatrixDakota(IssmDouble* vector, int nrows, int ncols, int name, int type) {{{*/ 307 void Pengrid::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){ 308 /*Nothing updated yet*/ 309 } 310 /*}}}*/ 311 /*FUNCTION Pengrid::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 312 void Pengrid::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 313 313 /*Nothing updated yet*/ 314 314 } … … 324 324 } 325 325 /*}}}*/ 326 /*FUNCTION Pengrid::InputUpdateFromConstant( double constant, int name) {{{*/327 void Pengrid::InputUpdateFromConstant( double constant, int name){326 /*FUNCTION Pengrid::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 327 void Pengrid::InputUpdateFromConstant(IssmDouble constant, int name){ 328 328 switch(name){ 329 329 … … 353 353 /*}}}*/ 354 354 /*FUNCTION Pengrid::InputUpdateFromSolution{{{*/ 355 void Pengrid::InputUpdateFromSolution( double* solution){355 void Pengrid::InputUpdateFromSolution(IssmDouble* solution){ 356 356 /*Nothing updated yet*/ 357 357 } … … 391 391 int found=0; 392 392 const int numnodes=1; 393 double pressure;394 double temperature;395 double t_pmp;393 IssmDouble pressure; 394 IssmDouble temperature; 395 IssmDouble t_pmp; 396 396 int new_active; 397 397 int unstable=0; … … 455 455 #ifdef _HAVE_DIAGNOSTIC_ 456 456 /*FUNCTION Pengrid::PenaltyCreateKMatrixDiagnosticStokes {{{*/ 457 ElementMatrix* Pengrid::PenaltyCreateKMatrixDiagnosticStokes( double kmax){457 ElementMatrix* Pengrid::PenaltyCreateKMatrixDiagnosticStokes(IssmDouble kmax){ 458 458 459 459 const int numdof = NUMVERTICES *NDOF4; 460 double slope[2];461 double penalty_offset;460 IssmDouble slope[2]; 461 IssmDouble penalty_offset; 462 462 int approximation; 463 463 … … 475 475 476 476 /*Create elementary matrix: add penalty to constrain wb (wb=ub*db/dx+vb*db/dy)*/ 477 Ke->values[2*NDOF4+0]=-slope[0]*kmax*pow(( double)10.0,penalty_offset);478 Ke->values[2*NDOF4+1]=-slope[1]*kmax*pow(( double)10.0,penalty_offset);479 Ke->values[2*NDOF4+2]= kmax*pow(( double)10,penalty_offset);477 Ke->values[2*NDOF4+0]=-slope[0]*kmax*pow((IssmDouble)10.0,penalty_offset); 478 Ke->values[2*NDOF4+1]=-slope[1]*kmax*pow((IssmDouble)10.0,penalty_offset); 479 Ke->values[2*NDOF4+2]= kmax*pow((IssmDouble)10,penalty_offset); 480 480 481 481 /*Transform Coordinate System*/ … … 489 489 #ifdef _HAVE_THERMAL_ 490 490 /*FUNCTION Pengrid::PenaltyCreateKMatrixMelting {{{*/ 491 ElementMatrix* Pengrid::PenaltyCreateKMatrixMelting( double kmax){491 ElementMatrix* Pengrid::PenaltyCreateKMatrixMelting(IssmDouble kmax){ 492 492 493 493 const int numdof=NUMVERTICES*NDOF1; 494 double pressure,temperature,t_pmp;495 double penalty_factor;494 IssmDouble pressure,temperature,t_pmp; 495 IssmDouble penalty_factor; 496 496 497 497 Penta* penta=(Penta*)element; … … 511 511 /*Add penalty load*/ 512 512 if (temperature<t_pmp){ //If T<Tpmp, there must be no melting. Therefore, melting should be constrained to 0 when T<Tpmp, instead of using spcs, use penalties 513 Ke->values[0]=kmax*pow(( double)10,penalty_factor);513 Ke->values[0]=kmax*pow((IssmDouble)10,penalty_factor); 514 514 } 515 515 … … 519 519 /*}}}*/ 520 520 /*FUNCTION Pengrid::PenaltyCreateKMatrixThermal {{{*/ 521 ElementMatrix* Pengrid::PenaltyCreateKMatrixThermal( double kmax){521 ElementMatrix* Pengrid::PenaltyCreateKMatrixThermal(IssmDouble kmax){ 522 522 523 523 const int numdof=NUMVERTICES*NDOF1; 524 double penalty_factor;524 IssmDouble penalty_factor; 525 525 526 526 /*Initialize Element matrix and return if necessary*/ … … 531 531 parameters->FindParam(&penalty_factor,ThermalPenaltyFactorEnum); 532 532 533 Ke->values[0]=kmax*pow(( double)10,penalty_factor);533 Ke->values[0]=kmax*pow((IssmDouble)10,penalty_factor); 534 534 535 535 /*Clean up and return*/ … … 538 538 /*}}}*/ 539 539 /*FUNCTION Pengrid::PenaltyCreatePVectorMelting {{{*/ 540 ElementVector* Pengrid::PenaltyCreatePVectorMelting( double kmax){540 ElementVector* Pengrid::PenaltyCreatePVectorMelting(IssmDouble kmax){ 541 541 542 542 const int numdof=NUMVERTICES*NDOF1; 543 double pressure;544 double temperature;545 double melting_offset;546 double t_pmp;547 double dt,penalty_factor;543 IssmDouble pressure; 544 IssmDouble temperature; 545 IssmDouble melting_offset; 546 IssmDouble t_pmp; 547 IssmDouble dt,penalty_factor; 548 548 549 549 /*recover pointers: */ … … 572 572 } 573 573 else{ 574 if (dt) pe->values[0]=melting_offset*pow(( double)10,penalty_factor)*(temperature-t_pmp)/dt;575 else pe->values[0]=melting_offset*pow(( double)10,penalty_factor)*(temperature-t_pmp);574 if (dt) pe->values[0]=melting_offset*pow((IssmDouble)10,penalty_factor)*(temperature-t_pmp)/dt; 575 else pe->values[0]=melting_offset*pow((IssmDouble)10,penalty_factor)*(temperature-t_pmp); 576 576 } 577 577 … … 581 581 /*}}}*/ 582 582 /*FUNCTION Pengrid::PenaltyCreatePVectorThermal {{{*/ 583 ElementVector* Pengrid::PenaltyCreatePVectorThermal( double kmax){583 ElementVector* Pengrid::PenaltyCreatePVectorThermal(IssmDouble kmax){ 584 584 585 585 const int numdof=NUMVERTICES*NDOF1; 586 double pressure;587 double t_pmp;588 double penalty_factor;586 IssmDouble pressure; 587 IssmDouble t_pmp; 588 IssmDouble penalty_factor; 589 589 590 590 Penta* penta=(Penta*)element; … … 601 601 t_pmp=matpar->GetMeltingPoint()-matpar->GetBeta()*pressure; 602 602 603 pe->values[0]=kmax*pow(( double)10,penalty_factor)*t_pmp;603 pe->values[0]=kmax*pow((IssmDouble)10,penalty_factor)*t_pmp; 604 604 605 605 /*Clean up and return*/ … … 615 615 /*}}}*/ 616 616 /*FUNCTION Pengrid::UpdateInputs {{{*/ 617 void Pengrid::UpdateInputs( double* solution){617 void Pengrid::UpdateInputs(IssmDouble* solution){ 618 618 _error_("not supported yet!"); 619 619 } -
issm/trunk-jpl/src/c/objects/Loads/Pengrid.h
r12365 r12472 54 54 /*}}}*/ 55 55 /*Update virtual functions resolution: {{{*/ 56 void InputUpdateFromVector( double* vector, int name, int type);56 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 57 57 void InputUpdateFromVector(int* vector, int name, int type); 58 58 void InputUpdateFromVector(bool* vector, int name, int type); 59 void InputUpdateFromMatrixDakota( double* matrix ,int nrows, int ncols, int name, int type);60 void InputUpdateFromVectorDakota( double* vector, int name, int type);59 void InputUpdateFromMatrixDakota(IssmDouble* matrix ,int nrows, int ncols, int name, int type); 60 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 61 61 void InputUpdateFromVectorDakota(int* vector, int name, int type); 62 62 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 63 void InputUpdateFromConstant( double constant, int name);63 void InputUpdateFromConstant(IssmDouble constant, int name); 64 64 void InputUpdateFromConstant(int constant, int name); 65 65 void InputUpdateFromConstant(bool constant, int name); 66 void InputUpdateFromSolution( double* solution);66 void InputUpdateFromSolution(IssmDouble* solution); 67 67 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");}; 68 68 /*}}}*/ … … 73 73 void CreatePVector(Vector* pf); 74 74 void CreateJacobianMatrix(Matrix* Jff){_error_("Not implemented yet");}; 75 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){_error_("Not implemented yet");};76 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, double kmax);77 void PenaltyCreatePVector(Vector* pf, double kmax);75 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error_("Not implemented yet");}; 76 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax); 77 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 78 78 bool InAnalysis(int analysis_type); 79 79 /*}}}*/ 80 80 /*Pengrid management {{{*/ 81 81 #ifdef _HAVE_DIAGNOSTIC_ 82 ElementMatrix* PenaltyCreateKMatrixDiagnosticStokes( double kmax);82 ElementMatrix* PenaltyCreateKMatrixDiagnosticStokes(IssmDouble kmax); 83 83 #endif 84 84 #ifdef _HAVE_THERMAL_ 85 ElementMatrix* PenaltyCreateKMatrixThermal( double kmax);86 ElementMatrix* PenaltyCreateKMatrixMelting( double kmax);87 ElementVector* PenaltyCreatePVectorThermal( double kmax);88 ElementVector* PenaltyCreatePVectorMelting( double kmax);85 ElementMatrix* PenaltyCreateKMatrixThermal(IssmDouble kmax); 86 ElementMatrix* PenaltyCreateKMatrixMelting(IssmDouble kmax); 87 ElementVector* PenaltyCreatePVectorThermal(IssmDouble kmax); 88 ElementVector* PenaltyCreatePVectorMelting(IssmDouble kmax); 89 89 #endif 90 90 void ConstraintActivate(int* punstable); 91 91 void ConstraintActivateThermal(int* punstable); 92 void UpdateInputs( double* solution);92 void UpdateInputs(IssmDouble* solution); 93 93 void ResetConstraint(void); 94 94 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Loads/Penpair.cpp
r12365 r12472 157 157 /*}}}*/ 158 158 /*FUNCTION Penpair::PenaltyCreateKMatrix {{{*/ 159 void Penpair::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){159 void Penpair::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){ 160 160 161 161 /*Retrieve parameters: */ … … 183 183 /*}}}*/ 184 184 /*FUNCTION Penpair::PenaltyCreatePVector {{{*/ 185 void Penpair::PenaltyCreatePVector(Vector* pf, double kmax){185 void Penpair::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 186 186 /*No loads applied, do nothing: */ 187 187 return; … … 189 189 /*}}}*/ 190 190 /*FUNCTION Penpair::PenaltyCreateJacobianMatrix{{{*/ 191 void Penpair::PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){191 void Penpair::PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){ 192 192 this->PenaltyCreateKMatrix(Jff,NULL,kmax); 193 193 } … … 201 201 202 202 /*Update virtual functions definitions:*/ 203 /*FUNCTION Penpair::InputUpdateFromConstant( double constant, int name) {{{*/204 void Penpair::InputUpdateFromConstant( double constant, int name){203 /*FUNCTION Penpair::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 204 void Penpair::InputUpdateFromConstant(IssmDouble constant, int name){ 205 205 /*Nothing updated yet*/ 206 206 } … … 216 216 } 217 217 /*}}}*/ 218 /*FUNCTION Penpair::InputUpdateFromVector( double* vector, int name, int type) {{{*/219 void Penpair::InputUpdateFromVector( double* vector, int name, int type){218 /*FUNCTION Penpair::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 219 void Penpair::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 220 220 /*Nothing updated yet*/ 221 221 } … … 234 234 /*Penpair management:*/ 235 235 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticHoriz{{{*/ 236 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticHoriz( double kmax){236 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticHoriz(IssmDouble kmax){ 237 237 238 238 int approximation0=nodes[0]->GetApproximation(); … … 269 269 /*}}}*/ 270 270 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticMacAyealPattyn {{{*/ 271 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticMacAyealPattyn( double kmax){271 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticMacAyealPattyn(IssmDouble kmax){ 272 272 273 273 const int numdof=NUMVERTICES*NDOF2; 274 double penalty_offset;274 IssmDouble penalty_offset; 275 275 276 276 /*Initialize Element vector and return if necessary*/ … … 281 281 282 282 //Create elementary matrix: add penalty to 283 Ke->values[0*numdof+0]=+kmax*pow(( double)10.0,penalty_offset);284 Ke->values[0*numdof+2]=-kmax*pow(( double)10.0,penalty_offset);285 Ke->values[2*numdof+0]=-kmax*pow(( double)10.0,penalty_offset);286 Ke->values[2*numdof+2]=+kmax*pow(( double)10.0,penalty_offset);287 288 Ke->values[1*numdof+1]=+kmax*pow(( double)10.0,penalty_offset);289 Ke->values[1*numdof+3]=-kmax*pow(( double)10.0,penalty_offset);290 Ke->values[3*numdof+1]=-kmax*pow(( double)10.0,penalty_offset);291 Ke->values[3*numdof+3]=+kmax*pow(( double)10.0,penalty_offset);283 Ke->values[0*numdof+0]=+kmax*pow((IssmDouble)10.0,penalty_offset); 284 Ke->values[0*numdof+2]=-kmax*pow((IssmDouble)10.0,penalty_offset); 285 Ke->values[2*numdof+0]=-kmax*pow((IssmDouble)10.0,penalty_offset); 286 Ke->values[2*numdof+2]=+kmax*pow((IssmDouble)10.0,penalty_offset); 287 288 Ke->values[1*numdof+1]=+kmax*pow((IssmDouble)10.0,penalty_offset); 289 Ke->values[1*numdof+3]=-kmax*pow((IssmDouble)10.0,penalty_offset); 290 Ke->values[3*numdof+1]=-kmax*pow((IssmDouble)10.0,penalty_offset); 291 Ke->values[3*numdof+3]=+kmax*pow((IssmDouble)10.0,penalty_offset); 292 292 293 293 /*Clean up and return*/ … … 296 296 /*}}}*/ 297 297 /*FUNCTION Penpair::PenaltyCreateKMatrixDiagnosticStokes {{{*/ 298 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticStokes( double kmax){298 ElementMatrix* Penpair::PenaltyCreateKMatrixDiagnosticStokes(IssmDouble kmax){ 299 299 300 300 const int numdof=NUMVERTICES*NDOF4; 301 double penalty_offset;301 IssmDouble penalty_offset; 302 302 303 303 /*Initialize Element vector and return if necessary*/ … … 308 308 309 309 //Create elementary matrix: add penalty to 310 Ke->values[0*numdof+0]=+kmax*pow(( double)10.0,penalty_offset);311 Ke->values[0*numdof+4]=-kmax*pow(( double)10.0,penalty_offset);312 Ke->values[4*numdof+0]=-kmax*pow(( double)10.0,penalty_offset);313 Ke->values[4*numdof+4]=+kmax*pow(( double)10.0,penalty_offset);314 315 Ke->values[1*numdof+1]=+kmax*pow(( double)10.0,penalty_offset);316 Ke->values[1*numdof+5]=-kmax*pow(( double)10.0,penalty_offset);317 Ke->values[5*numdof+1]=-kmax*pow(( double)10.0,penalty_offset);318 Ke->values[5*numdof+5]=+kmax*pow(( double)10.0,penalty_offset);319 320 Ke->values[2*numdof+2]=+kmax*pow(( double)10.0,penalty_offset);321 Ke->values[2*numdof+6]=-kmax*pow(( double)10.0,penalty_offset);322 Ke->values[6*numdof+2]=-kmax*pow(( double)10.0,penalty_offset);323 Ke->values[6*numdof+6]=+kmax*pow(( double)10.0,penalty_offset);324 325 Ke->values[3*numdof+3]=+kmax*pow(( double)10.0,penalty_offset);326 Ke->values[3*numdof+7]=-kmax*pow(( double)10.0,penalty_offset);327 Ke->values[7*numdof+3]=-kmax*pow(( double)10.0,penalty_offset);328 Ke->values[7*numdof+7]=+kmax*pow(( double)10.0,penalty_offset);310 Ke->values[0*numdof+0]=+kmax*pow((IssmDouble)10.0,penalty_offset); 311 Ke->values[0*numdof+4]=-kmax*pow((IssmDouble)10.0,penalty_offset); 312 Ke->values[4*numdof+0]=-kmax*pow((IssmDouble)10.0,penalty_offset); 313 Ke->values[4*numdof+4]=+kmax*pow((IssmDouble)10.0,penalty_offset); 314 315 Ke->values[1*numdof+1]=+kmax*pow((IssmDouble)10.0,penalty_offset); 316 Ke->values[1*numdof+5]=-kmax*pow((IssmDouble)10.0,penalty_offset); 317 Ke->values[5*numdof+1]=-kmax*pow((IssmDouble)10.0,penalty_offset); 318 Ke->values[5*numdof+5]=+kmax*pow((IssmDouble)10.0,penalty_offset); 319 320 Ke->values[2*numdof+2]=+kmax*pow((IssmDouble)10.0,penalty_offset); 321 Ke->values[2*numdof+6]=-kmax*pow((IssmDouble)10.0,penalty_offset); 322 Ke->values[6*numdof+2]=-kmax*pow((IssmDouble)10.0,penalty_offset); 323 Ke->values[6*numdof+6]=+kmax*pow((IssmDouble)10.0,penalty_offset); 324 325 Ke->values[3*numdof+3]=+kmax*pow((IssmDouble)10.0,penalty_offset); 326 Ke->values[3*numdof+7]=-kmax*pow((IssmDouble)10.0,penalty_offset); 327 Ke->values[7*numdof+3]=-kmax*pow((IssmDouble)10.0,penalty_offset); 328 Ke->values[7*numdof+7]=+kmax*pow((IssmDouble)10.0,penalty_offset); 329 329 330 330 /*Clean up and return*/ … … 333 333 /*}}}*/ 334 334 /*FUNCTION Penpair::PenaltyCreateKMatrixPrognostic {{{*/ 335 ElementMatrix* Penpair::PenaltyCreateKMatrixPrognostic( double kmax){335 ElementMatrix* Penpair::PenaltyCreateKMatrixPrognostic(IssmDouble kmax){ 336 336 337 337 const int numdof=NUMVERTICES*NDOF1; 338 double penalty_factor;338 IssmDouble penalty_factor; 339 339 340 340 /*Initialize Element vector and return if necessary*/ … … 345 345 346 346 //Create elementary matrix: add penalty to 347 Ke->values[0*numdof+0]=+kmax*pow(( double)10.0,penalty_factor);348 Ke->values[0*numdof+1]=-kmax*pow(( double)10.0,penalty_factor);349 Ke->values[1*numdof+0]=-kmax*pow(( double)10.0,penalty_factor);350 Ke->values[1*numdof+1]=+kmax*pow(( double)10.0,penalty_factor);347 Ke->values[0*numdof+0]=+kmax*pow((IssmDouble)10.0,penalty_factor); 348 Ke->values[0*numdof+1]=-kmax*pow((IssmDouble)10.0,penalty_factor); 349 Ke->values[1*numdof+0]=-kmax*pow((IssmDouble)10.0,penalty_factor); 350 Ke->values[1*numdof+1]=+kmax*pow((IssmDouble)10.0,penalty_factor); 351 351 352 352 /*Clean up and return*/ -
issm/trunk-jpl/src/c/objects/Loads/Penpair.h
r12365 r12472 41 41 /*}}}*/ 42 42 /*Update virtual functions resolution: {{{*/ 43 void InputUpdateFromVector( double* vector, int name, int type);43 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 44 44 void InputUpdateFromVector(int* vector, int name, int type); 45 45 void InputUpdateFromVector(bool* vector, int name, int type); 46 void InputUpdateFromMatrixDakota( double* matrix, int nrow, int ncols,int name, int type){_error_("Not implemented yet!");}47 void InputUpdateFromVectorDakota( double* vector, int name, int type){_error_("Not implemented yet!");}46 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrow, int ncols,int name, int type){_error_("Not implemented yet!");} 47 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("Not implemented yet!");} 48 48 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error_("Not implemented yet!");} 49 49 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error_("Not implemented yet!");} 50 void InputUpdateFromConstant( double constant, int name);50 void InputUpdateFromConstant(IssmDouble constant, int name); 51 51 void InputUpdateFromConstant(int constant, int name); 52 52 void InputUpdateFromConstant(bool constant, int name); 53 void InputUpdateFromSolution( double* solution){_error_("Not implemented yet!");}53 void InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");} 54 54 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");}; 55 55 /*}}}*/ … … 60 60 void CreatePVector(Vector* pf); 61 61 void CreateJacobianMatrix(Matrix* Jff); 62 void PenaltyCreateKMatrix(Matrix* Kff,Matrix* Kfs, double kmax);63 void PenaltyCreatePVector(Vector* pf, double kmax);64 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax);62 void PenaltyCreateKMatrix(Matrix* Kff,Matrix* Kfs,IssmDouble kmax); 63 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 64 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax); 65 65 bool InAnalysis(int analysis_type); 66 66 /*}}}*/ 67 67 /*Penpair management: {{{*/ 68 ElementMatrix* PenaltyCreateKMatrixDiagnosticHoriz( double kmax);69 ElementMatrix* PenaltyCreateKMatrixDiagnosticMacAyealPattyn( double kmax);70 ElementMatrix* PenaltyCreateKMatrixDiagnosticStokes( double kmax);71 ElementMatrix* PenaltyCreateKMatrixPrognostic( double kmax);68 ElementMatrix* PenaltyCreateKMatrixDiagnosticHoriz(IssmDouble kmax); 69 ElementMatrix* PenaltyCreateKMatrixDiagnosticMacAyealPattyn(IssmDouble kmax); 70 ElementMatrix* PenaltyCreateKMatrixDiagnosticStokes(IssmDouble kmax); 71 ElementMatrix* PenaltyCreateKMatrixPrognostic(IssmDouble kmax); 72 72 /*}}}*/ 73 73 }; -
issm/trunk-jpl/src/c/objects/Loads/Riftfront.cpp
r12365 r12472 45 45 int riftfront_type; 46 46 int riftfront_fill; 47 double riftfront_friction;48 double riftfront_fractionincrement;47 IssmDouble riftfront_friction; 48 IssmDouble riftfront_fractionincrement; 49 49 bool riftfront_shelf; 50 50 int numberofelements; … … 135 135 Input* input=NULL; 136 136 int fill; 137 double friction,fractionincrement;137 IssmDouble friction,fractionincrement; 138 138 139 139 … … 258 258 } 259 259 /*}}}*/ 260 /*FUNCTION Riftfront::InputUpdateFromConstant( double constant,int name) {{{*/261 void Riftfront::InputUpdateFromConstant( double constant,int name){260 /*FUNCTION Riftfront::InputUpdateFromConstant(IssmDouble constant,int name) {{{*/ 261 void Riftfront::InputUpdateFromConstant(IssmDouble constant,int name){ 262 262 263 263 /*Check that name is a Riftfront input*/ … … 269 269 } 270 270 /*}}}*/ 271 /*FUNCTION Riftfront::InputUpdateFromConstant( double* constant,int name) {{{*/272 void Riftfront::InputUpdateFromVector( double* vector, int name, int type){271 /*FUNCTION Riftfront::InputUpdateFromConstant(IssmDouble* constant,int name) {{{*/ 272 void Riftfront::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 273 273 274 274 /*Check that name is a Riftfront input*/ … … 309 309 /*}}}*/ 310 310 /*FUNCTION Riftfront::PenaltyCreateKMatrix {{{*/ 311 void Riftfront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, double kmax){311 void Riftfront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){ 312 312 313 313 /*Retrieve parameters: */ … … 335 335 /*}}}*/ 336 336 /*FUNCTION Riftfront::PenaltyCreatePVector {{{*/ 337 void Riftfront::PenaltyCreatePVector(Vector* pf, double kmax){337 void Riftfront::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){ 338 338 339 339 /*Retrieve parameters: */ … … 381 381 /*Riftfront numerics*/ 382 382 /*FUNCTION Riftfront::PenaltyCreateKMatrixDiagnosticHoriz {{{*/ 383 ElementMatrix* Riftfront::PenaltyCreateKMatrixDiagnosticHoriz( double kmax){383 ElementMatrix* Riftfront::PenaltyCreateKMatrixDiagnosticHoriz(IssmDouble kmax){ 384 384 385 385 const int numdof = NDOF2*NUMVERTICES; 386 386 int i,j; 387 387 int dofs[1] = {0}; 388 double Ke_gg[4][4];389 double thickness;390 double h[2];391 double penalty_offset;392 double friction;388 IssmDouble Ke_gg[4][4]; 389 IssmDouble thickness; 390 IssmDouble h[2]; 391 IssmDouble penalty_offset; 392 IssmDouble friction; 393 393 394 394 /*Objects: */ … … 464 464 /*}}}*/ 465 465 /*FUNCTION Riftfront::PenaltyCreatePVectorDiagnosticHoriz {{{*/ 466 ElementVector* Riftfront::PenaltyCreatePVectorDiagnosticHoriz( double kmax){466 ElementVector* Riftfront::PenaltyCreatePVectorDiagnosticHoriz(IssmDouble kmax){ 467 467 468 468 const int numdof = NDOF2*NUMVERTICES; 469 469 int i,j; 470 double rho_ice;471 double rho_water;472 double gravity;473 double thickness;474 double h[2];475 double bed;476 double b[2];477 double pressure;478 double pressure_litho;479 double pressure_air;480 double pressure_melange;481 double pressure_water;470 IssmDouble rho_ice; 471 IssmDouble rho_water; 472 IssmDouble gravity; 473 IssmDouble thickness; 474 IssmDouble h[2]; 475 IssmDouble bed; 476 IssmDouble b[2]; 477 IssmDouble pressure; 478 IssmDouble pressure_litho; 479 IssmDouble pressure_air; 480 IssmDouble pressure_melange; 481 IssmDouble pressure_water; 482 482 int fill; 483 483 bool shelf; … … 521 521 if(shelf){ 522 522 /*We are on an ice shelf, hydrostatic equilibrium is used to determine the pressure for water fill: */ 523 pressure=rho_ice*gravity*pow(thickness,( double)2)/(double)2 - rho_water*gravity*pow(bed,(double)2)/(double)2;523 pressure=rho_ice*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2 - rho_water*gravity*pow(bed,(IssmDouble)2)/(IssmDouble)2; 524 524 } 525 525 else{ 526 526 //We are on an icesheet, we assume the water column fills the entire front: */ 527 pressure=rho_ice*gravity*pow(thickness,( double)2)/(double)2 - rho_water*gravity*pow(thickness,(double)2)/(double)2;527 pressure=rho_ice*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2 - rho_water*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2; 528 528 } 529 529 } 530 530 else if(fill==AirEnum){ 531 pressure=rho_ice*gravity*pow(thickness,( double)2)/(double)2; //icefront on an ice sheet, pressure imbalance ice vs air.531 pressure=rho_ice*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2; //icefront on an ice sheet, pressure imbalance ice vs air. 532 532 } 533 533 else if(fill==IceEnum){ //icefront finding itself against another icefront (pressure imbalance is fully compensated, ice vs ice) … … 538 538 if(!shelf) _error_("%s%i%s","fill type ",fill," not supported on ice sheets yet."); 539 539 540 pressure_litho=rho_ice*gravity*pow(thickness,( double)2)/(double)2;540 pressure_litho=rho_ice*gravity*pow(thickness,(IssmDouble)2)/(IssmDouble)2; 541 541 pressure_air=0; 542 pressure_melange=rho_ice*gravity*pow(fraction*thickness,( double)2)/(double)2;542 pressure_melange=rho_ice*gravity*pow(fraction*thickness,(IssmDouble)2)/(IssmDouble)2; 543 543 pressure_water=1.0/2.0*rho_water*gravity* ( pow(bed,2.0)-pow(rho_ice/rho_water*fraction*thickness,2.0) ); 544 544 … … 569 569 570 570 const int numnodes = 2; 571 double max_penetration;572 double penetration;571 IssmDouble max_penetration; 572 IssmDouble penetration; 573 573 int activate; 574 574 int found; 575 575 int unstable; 576 double vx1;577 double vy1;578 double vx2;579 double vy2;580 double fractionincrement;576 IssmDouble vx1; 577 IssmDouble vy1; 578 IssmDouble vx2; 579 IssmDouble vy2; 580 IssmDouble fractionincrement; 581 581 582 582 /*Objects: */ … … 632 632 /*increase melange fraction: */ 633 633 this->fraction+=fractionincrement; 634 if (this->fraction>1)this->fraction=( double)1.0;634 if (this->fraction>1)this->fraction=(IssmDouble)1.0; 635 635 //printf("riftfront %i fraction: %g\n",this->Id(),this->fraction); 636 636 } … … 675 675 676 676 int found=0; 677 double converged=0;677 IssmDouble converged=0; 678 678 679 679 this->inputs->GetInputValue(&converged,ConvergedEnum); … … 690 690 /*}}}*/ 691 691 /*FUNCTION Riftfront::MaxPenetration {{{*/ 692 int Riftfront::MaxPenetration( double* ppenetration){692 int Riftfront::MaxPenetration(IssmDouble* ppenetration){ 693 693 694 694 const int numnodes=2; 695 double max_penetration;696 double penetration=0;695 IssmDouble max_penetration; 696 IssmDouble penetration=0; 697 697 int found; 698 double vx1;699 double vy1;700 double vx2;701 double vy2;698 IssmDouble vx1; 699 IssmDouble vy1; 700 IssmDouble vx2; 701 IssmDouble vy2; 702 702 703 703 /*Objects: */ … … 736 736 /*}}}*/ 737 737 /*FUNCTION Riftfront::Penetration {{{*/ 738 int Riftfront::Penetration( double* ppenetration){739 740 double vx1;741 double vy1;742 double vx2;743 double vy2;744 745 double penetration;738 int Riftfront::Penetration(IssmDouble* ppenetration){ 739 740 IssmDouble vx1; 741 IssmDouble vy1; 742 IssmDouble vx2; 743 IssmDouble vy2; 744 745 IssmDouble penetration; 746 746 int found; 747 747 … … 779 779 780 780 const int numnodes = 2; 781 double max_penetration;782 double penetration;781 IssmDouble max_penetration; 782 IssmDouble penetration; 783 783 int activate; 784 784 int unstable; 785 785 int found; 786 double vx1;787 double vy1;788 double vx2;789 double vy2;786 IssmDouble vx1; 787 IssmDouble vy1; 788 IssmDouble vx2; 789 IssmDouble vy2; 790 790 791 791 /*Objects: */ … … 831 831 832 832 const int numnodes = 2; 833 double penetration;833 IssmDouble penetration; 834 834 int unstable; 835 835 int found; 836 double vx1;837 double vy1;838 double vx2;839 double vy2;836 IssmDouble vx1; 837 IssmDouble vy1; 838 IssmDouble vx2; 839 IssmDouble vy2; 840 840 841 841 /*Objects: */ -
issm/trunk-jpl/src/c/objects/Loads/Riftfront.h
r12365 r12472 38 38 bool prestable; 39 39 bool material_converged; 40 double normal[2];41 double length;42 double fraction;40 IssmDouble normal[2]; 41 IssmDouble length; 42 IssmDouble fraction; 43 43 int state; 44 44 … … 61 61 /*}}}*/ 62 62 /*Update virtual functions resolution: {{{*/ 63 void InputUpdateFromVector( double* vector, int name, int type);63 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 64 64 void InputUpdateFromVector(int* vector, int name, int type){_error_("Not implemented yet!");} 65 65 void InputUpdateFromVector(bool* vector, int name, int type){_error_("Not implemented yet!");} 66 void InputUpdateFromMatrixDakota( double* matrix, int nrows,int ncols, int name, int type){_error_("Not implemented yet!");}67 void InputUpdateFromVectorDakota( double* vector, int name, int type){_error_("Not implemented yet!");}66 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows,int ncols, int name, int type){_error_("Not implemented yet!");} 67 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){_error_("Not implemented yet!");} 68 68 void InputUpdateFromVectorDakota(int* vector, int name, int type){_error_("Not implemented yet!");} 69 69 void InputUpdateFromVectorDakota(bool* vector, int name, int type){_error_("Not implemented yet!");} 70 void InputUpdateFromConstant( double constant, int name);70 void InputUpdateFromConstant(IssmDouble constant, int name); 71 71 void InputUpdateFromConstant(int constant, int name){_error_("Not implemented yet!");} 72 72 void InputUpdateFromConstant(bool constant, int name); 73 void InputUpdateFromSolution( double* solution){_error_("Not implemented yet!");}73 void InputUpdateFromSolution(IssmDouble* solution){_error_("Not implemented yet!");} 74 74 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");}; 75 75 /*}}}*/ … … 80 80 void CreatePVector(Vector* pf); 81 81 void CreateJacobianMatrix(Matrix* Jff){_error_("Not implemented yet");}; 82 void PenaltyCreateJacobianMatrix(Matrix* Jff, double kmax){_error_("Not implemented yet");};83 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, double kmax);84 void PenaltyCreatePVector(Vector* pf, double kmax);82 void PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error_("Not implemented yet");}; 83 void PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax); 84 void PenaltyCreatePVector(Vector* pf, IssmDouble kmax); 85 85 bool InAnalysis(int analysis_type); 86 86 /*}}}*/ 87 87 /*Riftfront specific routines: {{{*/ 88 88 bool PreStable(); 89 ElementMatrix* PenaltyCreateKMatrixDiagnosticHoriz( double kmax);90 ElementVector* PenaltyCreatePVectorDiagnosticHoriz( double kmax);89 ElementMatrix* PenaltyCreateKMatrixDiagnosticHoriz(IssmDouble kmax); 90 ElementVector* PenaltyCreatePVectorDiagnosticHoriz(IssmDouble kmax); 91 91 void SetPreStable(); 92 92 int PreConstrain(int* punstable); … … 94 94 void FreezeConstraints(void); 95 95 bool IsFrozen(void); 96 int Penetration( double* ppenetration);97 int MaxPenetration( double* ppenetration);96 int Penetration(IssmDouble* ppenetration); 97 int MaxPenetration(IssmDouble* ppenetration); 98 98 int PotentialUnstableConstraint(int* punstable); 99 99 int IsMaterialStable(void); -
issm/trunk-jpl/src/c/objects/Materials/Matice.cpp
r12365 r12472 129 129 /*}}}*/ 130 130 /*FUNCTION Matice::GetB {{{*/ 131 double Matice::GetB(){131 IssmDouble Matice::GetB(){ 132 132 133 133 /*Output*/ 134 double B;134 IssmDouble B; 135 135 136 136 inputs->GetInputAverage(&B,MaterialsRheologyBEnum); … … 139 139 /*}}}*/ 140 140 /*FUNCTION Matice::GetBbar {{{*/ 141 double Matice::GetBbar(){141 IssmDouble Matice::GetBbar(){ 142 142 143 143 /*Output*/ 144 double Bbar;144 IssmDouble Bbar; 145 145 146 146 inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum); … … 149 149 /*}}}*/ 150 150 /*FUNCTION Matice::GetN {{{*/ 151 double Matice::GetN(){151 IssmDouble Matice::GetN(){ 152 152 153 153 /*Output*/ 154 double n;154 IssmDouble n; 155 155 156 156 inputs->GetInputAverage(&n,MaterialsRheologyNEnum); … … 191 191 /*}}}*/ 192 192 /*FUNCTION Matice::GetViscosity2d {{{*/ 193 void Matice::GetViscosity2d( double* pviscosity, double* epsilon){193 void Matice::GetViscosity2d(IssmDouble* pviscosity, IssmDouble* epsilon){ 194 194 /*From a string tensor and a material object, return viscosity, using Glen's flow law. 195 195 B … … 205 205 206 206 /*output: */ 207 double viscosity;207 IssmDouble viscosity; 208 208 209 209 /*input strain rate: */ 210 double exx,eyy,exy;210 IssmDouble exx,eyy,exy; 211 211 212 212 /*Intermediary: */ 213 double A,e;214 double B,n;213 IssmDouble A,e; 214 IssmDouble B,n; 215 215 216 216 /*Get B and n*/ … … 224 224 else{ 225 225 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){ 226 viscosity=0.5*pow(( double)10,(double)14);226 viscosity=0.5*pow((IssmDouble)10,(IssmDouble)14); 227 227 } 228 228 else{ … … 236 236 if(A==0){ 237 237 /*Maxiviscositym viscosity for 0 shear areas: */ 238 viscosity=2.5*pow(( double)10,(double)17);238 viscosity=2.5*pow((IssmDouble)10,(IssmDouble)17); 239 239 } 240 240 else{ … … 255 255 /*}}}*/ 256 256 /*FUNCTION Matice::GetViscosity3d {{{*/ 257 void Matice::GetViscosity3d( double* pviscosity3d, double* epsilon){257 void Matice::GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* epsilon){ 258 258 259 259 /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: … … 271 271 272 272 /*output: */ 273 double viscosity3d;273 IssmDouble viscosity3d; 274 274 275 275 /*input strain rate: */ 276 double exx,eyy,exy,exz,eyz;276 IssmDouble exx,eyy,exy,exz,eyz; 277 277 278 278 /*Intermediaries: */ 279 double A,e;280 double B,n;279 IssmDouble A,e; 280 IssmDouble B,n; 281 281 282 282 /*Get B and n*/ … … 291 291 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 292 292 (epsilon[3]==0) && (epsilon[4]==0)){ 293 viscosity3d=0.5*pow(( double)10,(double)14);293 viscosity3d=0.5*pow((IssmDouble)10,(IssmDouble)14); 294 294 } 295 295 else{ … … 306 306 if(A==0){ 307 307 /*Maxiviscosity3dm viscosity for 0 shear areas: */ 308 viscosity3d=2.25*pow(( double)10,(double)17);308 viscosity3d=2.25*pow((IssmDouble)10,(IssmDouble)17); 309 309 } 310 310 else{ … … 326 326 /*}}}*/ 327 327 /*FUNCTION Matice::GetViscosity3dStokes {{{*/ 328 void Matice::GetViscosity3dStokes( double* pviscosity3d, double* epsilon){328 void Matice::GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon){ 329 329 /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: 330 330 * … … 341 341 342 342 /*output: */ 343 double viscosity3d;343 IssmDouble viscosity3d; 344 344 345 345 /*input strain rate: */ 346 double exx,eyy,exy,exz,eyz,ezz;346 IssmDouble exx,eyy,exy,exz,eyz,ezz; 347 347 348 348 /*Intermediaries: */ 349 double A,e;350 double B,n;351 double eps0;349 IssmDouble A,e; 350 IssmDouble B,n; 351 IssmDouble eps0; 352 352 353 353 /*Get B and n*/ 354 eps0=pow(( double)10,(double)-27);354 eps0=pow((IssmDouble)10,(IssmDouble)-27); 355 355 B=GetB(); 356 356 n=GetN(); … … 363 363 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 364 364 (epsilon[3]==0) && (epsilon[4]==0) && (epsilon[5]==0)){ 365 viscosity3d=0.5*pow(( double)10,(double)14);365 viscosity3d=0.5*pow((IssmDouble)10,(IssmDouble)14); 366 366 } 367 367 else{ … … 379 379 if(A==0){ 380 380 /*Maxiviscosity3dm viscosity for 0 shear areas: */ 381 viscosity3d=2.25*pow(( double)10,(double)17);381 viscosity3d=2.25*pow((IssmDouble)10,(IssmDouble)17); 382 382 } 383 383 else{ … … 398 398 /*}}}*/ 399 399 /*FUNCTION Matice::GetViscosityComplement {{{*/ 400 void Matice::GetViscosityComplement( double* pviscosity_complement, double* epsilon){400 void Matice::GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* epsilon){ 401 401 /*Return viscosity accounting for steady state power law creep [Thomas and MacAyeal, 1982]: 402 402 * … … 410 410 411 411 /*output: */ 412 double viscosity_complement;412 IssmDouble viscosity_complement; 413 413 414 414 /*input strain rate: */ 415 double exx,eyy,exy;415 IssmDouble exx,eyy,exy; 416 416 417 417 /*Intermediary value A and exponent e: */ 418 double A,e;419 double B,n;418 IssmDouble A,e; 419 IssmDouble B,n; 420 420 421 421 /*Get B and n*/ … … 432 432 if(A==0){ 433 433 /*Maximum viscosity_complement for 0 shear areas: */ 434 viscosity_complement=2.25*pow(( double)10,(double)17);434 viscosity_complement=2.25*pow((IssmDouble)10,(IssmDouble)17); 435 435 } 436 436 else{ … … 441 441 } 442 442 else{ 443 viscosity_complement=4.5*pow(( double)10,(double)17);443 viscosity_complement=4.5*pow((IssmDouble)10,(IssmDouble)17); 444 444 } 445 445 … … 454 454 /*}}}*/ 455 455 /*FUNCTION Matice::GetViscosityDerivativeEpsSquare{{{*/ 456 void Matice::GetViscosityDerivativeEpsSquare( double* pmu_prime, double* epsilon){456 void Matice::GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){ 457 457 458 458 /*output: */ 459 double mu_prime;460 double mu,n,eff2;459 IssmDouble mu_prime; 460 IssmDouble mu,n,eff2; 461 461 462 462 /*input strain rate: */ 463 double exx,eyy,exy,exz,eyz;463 IssmDouble exx,eyy,exy,exz,eyz; 464 464 465 465 /*Get visocisty and n*/ … … 469 469 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 470 470 (epsilon[3]==0) && (epsilon[4]==0)){ 471 mu_prime=0.5*pow(( double)10,(double)14);471 mu_prime=0.5*pow((IssmDouble)10,(IssmDouble)14); 472 472 } 473 473 else{ … … 488 488 /*}}}*/ 489 489 /*FUNCTION Matice::GetViscosity2dDerivativeEpsSquare{{{*/ 490 void Matice::GetViscosity2dDerivativeEpsSquare( double* pmu_prime, double* epsilon){490 void Matice::GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){ 491 491 492 492 /*output: */ 493 double mu_prime;494 double mu,n,eff2;493 IssmDouble mu_prime; 494 IssmDouble mu,n,eff2; 495 495 496 496 /*input strain rate: */ 497 double exx,eyy,exy,exz;497 IssmDouble exx,eyy,exy,exz; 498 498 499 499 /*Get visocisty and n*/ … … 502 502 503 503 if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0)){ 504 mu_prime=0.5*pow(( double)10,(double)14);504 mu_prime=0.5*pow((IssmDouble)10,(IssmDouble)14); 505 505 } 506 506 else{ … … 526 526 } 527 527 /*}}}*/ 528 /*FUNCTION Matice::InputUpdateFromVector( double* vector, int name, int type) {{{*/529 void Matice::InputUpdateFromVector( double* vector, int name, int type){528 /*FUNCTION Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 529 void Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 530 530 531 531 /*Intermediaries*/ … … 545 545 546 546 case TriaEnum: 547 double values[3];547 IssmDouble values[3]; 548 548 for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->nodes[i]->GetVertexDof()]; 549 549 this->inputs->AddInput(new TriaP1Input(name,values)); … … 566 566 } 567 567 /*}}}*/ 568 /*FUNCTION Matice::InputUpdateFromVectorDakota( double* vector, int name, int type) {{{*/569 void Matice::InputUpdateFromVectorDakota( double* vector, int name, int type){568 /*FUNCTION Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 569 void Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 570 570 571 571 /*Intermediaries*/ … … 587 587 588 588 case TriaEnum: 589 double values[3];589 IssmDouble values[3]; 590 590 for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->nodes[i]->GetSidList()]; //use sid list, to index into serial oriented vector 591 591 this->inputs->AddInput(new TriaP1Input(name,values)); … … 618 618 /*}}}*/ 619 619 /*FUNCTION Matice::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{*/ 620 void Matice::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols,int name, int type){620 void Matice::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols,int name, int type){ 621 621 /*Nothing updated yet*/ 622 622 } … … 632 632 } 633 633 /*}}}*/ 634 /*FUNCTION Matice::InputUpdateFromConstant( double constant, int name) {{{*/635 void Matice::InputUpdateFromConstant( double constant, int name){634 /*FUNCTION Matice::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 635 void Matice::InputUpdateFromConstant(IssmDouble constant, int name){ 636 636 /*Nothing updated yet*/ 637 637 } … … 648 648 /*}}}*/ 649 649 /*FUNCTION Matice::InputUpdateFromSolution{{{*/ 650 void Matice::InputUpdateFromSolution( double* solution){650 void Matice::InputUpdateFromSolution(IssmDouble* solution){ 651 651 /*Nothing updated yet*/ 652 652 } … … 671 671 /*Intermediaries*/ 672 672 const int num_vertices = 3; //Tria has 3 vertices 673 double nodeinputs[num_vertices];674 double cmmininputs[num_vertices];675 double cmmaxinputs[num_vertices];673 IssmDouble nodeinputs[num_vertices]; 674 IssmDouble cmmininputs[num_vertices]; 675 IssmDouble cmmaxinputs[num_vertices]; 676 676 677 677 /*Get B*/ … … 713 713 /*Intermediaries*/ 714 714 const int num_vertices = 6; //Penta has 6 vertices 715 double nodeinputs[num_vertices];716 double cmmininputs[num_vertices];717 double cmmaxinputs[num_vertices];715 IssmDouble nodeinputs[num_vertices]; 716 IssmDouble cmmininputs[num_vertices]; 717 IssmDouble cmmaxinputs[num_vertices]; 718 718 719 719 /*Get B*/ -
issm/trunk-jpl/src/c/objects/Materials/Matice.h
r12365 r12472 39 39 /*}}}*/ 40 40 /*Update virtual functions definitions: {{{*/ 41 void InputUpdateFromVector( double* vector, int name, int type);41 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 42 42 void InputUpdateFromVector(int* vector, int name, int type); 43 43 void InputUpdateFromVector(bool* vector, int name, int type); 44 void InputUpdateFromMatrixDakota( double* matrix, int nrow, int ncols, int name, int type);45 void InputUpdateFromVectorDakota( double* vector, int name, int type);44 void InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrow, int ncols, int name, int type); 45 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 46 46 void InputUpdateFromVectorDakota(int* vector, int name, int type); 47 47 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 48 void InputUpdateFromConstant( double constant, int name);48 void InputUpdateFromConstant(IssmDouble constant, int name); 49 49 void InputUpdateFromConstant(int constant, int name); 50 50 void InputUpdateFromConstant(bool constant, int name); 51 void InputUpdateFromSolution( double* solution);51 void InputUpdateFromSolution(IssmDouble* solution); 52 52 void InputUpdateFromIoModel(int index, IoModel* iomodel); 53 53 /*}}}*/ … … 59 59 /*Matice Numerics: {{{*/ 60 60 void SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin); 61 void GetViscosity2d( double* pviscosity, double* pepsilon);62 void GetViscosity3d( double* pviscosity3d, double* pepsilon);63 void GetViscosity3dStokes( double* pviscosity3d, double* epsilon);64 void GetViscosityComplement( double* pviscosity_complement, double* pepsilon);65 void GetViscosityDerivativeEpsSquare( double* pmu_prime, double* pepsilon);66 void GetViscosity2dDerivativeEpsSquare( double* pmu_prime, double* pepsilon);67 double GetB();68 double GetBbar();69 double GetN();61 void GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon); 62 void GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon); 63 void GetViscosity3dStokes(IssmDouble* pviscosity3d, IssmDouble* epsilon); 64 void GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon); 65 void GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon); 66 void GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon); 67 IssmDouble GetB(); 68 IssmDouble GetBbar(); 69 IssmDouble GetN(); 70 70 bool IsInput(int name); 71 71 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Materials/Matpar.cpp
r12365 r12472 104 104 105 105 /*Update virtual functions definitions:*/ 106 /*FUNCTION Matpar::InputUpdateFromVector( double* vector, int name, int type) {{{*/107 void Matpar::InputUpdateFromVector( double* vector, int name, int type){106 /*FUNCTION Matpar::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 107 void Matpar::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 108 108 /*Nothing updated yet*/ 109 109 } … … 119 119 } 120 120 /*}}}*/ 121 /*FUNCTION Matpar::InputUpdateFromVectorDakota( double* vector, int name, int type) {{{*/122 void Matpar::InputUpdateFromVectorDakota( double* vector, int name, int type){121 /*FUNCTION Matpar::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 122 void Matpar::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 123 123 /*Nothing updated yet*/ 124 124 } … … 135 135 /*}}}*/ 136 136 /*FUNCTION Matpar::InputUpdateFromMatrixDakota(int* vector, int name, int type) {{{*/ 137 void Matpar::InputUpdateFromMatrixDakota( double* matrix, int nrows, int ncols,int name, int type){138 /*Nothing updated yet*/ 139 } 140 /*}}}*/ 141 /*FUNCTION Matpar::InputUpdateFromConstant( double constant, int name) {{{*/142 void Matpar::InputUpdateFromConstant( double constant, int name){137 void Matpar::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols,int name, int type){ 138 /*Nothing updated yet*/ 139 } 140 /*}}}*/ 141 /*FUNCTION Matpar::InputUpdateFromConstant(IssmDouble constant, int name) {{{*/ 142 void Matpar::InputUpdateFromConstant(IssmDouble constant, int name){ 143 143 144 144 switch(name){ … … 199 199 /*}}}*/ 200 200 /*FUNCTION Matpar::InputUpdateFromSolution{{{*/ 201 void Matpar::InputUpdateFromSolution( double* solution){201 void Matpar::InputUpdateFromSolution(IssmDouble* solution){ 202 202 /*Nothing updated yet*/ 203 203 } … … 213 213 /*}}}*/ 214 214 /*FUNCTION Matpar::GetBeta {{{*/ 215 double Matpar::GetBeta(){215 IssmDouble Matpar::GetBeta(){ 216 216 return beta; 217 217 } 218 218 /*}}}*/ 219 219 /*FUNCTION Matpar::GetG {{{*/ 220 double Matpar::GetG(){220 IssmDouble Matpar::GetG(){ 221 221 return g; 222 222 } 223 223 /*}}}*/ 224 224 /*FUNCTION Matpar::GetHeatCapacity {{{*/ 225 double Matpar::GetHeatCapacity(){225 IssmDouble Matpar::GetHeatCapacity(){ 226 226 return heatcapacity; 227 227 } 228 228 /*}}}*/ 229 229 /*FUNCTION Matpar::GetLatentHeat {{{*/ 230 double Matpar::GetLatentHeat(){230 IssmDouble Matpar::GetLatentHeat(){ 231 231 return latentheat; 232 232 } 233 233 /*}}}*/ 234 234 /*FUNCTION Matpar::GetMeltingPoint {{{*/ 235 double Matpar::GetMeltingPoint(){235 IssmDouble Matpar::GetMeltingPoint(){ 236 236 return meltingpoint; 237 237 } 238 238 /*}}}*/ 239 239 /*FUNCTION Matpar::GetReferenceTemperature {{{*/ 240 double Matpar::GetReferenceTemperature(){240 IssmDouble Matpar::GetReferenceTemperature(){ 241 241 return referencetemperature; 242 242 } 243 243 /*}}}*/ 244 244 /*FUNCTION Matpar::GetMixedLayerCapacity {{{*/ 245 double Matpar::GetMixedLayerCapacity(){245 IssmDouble Matpar::GetMixedLayerCapacity(){ 246 246 return mixed_layer_capacity; 247 247 } 248 248 /*}}}*/ 249 249 /*FUNCTION Matpar::GetRhoIce {{{*/ 250 double Matpar::GetRhoIce(){250 IssmDouble Matpar::GetRhoIce(){ 251 251 252 252 return rho_ice; … … 254 254 /*}}}*/ 255 255 /*FUNCTION Matpar::GetRhoWater {{{*/ 256 double Matpar::GetRhoWater(){256 IssmDouble Matpar::GetRhoWater(){ 257 257 return rho_water; 258 258 } 259 259 /*}}}*/ 260 260 /*FUNCTION Matpar::GetRhoFreshwater {{{*/ 261 double Matpar::GetRhoFreshwater(){261 IssmDouble Matpar::GetRhoFreshwater(){ 262 262 return rho_freshwater; 263 263 } 264 264 /*}}}*/ 265 265 /*FUNCTION Matpar::GetMuWater {{{*/ 266 double Matpar::GetMuWater(){266 IssmDouble Matpar::GetMuWater(){ 267 267 return mu_water; 268 268 } 269 269 /*}}}*/ 270 270 /*FUNCTION Matpar::GetThermalConductivity {{{*/ 271 double Matpar::GetThermalConductivity(){271 IssmDouble Matpar::GetThermalConductivity(){ 272 272 return thermalconductivity; 273 273 } 274 274 /*}}}*/ 275 275 /*FUNCTION Matpar::GetThermalExchangeVelocity {{{*/ 276 double Matpar::GetThermalExchangeVelocity(){276 IssmDouble Matpar::GetThermalExchangeVelocity(){ 277 277 return thermal_exchange_velocity; 278 278 } 279 279 /*}}}*/ 280 280 /*FUNCTION Matpar::GetKn {{{*/ 281 double Matpar::GetKn(){281 IssmDouble Matpar::GetKn(){ 282 282 return kn; 283 283 } 284 284 /*}}}*/ 285 285 /*FUNCTION Matpar::GetHydrologyP {{{*/ 286 double Matpar::GetHydrologyP(){286 IssmDouble Matpar::GetHydrologyP(){ 287 287 return hydro_p; 288 288 } 289 289 /*}}}*/ 290 290 /*FUNCTION Matqar::GetHydrologyQ {{{*/ 291 double Matpar::GetHydrologyQ(){291 IssmDouble Matpar::GetHydrologyQ(){ 292 292 return hydro_q; 293 293 } 294 294 /*}}}*/ 295 295 /*FUNCTION Matpar::GetHydrologyCR {{{*/ 296 double Matpar::GetHydrologyCR(){296 IssmDouble Matpar::GetHydrologyCR(){ 297 297 return hydro_CR; 298 298 } 299 299 /*}}}*/ 300 300 /*FUNCTION Matpar::GetHydrologyN {{{*/ 301 double Matpar::GetHydrologyN(){301 IssmDouble Matpar::GetHydrologyN(){ 302 302 return hydro_n; 303 303 } 304 304 /*}}}*/ 305 305 /*FUNCTION Matpar::TMeltingPoint {{{*/ 306 double Matpar::TMeltingPoint(double pressure){306 IssmDouble Matpar::TMeltingPoint(IssmDouble pressure){ 307 307 return meltingpoint-beta*pressure; 308 308 } 309 309 /*}}}*/ 310 310 /*FUNCTION Matpar::PureIceEnthalpy{{{*/ 311 double Matpar::PureIceEnthalpy(double pressure){311 IssmDouble Matpar::PureIceEnthalpy(IssmDouble pressure){ 312 312 return heatcapacity*(TMeltingPoint(pressure)-referencetemperature); 313 313 } 314 314 /*}}}*/ 315 315 /*FUNCTION Matpar::GetEnthalpyDiffusionParameter{{{*/ 316 double Matpar::GetEnthalpyDiffusionParameter(double enthalpy,double pressure){316 IssmDouble Matpar::GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){ 317 317 if(enthalpy<PureIceEnthalpy(pressure)){ 318 318 return thermalconductivity/(rho_ice*heatcapacity); … … 324 324 /*}}}*/ 325 325 /*FUNCTION Matpar::EnthalpyToThermal {{{*/ 326 void Matpar::EnthalpyToThermal( double* ptemperature,double* pwaterfraction,double enthalpy,double pressure){326 void Matpar::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){ 327 327 328 328 /*Ouput*/ 329 double temperature,waterfraction;329 IssmDouble temperature,waterfraction; 330 330 331 331 if(enthalpy<PureIceEnthalpy(pressure)){ … … 344 344 /*}}}*/ 345 345 /*FUNCTION Matpar::ThermalToEnthalpy {{{*/ 346 void Matpar::ThermalToEnthalpy( double * penthalpy,double temperature,double waterfraction,double pressure){346 void Matpar::ThermalToEnthalpy(IssmDouble * penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){ 347 347 348 348 /*Ouput*/ 349 double enthalpy;349 IssmDouble enthalpy; 350 350 351 351 if(temperature<TMeltingPoint(pressure)){ -
issm/trunk-jpl/src/c/objects/Materials/Matpar.h
r12365 r12472 16 16 private: 17 17 int mid; 18 double rho_ice;19 double rho_water;20 double rho_freshwater;21 double mu_water;22 double heatcapacity;23 double thermalconductivity;24 double latentheat;25 double beta;26 double meltingpoint;27 double referencetemperature;28 double mixed_layer_capacity;29 double thermal_exchange_velocity;30 double g;18 IssmDouble rho_ice; 19 IssmDouble rho_water; 20 IssmDouble rho_freshwater; 21 IssmDouble mu_water; 22 IssmDouble heatcapacity; 23 IssmDouble thermalconductivity; 24 IssmDouble latentheat; 25 IssmDouble beta; 26 IssmDouble meltingpoint; 27 IssmDouble referencetemperature; 28 IssmDouble mixed_layer_capacity; 29 IssmDouble thermal_exchange_velocity; 30 IssmDouble g; 31 31 32 32 /*hydrology: */ 33 double kn;34 double hydro_p;35 double hydro_q;36 double hydro_CR;37 double hydro_n;33 IssmDouble kn; 34 IssmDouble hydro_p; 35 IssmDouble hydro_q; 36 IssmDouble hydro_CR; 37 IssmDouble hydro_n; 38 38 39 39 public: … … 51 51 /*}}}*/ 52 52 /*Update virtual functions resolution: {{{*/ 53 void InputUpdateFromVector( double* vector, int name, int type);53 void InputUpdateFromVector(IssmDouble* vector, int name, int type); 54 54 void InputUpdateFromVector(int* vector, int name, int type); 55 55 void InputUpdateFromVector(bool* vector, int name, int type); 56 void InputUpdateFromMatrixDakota( double* matrix,int nrows,int ncols, int name, int type);57 void InputUpdateFromVectorDakota( double* vector, int name, int type);56 void InputUpdateFromMatrixDakota(IssmDouble* matrix,int nrows,int ncols, int name, int type); 57 void InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type); 58 58 void InputUpdateFromVectorDakota(int* vector, int name, int type); 59 59 void InputUpdateFromVectorDakota(bool* vector, int name, int type); 60 void InputUpdateFromConstant( double constant, int name);60 void InputUpdateFromConstant(IssmDouble constant, int name); 61 61 void InputUpdateFromConstant(int constant, int name); 62 62 void InputUpdateFromConstant(bool constant, int name); 63 void InputUpdateFromSolution( double* solution);63 void InputUpdateFromSolution(IssmDouble* solution); 64 64 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");}; 65 65 /*}}}*/ … … 70 70 /*}}}*/ 71 71 /*Numerics: {{{*/ 72 double GetG();73 double GetRhoIce();74 double GetRhoWater();75 double GetRhoFreshwater();76 double GetMuWater();77 double GetMixedLayerCapacity();78 double GetThermalExchangeVelocity();79 double GetHeatCapacity();80 double GetThermalConductivity();81 double GetLatentHeat();82 double GetBeta();83 double GetMeltingPoint();84 double GetReferenceTemperature();85 double GetKn();86 double GetHydrologyP();87 double GetHydrologyQ();88 double GetHydrologyCR();89 double GetHydrologyN();90 double TMeltingPoint(double pressure);91 double PureIceEnthalpy(double pressure);92 double GetEnthalpyDiffusionParameter(double enthalpy,double pressure);93 void EnthalpyToThermal( double* ptemperature,double* pwaterfraction,double enthalpy,double pressure);94 void ThermalToEnthalpy( double* penthalpy,double temperature,double waterfraction,double pressure);72 IssmDouble GetG(); 73 IssmDouble GetRhoIce(); 74 IssmDouble GetRhoWater(); 75 IssmDouble GetRhoFreshwater(); 76 IssmDouble GetMuWater(); 77 IssmDouble GetMixedLayerCapacity(); 78 IssmDouble GetThermalExchangeVelocity(); 79 IssmDouble GetHeatCapacity(); 80 IssmDouble GetThermalConductivity(); 81 IssmDouble GetLatentHeat(); 82 IssmDouble GetBeta(); 83 IssmDouble GetMeltingPoint(); 84 IssmDouble GetReferenceTemperature(); 85 IssmDouble GetKn(); 86 IssmDouble GetHydrologyP(); 87 IssmDouble GetHydrologyQ(); 88 IssmDouble GetHydrologyCR(); 89 IssmDouble GetHydrologyN(); 90 IssmDouble TMeltingPoint(IssmDouble pressure); 91 IssmDouble PureIceEnthalpy(IssmDouble pressure); 92 IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure); 93 void EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure); 94 void ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure); 95 95 /*}}}*/ 96 96 -
issm/trunk-jpl/src/c/objects/Numerics/ElementMatrix.cpp
r12446 r12472 101 101 /*Gset and values*/ 102 102 this->gglobaldoflist=xNew<int>(this->nrows); 103 this->values=xNewZeroInit< double>(this->nrows*this->ncols);103 this->values=xNewZeroInit<IssmDouble>(this->nrows*this->ncols); 104 104 for(i=0;i<Ke1->nrows;i++){ 105 105 for(j=0;j<Ke1->ncols;j++){ … … 205 205 206 206 /*fill values with 0: */ 207 this->values=xNewZeroInit< double>(this->nrows*this->ncols);207 this->values=xNewZeroInit<IssmDouble>(this->nrows*this->ncols); 208 208 209 209 /*g list*/ … … 231 231 ElementMatrix::~ElementMatrix(){ 232 232 233 xDelete< double>(this->values);233 xDelete<IssmDouble>(this->values); 234 234 xDelete<int>(this->gglobaldoflist); 235 235 xDelete<int>(this->row_flocaldoflist); … … 249 249 250 250 int i,j; 251 double* localvalues=NULL;251 IssmDouble* localvalues=NULL; 252 252 253 253 /*If Kfs is not provided, call the other function*/ … … 265 265 if(this->row_fsize){ 266 266 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 267 localvalues=xNew< double>(this->row_fsize*this->row_fsize);267 localvalues=xNew<IssmDouble>(this->row_fsize*this->row_fsize); 268 268 for(i=0;i<this->row_fsize;i++){ 269 269 for(j=0;j<this->row_fsize;j++){ … … 275 275 276 276 /*Free ressources:*/ 277 xDelete< double>(localvalues);277 xDelete<IssmDouble>(localvalues); 278 278 } 279 279 … … 281 281 if((this->row_ssize!=0) && (this->row_fsize!=0)){ 282 282 /*first, retrieve values that are in the f and s-set from the g-set values matrix: */ 283 localvalues=xNew< double>(this->row_fsize*this->row_ssize);283 localvalues=xNew<IssmDouble>(this->row_fsize*this->row_ssize); 284 284 for(i=0;i<this->row_fsize;i++){ 285 285 for(j=0;j<this->row_ssize;j++){ … … 291 291 292 292 /*Free ressources:*/ 293 xDelete< double>(localvalues);293 xDelete<IssmDouble>(localvalues); 294 294 } 295 295 } … … 304 304 305 305 int i,j; 306 double* localvalues=NULL;306 IssmDouble* localvalues=NULL; 307 307 308 308 /*Check that Jff is not NULL*/ … … 317 317 if(this->row_fsize){ 318 318 /*first, retrieve values that are in the f-set from the g-set values matrix: */ 319 localvalues=xNew< double>(this->row_fsize*this->row_fsize);319 localvalues=xNew<IssmDouble>(this->row_fsize*this->row_fsize); 320 320 for(i=0;i<this->row_fsize;i++){ 321 321 for(j=0;j<this->row_fsize;j++){ … … 327 327 328 328 /*Free ressources:*/ 329 xDelete< double>(localvalues);329 xDelete<IssmDouble>(localvalues); 330 330 } 331 331 … … 428 428 this->dofsymmetrical=Ke->dofsymmetrical; 429 429 430 this->values=xNew< double>(this->nrows*this->ncols);431 memcpy(this->values,Ke->values,this->nrows*this->ncols*sizeof(double));430 this->values=xNew<IssmDouble>(this->nrows*this->ncols); 431 xMemCpy<IssmDouble>(this->values,Ke->values,this->nrows*this->ncols); 432 432 433 433 this->gglobaldoflist=xNew<int>(this->nrows); 434 memcpy(this->gglobaldoflist,Ke->gglobaldoflist,this->nrows*sizeof(int));434 xMemCpy<int>(this->gglobaldoflist,Ke->gglobaldoflist,this->nrows); 435 435 436 436 this->row_fsize=Ke->row_fsize; 437 437 if(this->row_fsize){ 438 438 this->row_flocaldoflist=xNew<int>(this->row_fsize); 439 memcpy(this->row_flocaldoflist,Ke->row_flocaldoflist,this->row_fsize*sizeof(int));439 xMemCpy<int>(this->row_flocaldoflist,Ke->row_flocaldoflist,this->row_fsize); 440 440 this->row_fglobaldoflist=xNew<int>(this->row_fsize); 441 memcpy(this->row_fglobaldoflist,Ke->row_fglobaldoflist,this->row_fsize*sizeof(int));441 xMemCpy<int>(this->row_fglobaldoflist,Ke->row_fglobaldoflist,this->row_fsize); 442 442 } 443 443 else{ … … 449 449 if(this->row_ssize){ 450 450 this->row_slocaldoflist=xNew<int>(this->row_ssize); 451 memcpy(this->row_slocaldoflist,Ke->row_slocaldoflist,this->row_ssize*sizeof(int));451 xMemCpy<int>(this->row_slocaldoflist,Ke->row_slocaldoflist,this->row_ssize); 452 452 this->row_sglobaldoflist=xNew<int>(this->row_ssize); 453 memcpy(this->row_sglobaldoflist,Ke->row_sglobaldoflist,this->row_ssize*sizeof(int));453 xMemCpy<int>(this->row_sglobaldoflist,Ke->row_sglobaldoflist,this->row_ssize); 454 454 } 455 455 else{ … … 461 461 if(this->col_fsize){ 462 462 this->col_flocaldoflist=xNew<int>(this->col_fsize); 463 memcpy(this->col_flocaldoflist,Ke->col_flocaldoflist,this->col_fsize*sizeof(int));463 xMemCpy<int>(this->col_flocaldoflist,Ke->col_flocaldoflist,this->col_fsize); 464 464 this->col_fglobaldoflist=xNew<int>(this->col_fsize); 465 memcpy(this->col_fglobaldoflist,Ke->col_fglobaldoflist,this->col_fsize*sizeof(int));465 xMemCpy<int>(this->col_fglobaldoflist,Ke->col_fglobaldoflist,this->col_fsize); 466 466 } 467 467 else{ … … 473 473 if(this->col_ssize){ 474 474 this->col_slocaldoflist=xNew<int>(this->col_ssize); 475 memcpy(this->col_slocaldoflist,Ke->col_slocaldoflist,this->col_ssize*sizeof(int));475 xMemCpy<int>(this->col_slocaldoflist,Ke->col_slocaldoflist,this->col_ssize); 476 476 this->col_sglobaldoflist=xNew<int>(this->col_ssize); 477 memcpy(this->col_sglobaldoflist,Ke->col_sglobaldoflist,this->col_ssize*sizeof(int));477 xMemCpy<int>(this->col_sglobaldoflist,Ke->col_sglobaldoflist,this->col_ssize); 478 478 } 479 479 else{ … … 484 484 /*}}}*/ 485 485 /*FUNCTION ElementMatrix::SetDiag{{{*/ 486 void ElementMatrix::SetDiag( double scalar){486 void ElementMatrix::SetDiag(IssmDouble scalar){ 487 487 488 488 int i; -
issm/trunk-jpl/src/c/objects/Numerics/ElementMatrix.h
r12365 r12472 24 24 int ncols; 25 25 bool dofsymmetrical; 26 double* values;26 IssmDouble* values; 27 27 28 28 //gset … … 64 64 void Transpose(void); 65 65 void Init(ElementMatrix* Ke); 66 void SetDiag( double scalar);66 void SetDiag(IssmDouble scalar); 67 67 /*}}}*/ 68 68 }; -
issm/trunk-jpl/src/c/objects/Numerics/ElementVector.cpp
r12446 r12472 75 75 /*Gset and values*/ 76 76 this->gglobaldoflist=xNew<int>(this->nrows); 77 this->values=xNewZeroInit< double>(this->nrows);77 this->values=xNewZeroInit<IssmDouble>(this->nrows); 78 78 for(i=0;i<pe1->nrows;i++){ 79 79 this->values[i] += pe1->values[i]; … … 138 138 139 139 /*fill values with 0: */ 140 this->values=xNewZeroInit< double>(this->nrows);140 this->values=xNewZeroInit<IssmDouble>(this->nrows); 141 141 142 142 /*g list*/ … … 152 152 ElementVector::~ElementVector(){ 153 153 154 xDelete< double>(this->values);154 xDelete<IssmDouble>(this->values); 155 155 xDelete<int>(this->gglobaldoflist); 156 156 xDelete<int>(this->flocaldoflist); … … 164 164 165 165 int i; 166 double* localvalues=NULL;166 IssmDouble* localvalues=NULL; 167 167 168 168 /*In debugging mode, check consistency (no NaN, and values not too big)*/ … … 171 171 if(this->fsize){ 172 172 /*first, retrieve values that are in the f-set from the g-set values vector: */ 173 localvalues=xNew< double>(this->fsize);173 localvalues=xNew<IssmDouble>(this->fsize); 174 174 for(i=0;i<this->fsize;i++){ 175 175 localvalues[i]=this->values[this->flocaldoflist[i]]; … … 179 179 180 180 /*Free ressources:*/ 181 xDelete< double>(localvalues);181 xDelete<IssmDouble>(localvalues); 182 182 } 183 183 … … 188 188 189 189 int i; 190 double* localvalues=NULL;190 IssmDouble* localvalues=NULL; 191 191 192 192 if(this->fsize){ 193 193 /*first, retrieve values that are in the f-set from the g-set values vector: */ 194 localvalues=xNew< double>(this->fsize);194 localvalues=xNew<IssmDouble>(this->fsize); 195 195 for(i=0;i<this->fsize;i++){ 196 196 localvalues[i]=this->values[this->flocaldoflist[i]]; … … 200 200 201 201 /*Free ressources:*/ 202 xDelete< double>(localvalues);202 xDelete<IssmDouble>(localvalues); 203 203 } 204 204 … … 245 245 this->nrows =pe->nrows; 246 246 247 this->values=xNew< double>(this->nrows);248 memcpy(this->values,pe->values,this->nrows*sizeof(double));247 this->values=xNew<IssmDouble>(this->nrows); 248 xMemCpy<IssmDouble>(this->values,pe->values,this->nrows); 249 249 250 250 this->gglobaldoflist=xNew<int>(this->nrows); 251 memcpy(this->gglobaldoflist,pe->gglobaldoflist,this->nrows*sizeof(int));251 xMemCpy<int>(this->gglobaldoflist,pe->gglobaldoflist,this->nrows); 252 252 253 253 this->fsize=pe->fsize; 254 254 if(this->fsize){ 255 255 this->flocaldoflist=xNew<int>(this->fsize); 256 memcpy(this->flocaldoflist,pe->flocaldoflist,this->fsize*sizeof(int));256 xMemCpy<int>(this->flocaldoflist,pe->flocaldoflist,this->fsize); 257 257 this->fglobaldoflist=xNew<int>(this->fsize); 258 memcpy(this->fglobaldoflist,pe->fglobaldoflist,this->fsize*sizeof(int));258 xMemCpy<int>(this->fglobaldoflist,pe->fglobaldoflist,this->fsize); 259 259 } 260 260 else{ … … 265 265 /*}}}*/ 266 266 /*FUNCTION ElementVector::SetValue{{{*/ 267 void ElementVector::SetValue( double scalar){267 void ElementVector::SetValue(IssmDouble scalar){ 268 268 269 269 int i; -
issm/trunk-jpl/src/c/objects/Numerics/ElementVector.h
r12365 r12472 22 22 23 23 int nrows; 24 double* values;24 IssmDouble* values; 25 25 26 26 //gset … … 45 45 void CheckConsistency(void); 46 46 void Init(ElementVector* pe); 47 void SetValue( double scalar);47 void SetValue(IssmDouble scalar); 48 48 /*}}}*/ 49 49 }; -
issm/trunk-jpl/src/c/objects/Numerics/Matrix.cpp
r12441 r12472 45 45 #endif 46 46 #ifdef _HAVE_ADOLC_ 47 this->amatrix=xNew< adouble>(M*N);48 #endif 49 } 50 /*}}}*/ 51 /*FUNCTION Matrix::Matrix(int M,int N, double sparsity){{{*/52 Matrix::Matrix(int M,int N, double sparsity){47 this->amatrix=xNew<IssmDouble>(M*N); 48 #endif 49 } 50 /*}}}*/ 51 /*FUNCTION Matrix::Matrix(int M,int N,IssmDouble sparsity){{{*/ 52 Matrix::Matrix(int M,int N,IssmDouble sparsity){ 53 53 54 54 #ifdef _HAVE_PETSC_ … … 58 58 #endif 59 59 #ifdef _HAVE_ADOLC_ 60 this->amatrix=xNew< adouble>;61 #endif 62 } 63 /*}}}*/ 64 /*FUNCTION Matrix::Matrix( double* serial_mat, int M,int N,double sparsity){{{*/65 Matrix::Matrix( double* serial_mat, int M,int N,double sparsity){60 this->amatrix=xNew<IssmDouble>; 61 #endif 62 } 63 /*}}}*/ 64 /*FUNCTION Matrix::Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity){{{*/ 65 Matrix::Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity){ 66 66 67 67 #ifdef _HAVE_PETSC_ … … 85 85 #endif 86 86 #ifdef _HAVE_ADOLC_ 87 this->amatrix=xNew< adouble>(M*N);87 this->amatrix=xNew<IssmDouble>(M*N); 88 88 #endif 89 89 } … … 98 98 #endif 99 99 #ifdef _HAVE_ADOLC_ 100 this->amatrix=xNew< adouble>(M*N);100 this->amatrix=xNew<IssmDouble>(M*N); 101 101 #endif 102 102 } … … 111 111 #endif 112 112 #ifdef _HAVE_ADOLC_ 113 xDelete< adouble>(this->amatrix);113 xDelete<IssmDouble>(this->amatrix); 114 114 #endif 115 115 } … … 156 156 /*}}}*/ 157 157 /*FUNCTION Matrix::Norm{{{*/ 158 double Matrix::Norm(NormMode norm_type){159 160 double norm=0;158 IssmDouble Matrix::Norm(NormMode norm_type){ 159 160 IssmDouble norm=0; 161 161 #ifdef _HAVE_PETSC_ 162 162 _assert_(this->matrix); … … 220 220 /*}}}*/ 221 221 /*FUNCTION Matrix::ToSerial{{{*/ 222 double* Matrix::ToSerial(void){223 224 double* output=NULL;222 IssmDouble* Matrix::ToSerial(void){ 223 224 IssmDouble* output=NULL; 225 225 226 226 #ifdef _HAVE_PETSC_ … … 233 233 /*}}}*/ 234 234 /*FUNCTION Matrix::SetValues{{{*/ 235 void Matrix::SetValues(int m,int* idxm,int n,int* idxn, double* values,InsMode mode){235 void Matrix::SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode){ 236 236 237 237 #ifdef _HAVE_PETSC_ -
issm/trunk-jpl/src/c/objects/Numerics/Matrix.h
r12365 r12472 35 35 #endif 36 36 #ifdef _HAVE_ADOLC_ 37 adouble* amatrix;37 IssmDouble* amatrix; 38 38 #endif 39 39 … … 41 41 Matrix(); 42 42 Matrix(int M,int N); 43 Matrix(int M,int N, double sparsity);44 Matrix( double* serial_mat,int M,int N,double sparsity);43 Matrix(int M,int N,IssmDouble sparsity); 44 Matrix(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity); 45 45 Matrix(int M,int N,int connectivity,int numberofdofspernode); 46 46 ~Matrix(); … … 49 49 void Echo(void); 50 50 void Assemble(void); 51 double Norm(NormMode norm_type);51 IssmDouble Norm(NormMode norm_type); 52 52 void GetSize(int* pM,int* pN); 53 53 void GetLocalSize(int* pM,int* pN); 54 54 void MatMult(Vector* X,Vector* AX); 55 55 Matrix* Duplicate(void); 56 double* ToSerial(void);57 void SetValues(int m,int* idxm,int n,int* idxn, double* values,InsMode mode);56 IssmDouble* ToSerial(void); 57 void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode); 58 58 void Convert(MatrixType type); 59 59 /*}}}*/ -
issm/trunk-jpl/src/c/objects/Numerics/Vector.cpp
r12441 r12472 44 44 #endif 45 45 #ifdef _HAVE_ADOLC_ 46 this->avector=xNew< adouble>(pM);47 #endif 48 } 49 /*}}}*/ 50 /*FUNCTION Vector::Vector( double* serial_vec,int M){{{*/51 Vector::Vector( double* serial_vec,int M){46 this->avector=xNew<IssmDouble>(pM); 47 #endif 48 } 49 /*}}}*/ 50 /*FUNCTION Vector::Vector(IssmDouble* serial_vec,int M){{{*/ 51 Vector::Vector(IssmDouble* serial_vec,int M){ 52 52 53 53 #ifdef _HAVE_PETSC_ … … 65 65 #endif 66 66 #ifdef _HAVE_ADOLC_ 67 this->avector=xNew< adouble>(M);67 this->avector=xNew<IssmDouble>(M); 68 68 #endif 69 69 } … … 109 109 #endif 110 110 #ifdef _HAVE_ADOLC_ 111 xDelete< adouble>(this->avector);111 xDelete<IssmDouble>(this->avector); 112 112 #endif 113 113 } … … 146 146 /*}}}*/ 147 147 /*FUNCTION Vector::SetValues{{{*/ 148 void Vector::SetValues(int ssize, int* list, double* values, InsMode mode){148 void Vector::SetValues(int ssize, int* list, IssmDouble* values, InsMode mode){ 149 149 150 150 … … 159 159 /*}}}*/ 160 160 /*FUNCTION Vector::SetValue{{{*/ 161 void Vector::SetValue(int dof, double value, InsMode mode){161 void Vector::SetValue(int dof, IssmDouble value, InsMode mode){ 162 162 163 163 #ifdef _HAVE_PETSC_ … … 171 171 /*}}}*/ 172 172 /*FUNCTION Vector::GetValue{{{*/ 173 void Vector::GetValue( double* pvalue,int dof){173 void Vector::GetValue(IssmDouble* pvalue,int dof){ 174 174 175 175 #ifdef _HAVE_PETSC_ … … 238 238 /*}}}*/ 239 239 /*FUNCTION Vector::Set{{{*/ 240 void Vector::Set( double value){240 void Vector::Set(IssmDouble value){ 241 241 242 242 #ifdef _HAVE_PETSC_ … … 250 250 /*}}}*/ 251 251 /*FUNCTION Vector::AXPY{{{*/ 252 void Vector::AXPY(Vector* X, double a){252 void Vector::AXPY(Vector* X, IssmDouble a){ 253 253 254 254 #ifdef _HAVE_PETSC_ … … 261 261 /*}}}*/ 262 262 /*FUNCTION Vector::AYPX{{{*/ 263 void Vector::AYPX(Vector* X, double a){263 void Vector::AYPX(Vector* X, IssmDouble a){ 264 264 265 265 #ifdef _HAVE_PETSC_ … … 273 273 /*}}}*/ 274 274 /*FUNCTION Vector::ToMPISerial{{{*/ 275 double* Vector::ToMPISerial(void){276 277 double* vec_serial=NULL;275 IssmDouble* Vector::ToMPISerial(void){ 276 277 IssmDouble* vec_serial=NULL; 278 278 279 279 #ifdef _HAVE_PETSC_ … … 299 299 /*}}}*/ 300 300 /*FUNCTION Vector::Norm{{{*/ 301 double Vector::Norm(NormMode norm_type){302 303 double norm=0;301 IssmDouble Vector::Norm(NormMode norm_type){ 302 303 IssmDouble norm=0; 304 304 #ifdef _HAVE_PETSC_ 305 305 _assert_(this->vector); … … 312 312 /*}}}*/ 313 313 /*FUNCTION Vector::Scale{{{*/ 314 void Vector::Scale( double scale_factor){314 void Vector::Scale(IssmDouble scale_factor){ 315 315 316 316 #ifdef _HAVE_PETSC_ … … 323 323 /*}}}*/ 324 324 /*FUNCTION Vector::Dot{{{*/ 325 double Vector::Dot(Vector* vector){326 327 double dot;325 IssmDouble Vector::Dot(Vector* vector){ 326 327 IssmDouble dot; 328 328 #ifdef _HAVE_PETSC_ 329 329 _assert_(this->vector); -
issm/trunk-jpl/src/c/objects/Numerics/Vector.h
r12365 r12472 33 33 #endif 34 34 #ifdef _HAVE_ADOLC_ 35 adouble* avector;35 IssmDouble* avector; 36 36 #endif 37 37 … … 39 39 Vector(); 40 40 Vector(int M,bool fromlocalsize=false); 41 Vector( double* serial_vec,int pM);41 Vector(IssmDouble* serial_vec,int pM); 42 42 #ifdef _HAVE_PETSC_ 43 43 Vector(Vec petsc_vec); … … 50 50 /*Vector specific routines {{{*/ 51 51 void Echo(void); 52 void AXPY(Vector *X, double a);53 void AYPX(Vector *X, double a);52 void AXPY(Vector *X, IssmDouble a); 53 void AYPX(Vector *X, IssmDouble a); 54 54 void Assemble(void); 55 55 void Copy(Vector *to); 56 double Dot(Vector *vector);56 IssmDouble Dot(Vector *vector); 57 57 Vector *Duplicate(void); 58 void GetValue( double *pvalue, int dof);58 void GetValue(IssmDouble *pvalue, int dof); 59 59 void GetSize(int *pM); 60 60 void GetLocalSize(int *pM); 61 61 bool IsEmpty(void); 62 double Norm(NormMode norm_type);62 IssmDouble Norm(NormMode norm_type); 63 63 void PointwiseDivide(Vector *x,Vector*y); 64 void Scale( double scale_factor);65 void Set( double value);66 void SetValues(int ssize, int *list, double*values, InsMode mode);67 void SetValue(int dof, double value, InsMode mode);68 double *ToMPISerial(void);64 void Scale(IssmDouble scale_factor); 65 void Set(IssmDouble value); 66 void SetValues(int ssize, int *list, IssmDouble*values, InsMode mode); 67 void SetValue(int dof, IssmDouble value, InsMode mode); 68 IssmDouble *ToMPISerial(void); 69 69 /*}}}*/ 70 70 };
Note:
See TracChangeset
for help on using the changeset viewer.