[21337] | 1 | Index: ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h (revision 21067)
|
---|
| 4 | +++ ../trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h (revision 21068)
|
---|
| 5 | @@ -79,16 +79,13 @@
|
---|
| 6 | value = NULL;
|
---|
| 7 | } /*}}}*/
|
---|
| 8 | GenericExternalResult(int in_id, int in_enum_type,ResultType in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
|
---|
| 9 | - id = 0;
|
---|
| 10 | - result_name = NULL;
|
---|
| 11 | - M = 0;
|
---|
| 12 | - N = 0;
|
---|
| 13 | - step = 0;
|
---|
| 14 | - time = 0;
|
---|
| 15 | - value = in_values;
|
---|
| 16 | _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");
|
---|
| 17 | }
|
---|
| 18 | /*}}}*/
|
---|
| 19 | + GenericExternalResult(int in_id,const char* name_in,ResultType in_values, int in_M,int in_N,int in_step,IssmDouble in_time){/*{{{*/
|
---|
| 20 | + _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");
|
---|
| 21 | + }
|
---|
| 22 | + /*}}}*/
|
---|
| 23 | GenericExternalResult(int in_id, int in_enum_type,ResultType in_value,int in_step, IssmDouble in_time){ /*{{{*/
|
---|
| 24 | id = in_id;
|
---|
| 25 | value = in_value;
|
---|
| 26 | @@ -356,6 +353,27 @@
|
---|
| 27 | else value=NULL;
|
---|
| 28 | }
|
---|
| 29 | /*}}}*/
|
---|
| 30 | +template <> 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){/*{{{*/
|
---|
| 31 | +
|
---|
| 32 | + id = in_id;
|
---|
| 33 | + M = in_M;
|
---|
| 34 | + N = in_N;
|
---|
| 35 | +
|
---|
| 36 | + /*Copy name*/
|
---|
| 37 | + this->result_name = xNew<char>(strlen(in_result_name)+1);
|
---|
| 38 | + xMemCpy<char>(this->result_name,in_result_name,strlen(in_result_name)+1);
|
---|
| 39 | +
|
---|
| 40 | + step = in_step;
|
---|
| 41 | + time = in_time;
|
---|
| 42 | +
|
---|
| 43 | + /*Copy result in values*/
|
---|
| 44 | + if(M*N){
|
---|
| 45 | + value=xNew<IssmPDouble>(M*N);
|
---|
| 46 | + xMemCpy<IssmPDouble>(value,in_values,M*N);
|
---|
| 47 | + }
|
---|
| 48 | + else value=NULL;
|
---|
| 49 | +}
|
---|
| 50 | +/*}}}*/
|
---|
| 51 | template <> inline GenericExternalResult<IssmPDouble*>::GenericExternalResult(int in_id, int in_enum_type,IssmPDouble* in_value,int in_step, IssmDouble in_time){ /*{{{*/
|
---|
| 52 | _error_("you cannot initialize a GenericExternalResult<IssmPDouble*> without providing the dimensions of the matrix! Please use a more appropriate constructor!");
|
---|
| 53 | } /*}}}*/
|
---|
| 54 | Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
|
---|
| 55 | ===================================================================
|
---|
| 56 | --- ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 21067)
|
---|
| 57 | +++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp (revision 21068)
|
---|
| 58 | @@ -1832,7 +1832,7 @@
|
---|
| 59 | iomodel->FindConstant(&cost_functions,&num_cost_functions,"md.inversion.cost_functions");
|
---|
| 60 | if(num_cost_functions<1) _error_("No cost functions found");
|
---|
| 61 | cost_functions_enums=xNew<int>(num_cost_functions);
|
---|
| 62 | - for(int j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
|
---|
| 63 | + for(j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
|
---|
| 64 |
|
---|
| 65 | /*Create inputs and add to DataSetInput*/
|
---|
| 66 | DatasetInput* datasetinput=new DatasetInput(InversionCostFunctionsCoefficientsEnum);
|
---|
| 67 | Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
|
---|
| 68 | ===================================================================
|
---|
| 69 | --- ../trunk-jpl/src/c/classes/Elements/Penta.cpp (revision 21067)
|
---|
| 70 | +++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp (revision 21068)
|
---|
| 71 | @@ -1497,7 +1497,7 @@
|
---|
| 72 | iomodel->FindConstant(&cost_functions,&num_cost_functions,"md.inversion.cost_functions");
|
---|
| 73 | if(num_cost_functions<1) _error_("No cost functions found");
|
---|
| 74 | cost_functions_enums=xNew<int>(num_cost_functions);
|
---|
| 75 | - for(int j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
|
---|
| 76 | + for(j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
|
---|
| 77 |
|
---|
| 78 | /*Create inputs and add to DataSetInput*/
|
---|
| 79 | DatasetInput* datasetinput=new DatasetInput(InversionCostFunctionsCoefficientsEnum);
|
---|
| 80 | Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
|
---|
| 81 | ===================================================================
|
---|
| 82 | --- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp (revision 21067)
|
---|
| 83 | +++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp (revision 21068)
|
---|
| 84 | @@ -461,7 +461,7 @@
|
---|
| 85 | iomodel->FindConstant(&cost_functions,&num_cost_functions,"md.inversion.cost_functions");
|
---|
| 86 | if(num_cost_functions<1) _error_("No cost functions found");
|
---|
| 87 | cost_functions_enums=xNew<int>(num_cost_functions);
|
---|
| 88 | - for(int j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
|
---|
| 89 | + for(j=0;j<num_cost_functions;j++){ cost_functions_enums[j]=StringToEnumx(cost_functions[j]); }
|
---|
| 90 |
|
---|
| 91 | /*Create inputs and add to DataSetInput*/
|
---|
| 92 | DatasetInput* datasetinput=new DatasetInput(InversionCostFunctionsCoefficientsEnum);
|
---|
| 93 | Index: ../trunk-jpl/src/c/main/kriging.cpp
|
---|
| 94 | ===================================================================
|
---|
| 95 | --- ../trunk-jpl/src/c/main/kriging.cpp (revision 21067)
|
---|
| 96 | +++ ../trunk-jpl/src/c/main/kriging.cpp (revision 21068)
|
---|
| 97 | @@ -54,8 +54,8 @@
|
---|
| 98 | Results *results = new Results();
|
---|
| 99 | if(IssmComm::GetRank()==0){
|
---|
| 100 | output_fid=pfopen0(outbinfilename,"wb");
|
---|
| 101 | - results->AddObject(new GenericExternalResult<double*>(results->Size()+1,0,predictions,ninterp,1,1,0));
|
---|
| 102 | - results->AddObject(new GenericExternalResult<double*>(results->Size()+1,1,error,ninterp,1,1,0));
|
---|
| 103 | + results->AddObject(new GenericExternalResult<double*>(results->Size()+1,"predictions",predictions,ninterp,1,1,0));
|
---|
| 104 | + results->AddObject(new GenericExternalResult<double*>(results->Size()+1,"error",error,ninterp,1,1,0));
|
---|
| 105 | for(int i=0;i<results->Size();i++){
|
---|
| 106 | ExternalResult* result=xDynamicCast<ExternalResult*>(results->GetObjectByOffset(i));
|
---|
| 107 | result->WriteData(output_fid,1);
|
---|
| 108 | Index: ../trunk-jpl/src/m/contrib/morlighem/gslib/pkriging.m
|
---|
| 109 | ===================================================================
|
---|
| 110 | --- ../trunk-jpl/src/m/contrib/morlighem/gslib/pkriging.m (revision 21067)
|
---|
| 111 | +++ ../trunk-jpl/src/m/contrib/morlighem/gslib/pkriging.m (revision 21068)
|
---|
| 112 | @@ -42,7 +42,7 @@
|
---|
| 113 | %Download
|
---|
| 114 | end
|
---|
| 115 | Download(cluster,name,{[name '.outbin']});
|
---|
| 116 | -structure=parseresultsfromdisk([name '.outbin'],0);
|
---|
| 117 | +structure=parseresultsfromdisk(md,[name '.outbin'],0);
|
---|
| 118 | delete([name '.outlog']);
|
---|
| 119 | delete([name '.errlog']);
|
---|
| 120 | delete([name '.outbin']);
|
---|
| 121 | @@ -52,7 +52,7 @@
|
---|
| 122 | end
|
---|
| 123 |
|
---|
| 124 | %Process results
|
---|
| 125 | -B=structure.(EnumToString(0));
|
---|
| 126 | +B=structure.predictions;
|
---|
| 127 | B=reshape(B,size(x_interp,2),size(x_interp,1))';
|
---|
| 128 | -E=structure.(EnumToString(1));
|
---|
| 129 | +E=structure.error;
|
---|
| 130 | E=reshape(E,size(x_interp,2),size(x_interp,1))';
|
---|