Changeset 21068


Ignore:
Timestamp:
08/04/16 08:53:35 (9 years ago)
Author:
Mathieu Morlighem
Message:

CHG: fixed compilation warning and export kriging results with string rather than enum

Location:
issm/trunk-jpl/src
Files:
6 edited

Legend:

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

    r21049 r21068  
    14981498                if(num_cost_functions<1) _error_("No cost functions found");
    14991499                cost_functions_enums=xNew<int>(num_cost_functions);
    1500                 for(int j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
     1500                for(j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
    15011501
    15021502                /*Create inputs and add to DataSetInput*/
  • issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp

    r21049 r21068  
    462462                if(num_cost_functions<1) _error_("No cost functions found");
    463463                cost_functions_enums=xNew<int>(num_cost_functions);
    464                 for(int j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
     464                for(j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
    465465
    466466                /*Create inputs and add to DataSetInput*/
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r21049 r21068  
    18331833                if(num_cost_functions<1) _error_("No cost functions found");
    18341834                cost_functions_enums=xNew<int>(num_cost_functions);
    1835                 for(int j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
     1835                for(j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
    18361836
    18371837                /*Create inputs and add to DataSetInput*/
  • issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h

    r20810 r21068  
    8080                } /*}}}*/
    8181                GenericExternalResult(int in_id, int in_enum_type,ResultType in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
    82                         id          = 0;
    83                         result_name = NULL;
    84                         M           = 0;
    85                         N           = 0;
    86                         step        = 0;
    87                         time        = 0;
    88                         value       = in_values;
    8982                        _error_("template GenericExternalResult(int in_id, int in_enum_type,double* in_values, int in_M,int in_N,int in_step,IssmDouble in_time) not implemented for this ResultType\n");
    9083                }
    9184/*}}}*/
     85                GenericExternalResult(int in_id,const char* name_in,ResultType in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
     86                        _error_("template GenericExternalResult(int in_id, int in_enum_type,double* in_values, int in_M,int in_N,int in_step,IssmDouble in_time) not implemented for this ResultType\n");
     87                }
     88                /*}}}*/
    9289                GenericExternalResult(int in_id, int in_enum_type,ResultType in_value,int in_step, IssmDouble in_time){ /*{{{*/
    9390                        id        = in_id;
     
    357354}
    358355/*}}}*/
     356template <> inline GenericExternalResult<IssmPDouble*>::GenericExternalResult(int in_id,const char* in_result_name,IssmPDouble* in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
     357
     358        id = in_id;
     359        M  = in_M;
     360        N  = in_N;
     361
     362        /*Copy name*/
     363        this->result_name = xNew<char>(strlen(in_result_name)+1);
     364        xMemCpy<char>(this->result_name,in_result_name,strlen(in_result_name)+1);
     365
     366        step = in_step;
     367        time = in_time;
     368
     369        /*Copy result in values*/
     370        if(M*N){
     371                value=xNew<IssmPDouble>(M*N);
     372                xMemCpy<IssmPDouble>(value,in_values,M*N);
     373        }
     374        else value=NULL;
     375}
     376/*}}}*/
    359377template <> inline GenericExternalResult<IssmPDouble*>::GenericExternalResult(int in_id, int in_enum_type,IssmPDouble* in_value,int in_step, IssmDouble in_time){ /*{{{*/
    360378        _error_("you cannot initialize a GenericExternalResult<IssmPDouble*> without providing the dimensions of the matrix! Please use a more appropriate constructor!");
  • issm/trunk-jpl/src/c/main/kriging.cpp

    r20840 r21068  
    5555        if(IssmComm::GetRank()==0){
    5656                output_fid=pfopen0(outbinfilename,"wb");
    57                 results->AddObject(new GenericExternalResult<double*>(results->Size()+1,0,predictions,ninterp,1,1,0));
    58                 results->AddObject(new GenericExternalResult<double*>(results->Size()+1,1,error,ninterp,1,1,0));
     57                results->AddObject(new GenericExternalResult<double*>(results->Size()+1,"predictions",predictions,ninterp,1,1,0));
     58                results->AddObject(new GenericExternalResult<double*>(results->Size()+1,"error",error,ninterp,1,1,0));
    5959                for(int i=0;i<results->Size();i++){
    6060                        ExternalResult* result=xDynamicCast<ExternalResult*>(results->GetObjectByOffset(i));
  • issm/trunk-jpl/src/m/contrib/morlighem/gslib/pkriging.m

    r20840 r21068  
    4343end
    4444Download(cluster,name,{[name '.outbin']});
    45 structure=parseresultsfromdisk([name '.outbin'],0);
     45structure=parseresultsfromdisk(md,[name '.outbin'],0);
    4646delete([name '.outlog']);
    4747delete([name '.errlog']);
     
    5353
    5454%Process results
    55 B=structure.(EnumToString(0));
     55B=structure.predictions;
    5656B=reshape(B,size(x_interp,2),size(x_interp,1))';
    57 E=structure.(EnumToString(1));
     57E=structure.error;
    5858E=reshape(E,size(x_interp,2),size(x_interp,1))';
Note: See TracChangeset for help on using the changeset viewer.