Changeset 25728


Ignore:
Timestamp:
10/31/20 16:37:05 (4 years ago)
Author:
Mathieu Morlighem
Message:

CHG: trying to get rid of as many xNew as possible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Element.cpp

    r25563 r25728  
    255255        /*Allocate arrays*/
    256256        const int NUM_VERTICES = this->GetNumberOfVertices();
    257 
    258         IssmDouble* eps_xx = xNew<IssmDouble>(NUM_VERTICES);
    259         IssmDouble* eps_yy = xNew<IssmDouble>(NUM_VERTICES);
    260         IssmDouble* eps_zz = xNew<IssmDouble>(NUM_VERTICES);
    261         IssmDouble* eps_xy = xNew<IssmDouble>(NUM_VERTICES);
    262         IssmDouble* eps_xz = xNew<IssmDouble>(NUM_VERTICES);
    263         IssmDouble* eps_yz = xNew<IssmDouble>(NUM_VERTICES);
    264         IssmDouble* eps_ef = xNew<IssmDouble>(NUM_VERTICES);
     257        _assert_(NUM_VERTICES<=MAXVERTICES);
     258
     259        IssmDouble eps_xx[MAXVERTICES];
     260        IssmDouble eps_yy[MAXVERTICES];
     261        IssmDouble eps_zz[MAXVERTICES];
     262        IssmDouble eps_xy[MAXVERTICES];
     263        IssmDouble eps_xz[MAXVERTICES];
     264        IssmDouble eps_yz[MAXVERTICES];
     265        IssmDouble eps_ef[MAXVERTICES];
    265266
    266267        /* Start looping on the number of vertices: */
     
    297298
    298299        /*Add Stress tensor components into inputs*/
    299         this->AddInput(StrainRatexxEnum,eps_xx,P1Enum);
    300         this->AddInput(StrainRatexyEnum,eps_xy,P1Enum);
    301         this->AddInput(StrainRatexzEnum,eps_xz,P1Enum);
    302         this->AddInput(StrainRateyyEnum,eps_yy,P1Enum);
    303         this->AddInput(StrainRateyzEnum,eps_yz,P1Enum);
    304         this->AddInput(StrainRatezzEnum,eps_zz,P1Enum);
    305         this->AddInput(StrainRateeffectiveEnum,eps_ef,P1Enum);
     300        this->AddInput(StrainRatexxEnum,&eps_xx[0],P1Enum);
     301        this->AddInput(StrainRatexyEnum,&eps_xy[0],P1Enum);
     302        this->AddInput(StrainRatexzEnum,&eps_xz[0],P1Enum);
     303        this->AddInput(StrainRateyyEnum,&eps_yy[0],P1Enum);
     304        this->AddInput(StrainRateyzEnum,&eps_yz[0],P1Enum);
     305        this->AddInput(StrainRatezzEnum,&eps_zz[0],P1Enum);
     306        this->AddInput(StrainRateeffectiveEnum,&eps_ef[0],P1Enum);
    306307
    307308        /*Clean up and return*/
    308309        delete gauss;
    309310        xDelete<IssmDouble>(xyz_list);
    310         xDelete<IssmDouble>(eps_xx);
    311         xDelete<IssmDouble>(eps_yy);
    312         xDelete<IssmDouble>(eps_zz);
    313         xDelete<IssmDouble>(eps_xy);
    314         xDelete<IssmDouble>(eps_xz);
    315         xDelete<IssmDouble>(eps_yz);
    316         xDelete<IssmDouble>(eps_ef);
    317 
    318311}
    319312/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.