Changeset 16164


Ignore:
Timestamp:
09/18/13 09:17:13 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: cppcheck errors

Location:
issm/trunk-jpl/src/c
Files:
32 edited

Legend:

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

    r16159 r16164  
    433433
    434434        /*retrieve parameters: */
    435         ElementMatrix* Ke=NULL;
    436435        int analysis_type;
    437436        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
     
    14131412        /*Recover input*/
    14141413        Input* input=inputs->GetInput(enumtype);
    1415         if (!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
    1416         int    numnodes = this->NumberofNodes();
     1414        if(!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
    14171415
    14181416        /* Start looping on the number of vertices: */
    14191417        GaussPenta* gauss=new GaussPenta();
    1420         for (int iv=0;iv<this->NumberofNodes();iv++){
     1418        for(int iv=0;iv<this->NumberofNodes();iv++){
    14211419                gauss->GaussNode(this->element_type,iv);
    14221420                input->GetInputValue(&pvalue[iv],gauss);
     
    40844082        /*Intermediaries */
    40854083        int        stabilization;
    4086         int        i,j,found=0;
     4084        int        i,j;
    40874085        IssmDouble Jdet,u,v,w,um,vm,wm;
    40884086        IssmDouble h,hx,hy,hz,vx,vy,vz,vel;
     
    43204318        /*Intermediaries */
    43214319        int        stabilization;
    4322         int        i,j,found=0;
     4320        int        i,j;
    43234321        IssmDouble Jdet,u,v,w,um,vm,wm,vel;
    43244322        IssmDouble h,hx,hy,hz,vx,vy,vz;
     
    45404538
    45414539        /*Intermediaries*/
    4542         int        i,found=0;
     4540        int        i;
    45434541        int        stabilization;
    45444542        IssmDouble Jdet,phi,dt;
     
    45504548        IssmDouble u,v,w;
    45514549        IssmDouble scalar_def,scalar_transient;
    4552         IssmDouble temperature_list[NUMVERTICES];
    45534550        IssmDouble xyz_list[NUMVERTICES][3];
    45544551        IssmDouble L[numdof];
     
    48094806
    48104807        /*Intermediaries*/
    4811         int        i,found=0;
     4808        int        i;
    48124809        int        stabilization;
    48134810        IssmDouble Jdet,phi,dt;
     
    48184815        IssmDouble u,v,w;
    48194816        IssmDouble scalar_def,scalar_transient;
    4820         IssmDouble temperature_list[NUMVERTICES];
    48214817        IssmDouble xyz_list[NUMVERTICES][3];
    48224818        IssmDouble L[numdof];
     
    50865082        IssmDouble  B_average,s_average;
    50875083        int        *doflist = NULL;
    5088         IssmDouble  pressure[numdof];
     5084        //IssmDouble  pressure[numdof];
    50895085
    50905086        /*Get dof list: */
     
    79187914        int         i,j;
    79197915        IssmDouble  Jdet,viscosity;
    7920         IssmDouble  epsilon[5];       /* epsilon=[exx,eyy,exy,exz,eyz];*/
    79217916        IssmDouble  xyz_list[NUMVERTICES][3];
    79227917        IssmDouble  B[3][numdof2d];
     
    86588653        IssmDouble  xyz_list[NUMVERTICES][3];
    86598654        IssmDouble  basis[6]; //for the six nodes of the penta
    8660         Tria*       tria=NULL;
    86618655        Friction*   friction=NULL;
    86628656        GaussPenta  *gauss=NULL;
     
    88218815        IssmDouble  xyz_list[NUMVERTICES][3];
    88228816        IssmDouble  basis[6]; //for the six nodes of the penta
    8823         Tria*       tria=NULL;
    88248817        Friction*   friction=NULL;
    88258818        GaussPenta  *gauss=NULL;
     
    93679360        IssmDouble xyz_list[NUMVERTICES][3];
    93689361        IssmDouble epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
    9369         IssmDouble l1l6[6]; //for the six nodes and the bubble
    9370         IssmDouble dh1dh6[3][NUMVERTICES];
    93719362        GaussPenta *gauss=NULL;
    93729363
    93739364        /*Stabilization*/
    9374         bool       stabilization = true;
    93759365        IssmDouble dbasis[3][6];
    93769366        IssmDouble dmu[3];
     
    94129402
    94139403                GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
    9414                 GetNodalFunctionsP1(&l1l6[0], gauss);
    94159404                this->GetStrainRate3d(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
    94169405                material->GetViscosity3dFS(&viscosity,&epsilon[0]);
     
    97909779/*FUNCTION Penta::CreateJacobianStressbalanceHO{{{*/
    97919780ElementMatrix* Penta::CreateJacobianStressbalanceHO(void){
    9792 
    9793         /*Constants*/
    9794         const int    numdof=NDOF2*NUMVERTICES;
    97959781
    97969782        /*Intermediaries */
     
    1067010656        int*       doflists        = NULL;
    1067110657        int*       doflistpressure = NULL;
    10672         Penta      *penta          = NULL;
    10673 
    10674         /*OK, we have to add results of this element for HO
    10675          * and results from the penta at base for SSA. Now recover results*/
    10676         penta=GetBasalElement();
    1067710658
    1067810659        /*Get dof listof this element (HO dofs) and of the penta at base (SSA dofs): */
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r16162 r16164  
    350350
    351351        /*retrive parameters: */
    352         ElementVector* pe=NULL;
    353352        int analysis_type;
    354353        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
     
    12251224        /*Recover input*/
    12261225        Input* input=inputs->GetInput(enumtype);
    1227         if (!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
    1228         int    numnodes = this->NumberofNodes();
     1226        if(!input) _error_("Input " << EnumToStringx(enumtype) << " not found in element");
    12291227
    12301228        /* Start looping on the number of vertices: */
     
    20412039
    20422040        /*Intermediaries*/
    2043         int     i;
    2044         int     numberofresults = 0;
    2045         int     *resultsenums   = NULL;
    2046         int     *resultssizes   = NULL;
    2047         IssmDouble  *resultstimes   = NULL;
    2048         int     *resultssteps   = NULL;
     2041        int        *resultsenums    = NULL;
     2042        int        *resultssizes    = NULL;
     2043        IssmDouble *resultstimes    = NULL;
     2044        int        *resultssteps    = NULL;
    20492045
    20502046        /*Checks*/
     
    20522048
    20532049        /*Count number of results*/
    2054         for(i=0;i<this->results->Size();i++){
    2055                 ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);
    2056                 numberofresults++;
    2057         }
     2050        int numberofresults = this->results->Size();
    20582051
    20592052        if(numberofresults){
     
    20662059
    20672060                /*populate enums*/
    2068                 for(i=0;i<this->results->Size();i++){
     2061                for(int i=0;i<this->results->Size();i++){
    20692062                        ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);
    20702063                        resultsenums[i]=elementresult->InstanceEnum();
     
    24202413        /*Intermediaries*/
    24212414        int        i;
    2422         int        tria_vertex_ids[3];
    24232415        IssmDouble nodeinputs[3];
    24242416        IssmDouble yts;
     
    24412433        /*Recover element type*/
    24422434        this->SetElementType(finiteelement_type,analysis_counter);
    2443 
    2444         /*Recover vertices ids needed to initialize inputs*/
    2445         for(i=0;i<3;i++){
    2446                 tria_vertex_ids[i]=reCast<int>(iomodel->elements[3*index+i]); //ids for vertices are in the elements array from Matlab
    2447         }
    24482435
    24492436        /*Recover nodes ids needed to initialize the node hook.*/
     
    31813168        /*Fetch number of nodes and dof for this finite element*/
    31823169        int numnodes = this->NumberofNodes();
    3183         int numdof   = numnodes*NDOF2;
    31843170
    31853171        /*Initialize Element vector and vectors*/
     
    33143300        /*Fetch number of nodes and dof for this finite element*/
    33153301        int numnodes = this->NumberofNodes(); _assert_(numnodes==3);
    3316         int numdof   = numnodes*NDOF2;
    33173302
    33183303        /*Initialize Element vector*/
     
    33713356        /*Fetch number of nodes and dof for this finite element*/
    33723357        int numnodes = this->NumberofNodes();
    3373         int numdof   = numnodes*NDOF2;
    33743358
    33753359        /*Initialize Element matrix, vectors and Gaussian points*/
     
    40334017        IssmDouble grade_g_gaussian[NUMVERTICES];
    40344018        IssmDouble basis[3];
    4035         IssmDouble epsilon[3]; /* epsilon=[exx,eyy,exy];*/
    40364019        Friction*  friction=NULL;
    40374020        GaussTria  *gauss=NULL;
     
    45374520IssmDouble Tria::SurfaceLogVxVyMisfit(int weight_index){
    45384521
    4539         int        fit=-1;
    45404522        IssmDouble Jelem=0, S=0;
    45414523        IssmDouble epsvel=2.220446049250313e-16;
     
    72587240        IssmDouble D_scalar,Jdet,thickness;
    72597241        IssmDouble xyz_list[NUMVERTICES][3];
    7260         IssmDouble D[2][2];
    72617242        IssmDouble l=8.;
    72627243
     
    74987479        ElementVector* pe    = new ElementVector(nodes,numnodes,this->parameters);
    74997480        IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
    7500         IssmDouble*    Vx     = xNew<IssmDouble>(numnodes);
    7501         IssmDouble*    Vy     = xNew<IssmDouble>(numnodes);
    75027481
    75037482        /*Retrieve all inputs and parameters*/
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r16144 r16164  
    400400void FemModel::UpdateConstraintsx(void){ /*{{{*/
    401401
    402         Element   *element = NULL;
    403402        IssmDouble time;
    404403        int        analysis_type;
     
    10221021
    10231022        /*Intermediary*/
    1024         int      num_responses;
    1025         Element *element       = NULL;
    1026         int     *responses     = NULL;
     1023        int num_responses;
     1024        int *responses = NULL;
    10271025
    10281026        /*output: */
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r16141 r16164  
    288288        va_list ap;
    289289        int     dataenum;
    290         int     i;
    291         DoubleMatParam* parameter=NULL;
    292290
    293291        /*Go through the entire list of enums and delete the corresponding data from the iomodel-data dataset: */
    294 
    295292        va_start(ap,num);
    296         for(i = 0; i <num; i++){
    297                 dataenum=va_arg(ap, int);
     293        for(int i=0;i<num;i++){
     294                dataenum=va_arg(ap,int);
    298295                _assert_(dataenum<MaximumNumberOfDefinitionsEnum);
    299296
     
    10411038        int     i;
    10421039        bool    defaulting    = false;
    1043         bool    transient     = false;
    1044 
    1045         FILE   *fid           = NULL;
    10461040        int     code          = 0;
    10471041        int     vector_layout = 0;
     
    10611055
    10621056        /*First of, find the record for the enum, and get code  of data type: */
    1063         fid=this->SetFilePointerToData(&code, &vector_layout,vector_enum);
     1057        this->SetFilePointerToData(&code, &vector_layout,vector_enum);
    10641058
    10651059        switch(code){
  • issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp

    r16042 r16164  
    3939        int  pos1,pos2,pos3,pos4;
    4040        int  num_nodes;
    41         int  num_elems;
    4241
    4342        /*numericalflux constructor data: */
    4443        int   numericalflux_elem_ids[2];
    45         int   numericalflux_mparid;
    4644        int   numericalflux_vertex_ids[2];
    4745        int   numericalflux_node_ids[4];
    4846        int   numericalflux_type;
    49 
    50         /* Get MatPar id */
    51         numericalflux_mparid=iomodel->numberofelements+1; //matlab indexing
    5247
    5348        /*Get edge*/
     
    6055        if(e2==-1){
    6156                /* Boundary edge, only one element */
    62                 num_elems=1; num_nodes=2;
     57                num_nodes=2;
    6358                numericalflux_type=BoundaryEnum;
    6459                numericalflux_elem_ids[0]=e1;
     
    6661        else{
    6762                /* internal edge: connected to 2 elements */
    68                 num_elems=2; num_nodes=4;
     63                num_nodes=4;
    6964                numericalflux_type=InternalEnum;
    7065                numericalflux_elem_ids[0]=e1;
  • issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp

    r16151 r16164  
    441441
    442442        //   The penalty is stable if it doesn't change during to successive iterations.   
    443 
    444         int        found=0;
    445443        const int  numnodes=1;
    446444        IssmDouble pressure;
     
    449447        int        new_active;
    450448        int        unstable=0;
    451         int        reset_penalties=0;
    452449        int        penalty_lock;
    453450
     
    508505ElementMatrix* Pengrid::PenaltyCreateKMatrixMelting(IssmDouble kmax){
    509506
    510         const int numdof=NUMVERTICES*NDOF1;
    511507        IssmDouble pressure,temperature,t_pmp;
    512508        IssmDouble penalty_factor;
     
    538534ElementMatrix* Pengrid::PenaltyCreateKMatrixThermal(IssmDouble kmax){
    539535
    540         const int numdof=NUMVERTICES*NDOF1;
    541536        IssmDouble    penalty_factor;
    542537
     
    557552ElementVector* Pengrid::PenaltyCreatePVectorMelting(IssmDouble kmax){
    558553
    559         const int numdof=NUMVERTICES*NDOF1;
    560554        IssmDouble pressure;
    561555        IssmDouble temperature;
     
    600594ElementVector* Pengrid::PenaltyCreatePVectorThermal(IssmDouble kmax){
    601595
    602         const int numdof=NUMVERTICES*NDOF1;
    603596        IssmDouble pressure;
    604597        IssmDouble t_pmp;
     
    632625        const int  numnodes        = 1;
    633626        int        unstable        = 0;
    634         int        reset_penalties = 0;
    635         int        found           = 0;
    636627        int        new_active;
    637628        IssmDouble pressure;
     
    669660ElementMatrix* Pengrid::PenaltyCreateKMatrixHydrologyDCInefficient(IssmDouble kmax){
    670661
    671         const int numdof=NUMVERTICES*NDOF1;
    672662        IssmDouble    penalty_factor;
    673663
     
    688678ElementVector* Pengrid::PenaltyCreatePVectorHydrologyDCInefficient(IssmDouble kmax){
    689679
    690         const int  numdof=NUMVERTICES*NDOF1;
    691680        IssmDouble h_max;
    692681        IssmDouble penalty_factor;
  • issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp

    r16125 r16164  
    454454
    455455        const int   numdof = NDOF2*NUMVERTICES;
    456         int         dofs[1]             = {0};
    457456        IssmDouble  thickness;
    458457        IssmDouble  h[2];
     
    534533ElementVector* Riftfront::PenaltyCreatePVectorStressbalanceHoriz(IssmDouble kmax){
    535534
    536         const int  numdof = NDOF2*NUMVERTICES;
    537535        int        j;
    538536        IssmDouble rho_ice;
     
    636634int Riftfront::Constrain(int* punstable){
    637635
    638         const int   numnodes        = 2;
    639         IssmDouble      penetration;
     636        IssmDouble  penetration;
    640637        int         activate;
    641638        int         unstable;
    642         IssmDouble      vx1;
    643         IssmDouble      vy1;
    644         IssmDouble      vx2;
    645         IssmDouble      vy2;
    646         IssmDouble      fractionincrement;
     639        IssmDouble  vx1;
     640        IssmDouble  vy1;
     641        IssmDouble  vx2;
     642        IssmDouble  vy2;
     643        IssmDouble  fractionincrement;
    647644
    648645        /*Objects: */
    649         Tria       *tria1          = NULL;
    650         Tria       *tria2          = NULL;
     646        Tria  *tria1 = NULL;
     647        Tria  *tria2 = NULL;
    651648
    652649        /*enum of element? */
     
    756753int   Riftfront::MaxPenetration(IssmDouble* ppenetration){
    757754
    758         const int     numnodes=2;
    759         IssmDouble        penetration=0;
    760         IssmDouble      vx1;
    761         IssmDouble      vy1;
    762         IssmDouble      vx2;
    763         IssmDouble      vy2;
     755        IssmDouble penetration;
     756        IssmDouble vx1;
     757        IssmDouble vy1;
     758        IssmDouble vx2;
     759        IssmDouble vy2;
    764760
    765761        /*Objects: */
    766         Tria       *tria1          = NULL;
    767         Tria       *tria2          = NULL;
     762        Tria  *tria1 = NULL;
     763        Tria  *tria2 = NULL;
    768764
    769765        /*enum of element? */
     
    773769        tria1=(Tria*)elements[0];
    774770        tria2=(Tria*)elements[1];
    775 
    776         //initialize:
    777         penetration=-1;
    778771
    779772        /*recover velocity: */
     
    787780
    788781        /*Now, we return penetration only if we are active!: */
    789         if(this->active==0)penetration=-1;
     782        if(this->active==0) penetration=-1.;
    790783
    791784        /*If we are zigzag locked, same thing: */
    792         if(this->counter>this->penalty_lock)penetration=-1;
     785        if(this->counter>this->penalty_lock) penetration=-1.;
    793786
    794787        /*assign output pointer: */
     
    838831int   Riftfront::PotentialUnstableConstraint(int* punstable){
    839832
    840         const int   numnodes        = 2;
    841833        IssmDouble  penetration;
    842834        int         unstable;
     
    887879int   Riftfront::PreConstrain(int* punstable){
    888880
    889         const int   numnodes    = 2;
    890         IssmDouble      penetration;
     881        IssmDouble  penetration;
    891882        int         unstable;
    892         IssmDouble      vx1;
    893         IssmDouble      vy1;
    894         IssmDouble      vx2;
    895         IssmDouble      vy2;
     883        IssmDouble  vx1;
     884        IssmDouble  vy1;
     885        IssmDouble  vx2;
     886        IssmDouble  vy2;
    896887
    897888        /*Objects: */
    898         Tria       *tria1      = NULL;
    899         Tria       *tria2      = NULL;
     889        Tria *tria1 = NULL;
     890        Tria *tria2 = NULL;
    900891
    901892        /*enum of element? */
  • issm/trunk-jpl/src/c/classes/Node.cpp

    r16125 r16164  
    2626        /*Intermediary*/
    2727        int k,l;
    28         int gsize;
    2928
    3029        /*id: */
     
    4140        this->indexingupdate = true;
    4241        DistributeNumDofs(&this->indexing,analysis_type,in_approximation); //number of dofs per node
    43         gsize=this->indexing.gsize;
    4442
    4543        if(analysis_type==StressbalanceAnalysisEnum)
     
    11281126void CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes,int numnodes,int* cs_array){/*{{{*/
    11291127
    1130         int     i,counter;
    1131         int     numdofs           = 0;
     1128        int         i,counter;
     1129        int         numdofs   = 0;
    11321130        IssmDouble  norm;
    1133         IssmDouble *transform         = NULL;
    1134         IssmDouble *values            = NULL;
     1131        IssmDouble *transform = NULL;
    11351132        IssmDouble  coord_system[3][3];
    11361133
  • issm/trunk-jpl/src/c/classes/kriging/Observations.cpp

    r15741 r16164  
    125125        /*Output and Intermediaries*/
    126126        int          nobs,i,index;
    127         IssmPDouble  hmin,h2,hmin2,radius2;
     127        IssmPDouble  hmin,h2,hmin2;
    128128        int         *indices      = NULL;
    129129        Observation *observation  = NULL;
     
    139139                if(hmin<radius) radius=hmin;
    140140        }
    141 
    142         /*Compute radius square*/
    143         radius2 = radius*radius;
    144141
    145142        /*Find all observations that are in radius*/
  • issm/trunk-jpl/src/c/classes/kriging/Quadtree.cpp

    r15741 r16164  
    257257        QuadtreeBox  *box  = NULL;
    258258        int           xi,yi;
    259         int           level,levelbin;
     259        int           levelbin;
    260260        int           index = -1;
    261261        double        length,length2;
     
    264264        this->IntergerCoordinates(&xi,&yi,x,y);
    265265
    266         /*Initialize levels*/
    267         level    = 0;
     266        /*Initialize level*/
    268267        levelbin = (1L<<this->MaxDepth);// = 2^30
    269268
     
    273272        /*Find the smallest box where this point is located*/
    274273        while((box=*pbox) && (box->nbitems<0)){
    275 
    276                 levelbin>>=1; level+=1;
    277 
     274                levelbin>>=1;
    278275                pbox = &box->box[IJ(xi,yi,levelbin)];
    279276        }
  • issm/trunk-jpl/src/c/main/kriging.cpp

    r15839 r16164  
    1414        FILE *output_fid = NULL;
    1515        FILE *input_fid  = NULL;
    16         bool  waitonlock = false;
    1716
    1817        /*File names*/
  • issm/trunk-jpl/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp

    r14999 r16164  
    1919        int     npart;
    2020        double *qmu_part  = NULL;
    21         int     numberofvertices;
    2221
    2322        /*output: */
     
    3130
    3231        /*Some parameters: */
    33         numberofvertices=vertices->NumberOfVertices();
    3432        parameters->FindParam(&npart,QmuNumberofpartitionsEnum);
    3533
  • issm/trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp

    r14999 r16164  
    1111
    1212        /*Intermediary*/
    13         int i;
    14         int      found=0;
    15         IssmDouble   numberofelements;
    16         Element* element=NULL;
     13        IssmDouble numberofelements;
     14        Element*   element=NULL;
    1715
    1816        /*output: */
     
    2624
    2725        /*Compute basal stress for each element: */
    28         for (i=0;i<elements->Size();i++){
     26        for(int i=0;i<elements->Size();i++){
    2927                element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    3028                element->ComputeBasalStress(sigma);
  • issm/trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.cpp

    r14999 r16164  
    88#include "../../toolkits/toolkits.h"
    99
    10 void    ComputeStrainRatex( Vector<IssmDouble>** peps,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,Parameters* parameters){
     10void    ComputeStrainRatex(Vector<IssmDouble>** peps,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,Parameters* parameters){
    1111
    1212        /*Intermediary*/
    13         int i;
    14         int      found=0;
    1513        int      numberofelements;
    1614        Element* element=NULL;
     
    2624
    2725        /*Compute basal stress for each element: */
    28         for (i=0;i<elements->Size();i++){
     26        for(int i=0;i<elements->Size();i++){
    2927                element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    3028                element->ComputeStrainRate(eps);
  • issm/trunk-jpl/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp

    r15439 r16164  
    1212
    1313        /*Intermediary*/
    14         int i;
    15         int noerr=1;
    16         int configuration_type;
    17         Element  *element  = NULL;
    18         Load     *load     = NULL;
    19         Node     *node     = NULL;
    20         Material *material = NULL;
     14        int       i;
     15        int       noerr = 1;
     16        int       configuration_type;
     17        Element  *element            = NULL;
     18        Load     *load               = NULL;
     19        Material *material           = NULL;
    2120
    2221        /*Get analysis type: */
     
    2423
    2524        if(VerboseMProcessor()) _printf0_("      Configuring elements...\n");
    26         for (i=0;i<elements->Size();i++){
     25        for(i=0;i<elements->Size();i++){
    2726                element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    2827                element->Configure(elements,loads,nodes,vertices,materials,parameters);
    2928        }
    3029        if(VerboseMProcessor()) _printf0_("      Configuring loads...\n");
    31         for (i=0;i<loads->Size();i++){
     30        for(i=0;i<loads->Size();i++){
    3231                load=(Load*)loads->GetObjectByOffset(i);
    3332                if (load->InAnalysis(configuration_type)){
     
    3635        }
    3736        if(VerboseMProcessor()) _printf0_("      Configuring materials...\n");
    38         for (i=0;i<materials->Size();i++){
     37        for(i=0;i<materials->Size();i++){
    3938                material=(Material*)materials->GetObjectByOffset(i);
    4039                material->Configure(elements);
  • issm/trunk-jpl/src/c/modules/ConstraintsStatex/RiftConstraintsState.cpp

    r15838 r16164  
    230230void RiftSetPreStable(Loads* loads){
    231231
    232         int i;
    233 
    234         Riftfront* riftfront=NULL;
    235         int found=0;
    236         int mpi_found=0;
    237 
    238232        /*go though loads, and set loads to pre stable.:*/
    239         for (i=0;i<loads->Size();i++){
    240 
     233        for(int i=0;i<loads->Size();i++){
    241234                if(RiftfrontEnum==loads->GetEnum(i)){
    242 
    243                         riftfront=(Riftfront*)loads->GetObjectByOffset(i);
     235                        Riftfront* riftfront=(Riftfront*)loads->GetObjectByOffset(i);
    244236                        riftfront->SetPreStable();
    245237                }
  • issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshxt.cpp

    r15335 r16164  
    1313void* ContourToMeshxt(void* vpthread_handle){
    1414
    15         int noerr=1;
    16 
    1715        /*gate variables :*/
    18         ContourToMeshxThreadStruct* gate=NULL;
    19         pthread_handle* handle=NULL;
    20         int     my_thread;
    21         int     num_threads;
    22         int     i0;
    23         int     i1;
    24 
    25         int i;
    26 
    27         /*Contour:*/
    28         Contours* contours=NULL;
    29 
    30         /*parameters: */
    31         int nods;
    32         int edgevalue;
    33         double* x=NULL;
    34         double* y=NULL;
    35         double* in_nod=NULL;
     16        ContourToMeshxThreadStruct *gate        = NULL;
     17        pthread_handle             *handle      = NULL;
     18        int  i,i1,i0;
    3619
    3720        /*recover handle and gate: */
    38         handle=(pthread_handle*)vpthread_handle;
    39         gate=(ContourToMeshxThreadStruct*)handle->gate;
    40         my_thread=handle->id;
    41         num_threads=handle->num;
     21        handle          = (pthread_handle*)vpthread_handle;
     22        gate            = (ContourToMeshxThreadStruct*)handle->gate;
     23        int my_thread   = handle->id;
     24        int num_threads = handle->num;
    4225
    4326        /*recover parameters :*/
    44         contours=gate->contours;
    45         nods=gate->nods;
    46         edgevalue=gate->edgevalue;
    47         in_nod=gate->in_nod;
    48         x=gate->x;
    49         y=gate->y;
     27        Contours* contours  = gate->contours;
     28        int       nods      = gate->nods;
     29        int       edgevalue = gate->edgevalue;
     30        double   *in_nod    = gate->in_nod;
     31        double   *x         = gate->x;
     32        double   *y         = gate->y;
    5033
    5134        /*distribute indices across threads :*/
  • issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp

    r15335 r16164  
    3434int ContourToNodesx(IssmPDouble** pflags,double* x, double* y, int nods, Contours* contours, int edgevalue){
    3535
    36         /*Contour:*/
    37         Contour<IssmPDouble>* contouri=NULL;
    38         double*  xc=NULL;
    39         double*  yc=NULL;
    40 
    4136        /*output: */
    4237        IssmPDouble* flags=NULL;
  • issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp

    r16126 r16164  
    1111
    1212        int      i,connectivity;
    13         int      numberofdofspernode;
    14         int      fsize,configuration_type;
     13        int      configuration_type;
    1514        Element *element = NULL;
    1615        Load    *load    = NULL;
     
    2322        femmodel->parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
    2423        femmodel->parameters->FindParam(&connectivity,MeshAverageVertexConnectivityEnum);
    25         fsize=femmodel->nodes->NumberOfDofs(configuration_type,FsetEnum);
    26         numberofdofspernode=femmodel->nodes->MaxNumDofs(configuration_type,GsetEnum);
    2724
    2825        /*Initialize Jacobian Matrix*/
  • issm/trunk-jpl/src/c/modules/GiaDeflectionCorex/GiaDeflectionCorex.cpp

    r15140 r16164  
    9292
    9393        /*Recover material parameters and loading history: see GiaDeflectionCoreArgs for more details {{{*/
    94         ri=arguments->ri;
    95         re=arguments->re;
    96         hes=arguments->hes;
    97         times=arguments->times;
    98         numtimes=arguments->numtimes;
    99         currenttime=arguments->currenttime;
    100         lithosphere_shear_modulus=arguments->lithosphere_shear_modulus;
    101         lithosphere_density=arguments->lithosphere_density;
    102         mantle_shear_modulus=arguments->mantle_shear_modulus;
    103         mantle_viscosity=arguments->mantle_viscosity;
    104         mantle_density=arguments->mantle_density;
    105         lithosphere_thickness=arguments->lithosphere_thickness;
    106         rho_ice=arguments->rho_ice;
    107         disk_id=arguments->idisk;
    108         iedge=arguments->iedge;
    109         yts=arguments->yts;
     94        ri                        = arguments->ri;
     95        re                        = arguments->re;
     96        hes                       = arguments->hes;
     97        times                     = arguments->times;
     98        numtimes                  = arguments->numtimes;
     99        currenttime               = arguments->currenttime;
     100        lithosphere_shear_modulus = arguments->lithosphere_shear_modulus;
     101        lithosphere_density       = arguments->lithosphere_density;
     102        mantle_shear_modulus      = arguments->mantle_shear_modulus;
     103        mantle_viscosity          = arguments->mantle_viscosity;
     104        mantle_density            = arguments->mantle_density;
     105        lithosphere_thickness     = arguments->lithosphere_thickness;
     106        rho_ice                   = arguments->rho_ice;
     107        disk_id                   = arguments->idisk;
     108        iedge                     = arguments->iedge;
     109        yts                       = arguments->yts;
    110110
    111111        /*}}}*/
  • issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

    r15969 r16164  
    8080/*FUNCTION PropagateFloatingiceToGroundedNeighbors {{{*/
    8181IssmDouble*    PropagateFloatingiceToGroundedNeighbors(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,IssmDouble* vertices_potentially_ungrounding){
    82         int                 i,analysis_type,numberofvertices;
     82        int                 i,analysis_type;
    8383        int                 nflipped,local_nflipped;
    8484        IssmDouble*         phi                                  = NULL;
     
    8686        Vector<IssmDouble>* vec_elements_neighboring_floatingice = NULL;
    8787        Vector<IssmDouble>* vec_phi                              = NULL;
    88         Node*               node                                  = NULL;
    8988        Element*            element                               = NULL;
    9089
    9190        /*recover parameters: */
    9291        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
    93         numberofvertices=vertices->NumberOfVertices();
    9492
    9593        /*recover vec_phi*/
  • issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp

    r15557 r16164  
    134134
    135135        bool debug = M*N>1? true:false;
    136         debug = true;
    137136
    138137        /*partition loop across threads: */
  • issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp

    r15694 r16164  
    1111
    1212        /*intermediary: */
    13         FILE       *fid = NULL;
    1413        int         code,vector_layout;
    1514        IssmDouble *spcdata = NULL;
     
    1716
    1817        /*First of, find the record for the enum, and get code  of data type: */
    19         fid=iomodel->SetFilePointerToData(&code, &vector_layout,vector_enum);
     18        iomodel->SetFilePointerToData(&code, &vector_layout,vector_enum);
    2019        if(code!=7)_error_("expecting a IssmDouble vector for constraints with enum " << EnumToStringx(vector_enum));
    2120        if(vector_layout!=1)_error_("expecting a nodal vector for constraints with enum " << EnumToStringx(vector_enum));
  • issm/trunk-jpl/src/c/modules/Kml2Expx/Kml2Expx.cpp

    r15104 r16164  
    88#include "../KMLFileReadx/KMLFileReadx.h"
    99
    10 int Kml2Expx(char* filkml,char* filexp,
    11                          int sgn){
     10int Kml2Expx(char* filkml,char* filexp,int sgn){
    1211
    1312        double  cm,sp;
    14 
    1513        Ll2xydef(&cm,&sp,sgn);
    1614
    17         return(Kml2Expx(filkml,filexp,
    18                                         sgn,cm,sp));
     15        return(Kml2Expx(filkml,filexp,sgn,cm,sp));
    1916}
    2017
    21 int Kml2Expx(char* filkml,char* filexp,
    22                          int sgn,double cm,double sp){
     18int Kml2Expx(char* filkml,char* filexp,int sgn,double cm,double sp){
    2319
    24         int     iret=0;
    25         double  *lat=NULL,*lon=NULL;
    26 
    27         KML_Object*  kobj=NULL;
    28 
    29         FILE*   fidi=NULL;
    30         FILE*   fido=NULL;
    31 
    32         clock_t clock0,clock1;
    33         time_t  time0, time1;
     20        int         iret   = 0;
     21        KML_Object *kobj   = NULL;
     22        FILE       *fidi   = NULL;
     23        FILE       *fido   = NULL;
     24        clock_t     clock0,clock1;
     25        time_t      time0 ,time1;
    3426
    3527        clock0=clock();
     
    3729        _printf0_("\nKml2Expx Module -- " << ctime(&time0));
    3830
    39 /*  read kml file  */
    40 
     31        /*read kml file*/
    4132        fidi=fopen(filkml,"r");
    4233        if (!(kobj=KMLFileReadx(fidi)))
    43                 _error_("Error reading kml file.");
     34         _error_("Error reading kml file.");
    4435        fclose(fidi);
    4536
    46 /*  open exp file  */
    47 
     37        /*open exp file*/
    4838        _printf0_("Writing exp profiles to file.\n");
    4939        fido=fopen(filexp,"w");
    5040
    51 /*  write the polygons and linestrings  */
    52 
     41        /*write the polygons and linestrings  */
    5342        kobj->WriteExp(fido,"",sgn,cm,sp);
    5443
    55 /*  close exp file  */
    56 
     44        /*close exp file  */
    5745        fclose(fido);
    58 
    5946        delete kobj;
    6047
  • issm/trunk-jpl/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp

    r14219 r16164  
    7575
    7676        /*output: */
    77         double*  segments=NULL;
    78         Segment<double>* segment=NULL;
     77        double* segments=NULL;
    7978        int     numsegs;
    8079
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp

    r16144 r16164  
    188188                        temp_m=mdims_array[i];
    189189                        temp_n=ndims_array[i];
     190                        _assert_(temp_n==5);
    190191
    191192                        m=0;
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/Stressbalance/CreateConstraintsStressbalance.cpp

    r15986 r16164  
    8585                        }
    8686                }
     87                else{
     88                        _error_("model not supported yet");
     89                }
    8790
    8891                IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/Stressbalance/CreateLoadsStressbalance.cpp

    r15986 r16164  
    99void    CreateLoadsStressbalance(Loads** ploads, IoModel* iomodel){
    1010
    11         /*DataSets*/
    12         Pengrid   *pengrid   = NULL;
    13 
    1411        /*Intermediary*/
    1512        int         segment_width;
     
    1916        int         penpair_ids[2];
    2017        bool        isSSA,isL1L2,isHO,isFS;
    21         int         numpenalties,numberofpressureloads,numrifts,numriftsegments;
    22         IssmDouble *pressureload   = NULL;
    23         IssmDouble *elements_type  = NULL;
    24         IssmDouble *nodeoniceshelf = NULL;
     18        int         numpenalties,numrifts,numriftsegments;
    2519        IssmDouble *riftinfo       = NULL;
    26         IssmDouble *nodeonbed      = NULL;
    27         IssmDouble *nodeonFS   = NULL;
    28         IssmDouble *nodeonicesheet = NULL;
    29         IssmDouble *vertices_type  = NULL;
    3020        IssmDouble *penalties      = NULL;
    3121        int         assert_int;
  • issm/trunk-jpl/src/c/modules/ModelProcessorx/StressbalanceSIA/CreateConstraintsStressbalanceSIA.cpp

    r15771 r16164  
    1717        /*Output*/
    1818        Constraints* constraints = NULL;
    19         SpcStatic*    spcstatic  = NULL;
    2019
    2120        /*Recover pointer: */
  • issm/trunk-jpl/src/c/modules/NodalValuex/NodalValuex.cpp

    r15838 r16164  
    1010void NodalValuex( IssmDouble* pnodalvalue, int natureofdataenum,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters){
    1111
    12         int my_rank;
    13         int i;
    14         int index;
    15         Element* element=NULL;
    1612        IssmDouble value;
    17         int found;
    18         int sumfound;
    19         int cpu_found;
    20 
    21         /*Get my_rank:*/
    22         my_rank=IssmComm::GetRank();
     13        int        index;
     14        int        found,sumfound,cpu_found;
    2315
    2416        /*retrieve element we are interested in: */
     
    2719        /*This is the vertex id for which we want to collect the data. Go through elements, and for each
    2820         *element, figure out  if they hold the vertex, and the data. If so, return it: */
    29         for(i=0;i<elements->Size();i++){
     21        for(int i=0;i<elements->Size();i++){
    3022                Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    3123                found=element->NodalValue(&value,index,natureofdataenum);
    32                 if (found){
    33                         cpu_found=my_rank;
     24                if(found){
     25                        cpu_found=IssmComm::GetRank();
    3426                        break;
    3527                }
     
    3729
    3830        /*Broadcast whether we found the element: */
    39         ISSM_MPI_Allreduce ( &found,&sumfound,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm());
     31        ISSM_MPI_Allreduce(&found,&sumfound,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm());
    4032        if(!sumfound)_error_("could not find element with vertex with id" << index << " to compute nodal value " << EnumToStringx(natureofdataenum));
    4133
  • issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp

    r14656 r16164  
    1212        /*threading: */
    1313        PointCloudFindNeighborsThreadStruct gate;
    14         int num=1;
    1514
    1615        #ifdef _MULTITHREADING_
    17         num=_NUMTHREADS_;
     16        int num=_NUMTHREADS_;
     17        #else
     18        int num=1;
    1819        #endif
    1920
  • issm/trunk-jpl/src/c/shared/Elements/ComputeDelta18oTemperaturePrecipitation.cpp

    r14951 r16164  
    1616  IssmDouble delta18oLapseRate=-6.2*pow(10.,-3);
    1717  IssmDouble glacialindex; // used to vary present day temperature
    18   int imonth=0;
    1918
    20   glacialindex = 0;//(Delta18oTime-Delta18oPresent-delta18oLapseRate*(Delta18oSurfaceTime-Delta18oSurfacePresent))
     19  glacialindex = 0.;//(Delta18oTime-Delta18oPresent-delta18oLapseRate*(Delta18oSurfaceTime-Delta18oSurfacePresent))
    2120  //  /(Delta18oLgm-Delta18oPresent-delta18oLapseRate*(Delta18oSurfaceLgm-Delta18oSurfacePresent));
    2221
    2322  for (int imonth = 0; imonth<12; imonth++){ 
    24     monthlytemperaturestmp[imonth] = glacialindex*TemperaturesLgm[imonth] + (1-glacialindex)*TemperaturesPresentday[imonth];
     23    monthlytemperaturestmp[imonth] = glacialindex*TemperaturesLgm[imonth] + (1.-glacialindex)*TemperaturesPresentday[imonth];
    2524    //monthlyprectmp[imonth] = 1.5*pow(2,((monthlytemperaturestmp[imonth]-273.15-0)/10)); //equation from rob's paper
    2625    monthlyprectmp[imonth] = PrecipitationsPresentday[imonth];
Note: See TracChangeset for help on using the changeset viewer.