Changeset 25336


Ignore:
Timestamp:
08/01/20 20:45:26 (5 years ago)
Author:
Mathieu Morlighem
Message:

CHG: better initialization of vector and some cosmetics to issm toolkits

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/modules/SetActiveNodesLSMx/SetActiveNodesLSMx.cpp

    r24335 r25336  
    6262        int numvertices=femmodel->vertices->NumberOfVertices();
    6363        if(numvertices==0)  return;
    64         Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices);
     64        int numvertices_local=femmodel->vertices->NumberOfVerticesLocal();
     65        Vector<IssmDouble>* vec_mask_ice=new Vector<IssmDouble>(numvertices,numvertices_local);
    6566
    6667        /*Fill vector with values: */
  • issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp

    r23266 r25336  
    319319  xDelete(valueX);
    320320  xDelete(indexX);
     321 
     322  delete data;
    321323}
    322324/*}}}*/
     
    374376
    375377    tape.pushExternalFunctionHandle(&SolverxSeq_codi_b, dataHandler, &SolverxSeq_codi_delete);
    376   } else {
     378  }
     379  else{
    377380    // if the tape is active valueX is stored in the dataHandler and deleted in the reverse sweep
    378381    xDelete(valueX);
  • issm/trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h

    r24682 r25336  
    3636        public:
    3737
     38                bool isassembled;
    3839                int M; //global size
    3940                int m; //local number of rows
     
    4647                        this->M=0;
    4748                        this->m=0;
     49                        this->isassembled=false;
    4850                        this->vector=NULL;
    4951                        this->buckets=new DataSet();
     
    102104
    103105                        this->buckets=new DataSet();
     106                        this->isassembled=false;
    104107
    105108                        if(fromlocalsize){
     
    137140                void Echo(void){/*{{{*/
    138141
    139                         int i,j;
    140 
    141142                        /*Do a synchronized dump across all the rows: */
    142                         for(i=0;i<IssmComm::GetSize();i++){
     143                        int my_rank=IssmComm::GetRank();
     144                        for(int i=0;i<IssmComm::GetSize();i++){
     145                                if(my_rank==i){
     146                                        if(i==0) _printf_("Vector of global size M="<<this->M<<"\n");
     147                                        _printf_("cpu " << i << " #rows: " << this->m << "\n");
     148                                        if(this->isassembled){
     149                                                for(int j=0;j<this->m;j++){
     150                                                        _printf_("row " << j << ": "<<this->vector[j]);
     151                                                        _printf_("\n");
     152                                                }
     153                                        }
     154                                        else{
     155                                                this->buckets->DeepEcho();
     156                                        }
     157                                }
    143158                                ISSM_MPI_Barrier(IssmComm::GetComm());
    144159                        }
     
    236251                        count=0;
    237252                        for(i=0;i<num_procs;i++){
    238                                 sendcnts[i]=numvalues_forcpu[i];
    239                                 displs[i]=count;
    240                                 count+=numvalues_forcpu[i];
     253                                sendcnts[i] = numvalues_forcpu[i];
     254                                displs[i]   = count;
     255                                count      += numvalues_forcpu[i];
    241256                        }
    242257
     
    262277                        }
    263278                        /*}}}*/
     279                        this->isassembled=true;
    264280
    265281                        /*Free ressources:{{{*/
  • issm/trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp

    r23348 r25336  
    576576  xDelete(valueX);
    577577  xDelete(indexX);
     578
     579  delete data;
    578580}
    579581/*}}}*/
     
    638640         //tape.pushExternalFunction(&MumpsSolve_codi_b, dataHandler, &MumpsSolve_codi_delete);
    639641    tape.pushExternalFunctionHandle(&MumpsSolve_codi_b,(void*)dataHandler, &MumpsSolve_codi_delete);
    640   } else {
     642  }
     643  else{
    641644    // if the tape is active valueB is stored in the dataHandler and deleted in the reverse sweep
    642645    xDelete(valueB);
Note: See TracChangeset for help on using the changeset viewer.