[12325] | 1 | Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/modules.h
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/modules.h (revision 12163)
|
---|
| 4 | +++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/modules.h (revision 12164)
|
---|
| 5 | @@ -61,6 +61,7 @@
|
---|
| 6 | #include "./Ll2xyx/Ll2xyx.h"
|
---|
| 7 | #include "./Exp2Kmlx/Exp2Kmlx.h"
|
---|
| 8 | #include "./Kml2Expx/Kml2Expx.h"
|
---|
| 9 | +#include "./Krigingx/Krigingx.h"
|
---|
| 10 | #include "./Shp2Kmlx/Shp2Kmlx.h"
|
---|
| 11 | #include "./MassFluxx/MassFluxx.h"
|
---|
| 12 | #include "./MaxAbsVxx/MaxAbsVxx.h"
|
---|
| 13 | Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp
|
---|
| 14 | ===================================================================
|
---|
| 15 | --- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp (revision 0)
|
---|
| 16 | +++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp (revision 12164)
|
---|
| 17 | @@ -0,0 +1,22 @@
|
---|
| 18 | +/*!\file: Kriging.cpp
|
---|
| 19 | + * \brief "c" core code for Kriging
|
---|
| 20 | + */
|
---|
| 21 | +
|
---|
| 22 | +#include "./Krigingx.h"
|
---|
| 23 | +#include "../../shared/shared.h"
|
---|
| 24 | +#include "../../include/include.h"
|
---|
| 25 | +#include "../../toolkits/toolkits.h"
|
---|
| 26 | +#include "../../objects/objects.h"
|
---|
| 27 | +#include "../modules.h"
|
---|
| 28 | +
|
---|
| 29 | +int Krigingx(double** ppredictions,double* x, double* y, double* observations, int n_obs,double* x_interp,double* y_interp,int n_interp){
|
---|
| 30 | +
|
---|
| 31 | + /*output*/
|
---|
| 32 | + double *predictions = NULL;
|
---|
| 33 | +
|
---|
| 34 | + /*Allocate output*/
|
---|
| 35 | + predictions=(double*)xmalloc(n_interp*sizeof(double));
|
---|
| 36 | +
|
---|
| 37 | + /*Assign output pointer*/
|
---|
| 38 | + *ppredictions=predictions;
|
---|
| 39 | +}
|
---|
| 40 | Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/Krigingx/Krigingx.h
|
---|
| 41 | ===================================================================
|
---|
| 42 | --- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/Krigingx/Krigingx.h (revision 0)
|
---|
| 43 | +++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/modules/Krigingx/Krigingx.h (revision 12164)
|
---|
| 44 | @@ -0,0 +1,15 @@
|
---|
| 45 | +/*!\file Kriging.h
|
---|
| 46 | + * \brief: header file for Kriging
|
---|
| 47 | + */
|
---|
| 48 | +
|
---|
| 49 | +#ifndef _KRIGINGX_H
|
---|
| 50 | +#define _KRIGINGX_H
|
---|
| 51 | +
|
---|
| 52 | +#include "../../objects/objects.h"
|
---|
| 53 | +#include "../../toolkits/toolkits.h"
|
---|
| 54 | +
|
---|
| 55 | +
|
---|
| 56 | +int Krigingx(double** ppredictions,double* x, double* y, double* observations, int n_obs,double* x_interp,double* y_interp,int n_interp);
|
---|
| 57 | +
|
---|
| 58 | +#endif /* _KRIGINGX_H */
|
---|
| 59 | +
|
---|
| 60 | Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/Makefile.am
|
---|
| 61 | ===================================================================
|
---|
| 62 | --- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/Makefile.am (revision 12163)
|
---|
| 63 | +++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/Makefile.am (revision 12164)
|
---|
| 64 | @@ -819,6 +819,8 @@
|
---|
| 65 | ./modules/InterpFromMeshToGridx/InterpFromMeshToGridx.h\
|
---|
| 66 | ./modules/HoleFillerx/HoleFillerx.cpp\
|
---|
| 67 | ./modules/HoleFillerx/HoleFillerx.h\
|
---|
| 68 | + ./modules/Krigingx/Krigingx.cpp\
|
---|
| 69 | + ./modules/Krigingx/Krigingx.h\
|
---|
| 70 | ./modules/AverageFilterx/AverageFilterx.cpp\
|
---|
| 71 | ./modules/AverageFilterx/AverageFilterx.h\
|
---|
| 72 | ./modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp\
|
---|
| 73 | Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/Kriging/Kriging.h
|
---|
| 74 | ===================================================================
|
---|
| 75 | --- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/Kriging/Kriging.h (revision 0)
|
---|
| 76 | +++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/Kriging/Kriging.h (revision 12164)
|
---|
| 77 | @@ -0,0 +1,35 @@
|
---|
| 78 | +/*
|
---|
| 79 | + KrigingUsage.h
|
---|
| 80 | +*/
|
---|
| 81 | +
|
---|
| 82 | +#ifndef _KRIGING_H_
|
---|
| 83 | +#define _KRIGING_H_
|
---|
| 84 | +
|
---|
| 85 | +/* local prototypes: */
|
---|
| 86 | +void KrigingUsage(void);
|
---|
| 87 | +
|
---|
| 88 | +#include "../../c/include/globals.h"
|
---|
| 89 | +#include "../../c/modules/modules.h"
|
---|
| 90 | +#include "../../c/shared/shared.h"
|
---|
| 91 | +#include "../../c/issm-binding.h"
|
---|
| 92 | +
|
---|
| 93 | +#undef __FUNCT__
|
---|
| 94 | +#define __FUNCT__ "Kriging"
|
---|
| 95 | +
|
---|
| 96 | +/* serial input macros: */
|
---|
| 97 | +#define X (mxArray *)prhs[0]
|
---|
| 98 | +#define Y (mxArray *)prhs[1]
|
---|
| 99 | +#define OBSERVATIONS (mxArray *)prhs[2]
|
---|
| 100 | +#define XINTERP (mxArray *)prhs[3]
|
---|
| 101 | +#define YINTERP (mxArray *)prhs[4]
|
---|
| 102 | +
|
---|
| 103 | +/* serial output macros: */
|
---|
| 104 | +#define PREDICTIONS (mxArray**)&plhs[0]
|
---|
| 105 | +
|
---|
| 106 | +/* serial arg counts: */
|
---|
| 107 | +#undef NLHS
|
---|
| 108 | +#define NLHS 1
|
---|
| 109 | +#undef NRHS
|
---|
| 110 | +#define NRHS 5
|
---|
| 111 | +
|
---|
| 112 | +#endif /* _KRIGING_H_ */
|
---|
| 113 | Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/Kriging/Kriging.cpp
|
---|
| 114 | ===================================================================
|
---|
| 115 | --- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/Kriging/Kriging.cpp (revision 0)
|
---|
| 116 | +++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/Kriging/Kriging.cpp (revision 12164)
|
---|
| 117 | @@ -0,0 +1,52 @@
|
---|
| 118 | +/*\file Kriging.c
|
---|
| 119 | + *\brief: best linear predictor
|
---|
| 120 | + */
|
---|
| 121 | +#include "./Kriging.h"
|
---|
| 122 | +
|
---|
| 123 | +void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
|
---|
| 124 | +
|
---|
| 125 | + /*Outputs*/
|
---|
| 126 | + double *x = NULL;
|
---|
| 127 | + double *y = NULL;
|
---|
| 128 | + double *observations = NULL;
|
---|
| 129 | + double *x_interp = NULL;
|
---|
| 130 | + double *y_interp = NULL;
|
---|
| 131 | + double *predictions = NULL;
|
---|
| 132 | + int n_interp,n,n_obs;
|
---|
| 133 | +
|
---|
| 134 | + /*Boot module: */
|
---|
| 135 | + MODULEBOOT();
|
---|
| 136 | +
|
---|
| 137 | + /*checks on arguments on the matlab side: */
|
---|
| 138 | + CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&KrigingUsage);
|
---|
| 139 | +
|
---|
| 140 | + /*Fetch inputs: */
|
---|
| 141 | + FetchData(&x,&n_obs,X);
|
---|
| 142 | + FetchData(&y,&n,Y); if(n_obs!=n) _error_("x and y should have the same size");
|
---|
| 143 | + FetchData(&observations,&n,OBSERVATIONS); if(n_obs!=n) _error_("x and observations should have the same size");
|
---|
| 144 | + FetchData(&x_interp,&n_interp,XINTERP);
|
---|
| 145 | + FetchData(&y_interp,&n,YINTERP); if(n_interp!=n) _error_("x_interp and y_interp should have the same size");
|
---|
| 146 | +
|
---|
| 147 | + /*Call x layer*/
|
---|
| 148 | + Krigingx(&predictions,x,y,observations,n_obs,x_interp,y_interp,n_interp);
|
---|
| 149 | +
|
---|
| 150 | + /*Generate output Matlab Structures*/
|
---|
| 151 | + WriteData(PREDICTIONS,predictions,n_interp);
|
---|
| 152 | +
|
---|
| 153 | + /*Free ressources: */
|
---|
| 154 | + xfree((void**)&x);
|
---|
| 155 | + xfree((void**)&y);
|
---|
| 156 | + xfree((void**)&observations);
|
---|
| 157 | + xfree((void**)&x_interp);
|
---|
| 158 | + xfree((void**)&y_interp);
|
---|
| 159 | + xfree((void**)&predictions);
|
---|
| 160 | +
|
---|
| 161 | + /*end module: */
|
---|
| 162 | + MODULEEND();
|
---|
| 163 | +}
|
---|
| 164 | +
|
---|
| 165 | +void KrigingUsage(void){
|
---|
| 166 | + _printf_(true,"\n");
|
---|
| 167 | + _printf_(true," usage: predictions=%s(x,y,observations,x_interp,y_interp);\n",__FUNCT__);
|
---|
| 168 | + _printf_(true,"\n");
|
---|
| 169 | +}
|
---|
| 170 | Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/matlab/Makefile.am
|
---|
| 171 | ===================================================================
|
---|
| 172 | --- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/matlab/Makefile.am (revision 12163)
|
---|
| 173 | +++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/modules/matlab/Makefile.am (revision 12164)
|
---|
| 174 | @@ -23,6 +23,7 @@
|
---|
| 175 | KMLMeshWrite \
|
---|
| 176 | KMLOverlay \
|
---|
| 177 | Kml2Exp \
|
---|
| 178 | + Kriging \
|
---|
| 179 | Ll2xy \
|
---|
| 180 | NodeConnectivity \
|
---|
| 181 | MeshPartition\
|
---|
| 182 | @@ -127,6 +128,9 @@
|
---|
| 183 | Kml2Exp_SOURCES = ../Kml2Exp/Kml2Exp.cpp\
|
---|
| 184 | ../Kml2Exp/Kml2Exp.h
|
---|
| 185 |
|
---|
| 186 | +Kriging_SOURCES = ../Kriging/Kriging.cpp\
|
---|
| 187 | + ../Kriging/Kriging.h
|
---|
| 188 | +
|
---|
| 189 | MeshPartition_SOURCES = ../MeshPartition/MeshPartition.cpp\
|
---|
| 190 | ../MeshPartition/MeshPartition.h
|
---|
| 191 |
|
---|