Changeset 27097
- Timestamp:
- 06/23/22 17:26:19 (3 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/SealevelchangeAnalysis.cpp
r27061 r27097 9 9 10 10 /*Model processing*/ 11 SealevelchangeAnalysis::~SealevelchangeAnalysis(){/*{{{*/ 12 13 BarystaticContributions* barycontrib=NULL; 14 GenericParam<BarystaticContributions*>* barycontribparam=NULL; 15 16 barycontribparam = xDynamicCast<GenericParam<BarystaticContributions*>*>(femmodel->parameters->FindParamObject(BarystaticContributionsEnum)); 17 barycontrib=barycontribparam->GetParameterValue(); 18 19 delete barycontrib; 20 }/*}}}*/ 11 21 void SealevelchangeAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/ 12 22 /*No constraints*/ … … 285 295 parameters->AddObject(new BoolParam(LoveIsTimeEnum,love_istime)); 286 296 297 /*Free allocations:*/ 298 xDelete<IssmDouble>(love_timefreq); 299 287 300 // AD performance is sensitive to calls to ensurecontiguous. 288 301 // // Providing "t" will cause ensurecontiguous to be called. … … 532 545 nt=1; //in elastic, or if we run only selfattraction, we need only one step 533 546 #ifdef _HAVE_AD_ 534 G_viscoelastic_interpolated= G_viscoelastic;535 U_viscoelastic_interpolated= U_viscoelastic;536 if(horiz) H_viscoelastic_interpolated=H_viscoelastic;547 G_viscoelastic_interpolated=xNew<IssmDouble>(M,"t"); 548 U_viscoelastic_interpolated=xNew<IssmDouble>(M,"t"); 549 if(horiz) H_viscoelastic_interpolated=xNew<IssmDouble>(M,"t"); 537 550 #else 538 G_viscoelastic_interpolated= G_viscoelastic;539 U_viscoelastic_interpolated= U_viscoelastic;540 if(horiz) H_viscoelastic_interpolated=H_viscoelastic;551 G_viscoelastic_interpolated=xNew<IssmDouble>(M); 552 U_viscoelastic_interpolated=xNew<IssmDouble>(M); 553 if(horiz) H_viscoelastic_interpolated=xNew<IssmDouble>(M); 541 554 #endif 555 556 557 xMemCpy<IssmDouble>(G_viscoelastic_interpolated,G_viscoelastic,M); 558 xMemCpy<IssmDouble>(U_viscoelastic_interpolated,U_viscoelastic,M); 559 if(horiz) xMemCpy<IssmDouble>(H_viscoelastic_interpolated,H_viscoelastic,M); 542 560 543 561 if(rotation){ //if this cpu handles degree 2 … … 558 576 #endif 559 577 560 Pmtf_col_interpolated =love_pmtf_colinear;561 Pmtf_ortho_interpolated =love_pmtf_ortho;578 Pmtf_col_interpolated[0]=love_pmtf_colinear[0]; 579 Pmtf_ortho_interpolated[0]=love_pmtf_ortho[0]; 562 580 Pmtf_z_interpolated[0]=1.0+love_k[2]; 563 581 Love_tk2_interpolated[0]=love_tk[2]; … … 595 613 xDelete<IssmDouble>(G_viscoelastic); 596 614 xDelete<IssmDouble>(G_viscoelastic_local); 615 xDelete<IssmDouble>(G_viscoelastic_interpolated); 597 616 xDelete<IssmDouble>(U_viscoelastic); 617 xDelete<IssmDouble>(U_viscoelastic_interpolated); 598 618 xDelete<IssmDouble>(U_viscoelastic_local); 599 619 if(horiz){ 600 620 xDelete<IssmDouble>(H_viscoelastic); 621 xDelete<IssmDouble>(H_viscoelastic_interpolated); 601 622 xDelete<IssmDouble>(H_viscoelastic_local); 602 623 } … … 604 625 xDelete<IssmDouble>(love_pmtf_colinear); 605 626 xDelete<IssmDouble>(love_pmtf_ortho); 627 628 xDelete<IssmDouble>(Love_tk2_interpolated); 629 xDelete<IssmDouble>(Love_th2_interpolated); 630 xDelete<IssmDouble>(Pmtf_col_interpolated); 631 xDelete<IssmDouble>(Pmtf_ortho_interpolated); 632 xDelete<IssmDouble>(Pmtf_z_interpolated); 633 if(horiz){ 634 xDelete<IssmDouble>(Love_tl2_interpolated); 635 } 606 636 607 637 } … … 632 662 iomodel->DeleteData(&requestedoutputs,numoutputs,"md.solidearth.requested_outputs"); 633 663 /*}}}*/ 664 634 665 }/*}}}*/ 635 666 -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r27061 r27097 6583 6583 LoveRotRSL = xNewZeroInit<IssmDouble>(nt); 6584 6584 LoveRotU = xNewZeroInit<IssmDouble>(nt); 6585 LoveRothoriz= xNewZeroInit<IssmDouble>(nt);6585 if(horiz)LoveRothoriz= xNewZeroInit<IssmDouble>(nt); 6586 6586 Grot = xNewZeroInit<IssmDouble>(3*3*nt); //3 polar motion components * 3 vertices * number of time steps 6587 6587 GUrot = xNewZeroInit<IssmDouble>(3*3*nt); … … 6669 6669 } 6670 6670 } 6671 /*Free ressources:*/ 6672 xDelete<IssmDouble>(LoveRotRSL); 6673 xDelete<IssmDouble>(LoveRotU); 6674 if(horiz)xDelete<IssmDouble>(LoveRothoriz); 6671 6675 } 6672 6676 /*}}}*/ … … 7392 7396 /*Keep track of barystatic contributions:*/ 7393 7397 barycontrib->Set(this->Sid(),bslcice,bslchydro,bslcbp); 7398 7399 /*Free ressources:*/ 7400 xDelete<IssmDouble>(areae); 7394 7401 7395 7402 } … … 7708 7715 /*Save viscous stack now that we updated the values:*/ 7709 7716 this->inputs->SetArrayInput(viscousenum,this->lid,viscousfield,3*viscousnumsteps); 7717 7718 /*Free ressources:*/ 7719 xDelete<IssmDouble>(grdfieldinterp); 7710 7720 } 7711 7721 … … 7726 7736 for(i=0;i<NUMVERTICES;i++) grdfieldout[i]=grdfield[i*nt+0]; 7727 7737 } 7738 /*Free ressources:*/ 7739 xDelete<IssmDouble>(grdfield); 7728 7740 7729 7741 } /*}}}*/ -
issm/trunk-jpl/src/c/classes/GrdLoads.cpp
r26800 r27097 19 19 GrdLoads::GrdLoads(int nel,SealevelGeometry* slgeom){ /*{{{*/ 20 20 21 /*allocate:*/ 21 22 vloads=new Vector<IssmDouble>(nel); 22 23 for (int i=0;i<SLGEOM_NUMLOADS;i++) vsubloads[i]=new Vector<IssmDouble>(slgeom->nbar[i]); … … 26 27 27 28 vsubsealevelloads=new Vector<IssmDouble>(slgeom->nbar[SLGEOM_OCEAN]); 29 30 /*make sure all pointers that are not allocated are NULL:*/ 31 loads=NULL; 32 for (int i=0;i<SLGEOM_NUMLOADS;i++)subloads[i]=NULL; 33 sealevelloads=NULL; 34 subsealevelloads=NULL; 35 28 36 29 37 }; /*}}}*/ … … 50 58 } 51 59 60 /*Avoid leaks:*/ 61 if(loads)xDelete<IssmDouble>(loads); 62 for (int i=0;i<SLGEOM_NUMLOADS;i++){ 63 if(subloads[i])xDelete<IssmDouble>(subloads[i]); 64 } 65 66 /*Serialize:*/ 52 67 loads=vloads->ToMPISerial(); 53 68 for (int i=0;i<SLGEOM_NUMLOADS;i++){ … … 64 79 void GrdLoads::BroadcastSealevelLoads(void){ /*{{{*/ 65 80 81 /*Avoid leakds:*/ 82 if(sealevelloads)xDelete<IssmDouble>(sealevelloads); 83 if(subsealevelloads)xDelete<IssmDouble>(subsealevelloads); 84 85 /*Serialize:*/ 66 86 sealevelloads=vsealevelloads->ToMPISerial(); 67 87 subsealevelloads=vsubsealevelloads->ToMPISerial(); 68 88 69 89 } /*}}}*/ 70 void GrdLoads::SHDegree2Coefficients(IssmDouble* deg2coeff, FemModel* femmodel, SealevelGeometry* slgeom){ 90 void GrdLoads::SHDegree2Coefficients(IssmDouble* deg2coeff, FemModel* femmodel, SealevelGeometry* slgeom){ /*{{{*/ 71 91 72 92 IssmDouble area,re, S; … … 119 139 ISSM_MPI_Bcast(°2coeff[2],1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 120 140 121 } 141 } /*}}}*/ -
issm/trunk-jpl/src/c/cores/sealevelchange_core.cpp
r27061 r27097 81 81 /*End profiler*/ 82 82 femmodel->profiler->Stop(SLRCORE); 83 84 /*Free ressources:*/ 85 delete slgeom; 86 83 87 } 84 88 /*}}}*/ … … 364 368 365 369 //convergence? 366 if(slcconvergence(loads->vsealevelloads,oldsealevelloads,eps_rel,eps_abs))break; 370 if(slcconvergence(loads->vsealevelloads,oldsealevelloads,eps_rel,eps_abs)){ 371 delete oldsealevelloads; break; 372 } 367 373 368 374 //early return? 369 if(iterations>=max_nonlinear_iterations)break; 375 if(iterations>=max_nonlinear_iterations){ 376 delete oldsealevelloads; break; 377 } 370 378 iterations++; 379 delete oldsealevelloads; 371 380 } 372 381 … … 388 397 if(planethasocean){ 389 398 if (!sealevelloading){ //we haven't done so before, so we need to compute the ocean average and area 390 loads->sealevelloads=NULL; //needed to trigger the calculation of areas399 if(loads->sealevelloads)xDelete<IssmDouble>(loads->sealevelloads); loads->sealevelloads=NULL; //needed to trigger the calculation of areas 391 400 /*retrieve sea level average and ocean area:*/ 392 401 for(Object* & object : femmodel->elements->objects){ … … 430 439 } 431 440 441 /*Free ressources:*/ 442 delete loads; 443 delete subelementoceanareas; 444 delete oceanareas; 445 xDelete<IssmDouble>(sealevelpercpu); 446 432 447 } 433 448 /*}}}*/ … … 607 622 #endif 608 623 624 xDelete<IssmDouble>(xxe); 625 xDelete<IssmDouble>(yye); 626 xDelete<IssmDouble>(zze); 627 xDelete<IssmDouble>(areae); 628 609 629 return; 610 630 … … 672 692 femmodel->parameters->AddObject(new DoubleVecParam(ZzeEnum,zze,nel)); 673 693 femmodel->parameters->AddObject(new DoubleVecParam(AreaeEnum,areae,nel)); 694 695 /*Free ressources:*/ 696 xDelete<IssmDouble>(xxe); 697 xDelete<IssmDouble>(yye); 698 xDelete<IssmDouble>(zze); 699 xDelete<IssmDouble>(areae); 674 700 675 701 return slgeom; … … 870 896 xDelete<IssmDouble>(m3interp); 871 897 } 872 } 898 xDelete<IssmDouble>(viscoustimes); 899 xDelete<IssmDouble>(viscouspolarmotion); 900 } 901 xDelete<IssmDouble>(pmtf_col); 902 xDelete<IssmDouble>(pmtf_ortho); 903 xDelete<IssmDouble>(pmtf_z); 873 904 874 905 } /*}}}*/ -
issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r26327 r27097 223 223 { 224 224 Tria* tria= xDynamicCast<Tria*>(element); 225 if(tria->hmaterial)delete tria->hmaterial; 225 226 tria->hmaterial=NULL; 226 227 }
Note:
See TracChangeset
for help on using the changeset viewer.