Changeset 12466
- Timestamp:
- 06/19/12 15:22:27 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/Container
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/Container.h
r12410 r12466 6 6 #define _CONTAINER_CONTAINER_H_ 7 7 8 #include "../include/include.h" 8 9 #include "./DataSet.h" 9 10 #include "./Constraints.h" -
issm/trunk-jpl/src/c/Container/DataSet.cpp
r12459 r12466 60 60 if(sorted_ids){ 61 61 copy->sorted_ids=xNew<int>(objects.size()); 62 memcpy(copy->sorted_ids,sorted_ids,objects.size()*sizeof(int));62 xMemCpy<int>(copy->sorted_ids,sorted_ids,objects.size()); 63 63 } 64 64 if(id_offsets){ 65 65 copy->id_offsets=xNew<int>(objects.size()); 66 memcpy(copy->id_offsets,id_offsets,objects.size()*sizeof(int));66 xMemCpy<int>(copy->id_offsets,id_offsets,objects.size()); 67 67 } 68 68 -
issm/trunk-jpl/src/c/Container/Elements.cpp
r12459 r12466 173 173 int *resultssizes = NULL; 174 174 int *resultssteps = NULL; 175 double *resultstimes = NULL;176 double *vector_serial= NULL;175 IssmDouble *resultstimes = NULL; 176 IssmDouble *vector_serial= NULL; 177 177 Vector* vector = NULL; 178 178 bool io_gather; … … 217 217 resultsenums=xNew<int>(numberofresults); 218 218 resultssizes=xNew<int>(numberofresults); 219 resultstimes=xNew< double>(numberofresults);219 resultstimes=xNew<IssmDouble>(numberofresults); 220 220 resultssteps=xNew<int>(numberofresults); 221 221 } … … 250 250 /*clean up*/ 251 251 xdelete(&vector); 252 xDelete< double>(vector_serial);252 xDelete<IssmDouble>(vector_serial); 253 253 } 254 254 } … … 272 272 xDelete<int>(resultssizes); 273 273 xDelete<int>(resultssteps); 274 xDelete< double>(resultstimes);274 xDelete<IssmDouble>(resultstimes); 275 275 delete patch; 276 276 } -
issm/trunk-jpl/src/c/Container/Inputs.cpp
r12365 r12466 93 93 } 94 94 /*}}}*/ 95 /*FUNCTION Inputs::GetInputValue( double* pvalue,int enum-type){{{*/96 void Inputs::GetInputValue( double* pvalue,int enum_type){95 /*FUNCTION Inputs::GetInputValue(IssmDouble* pvalue,int enum-type){{{*/ 96 void Inputs::GetInputValue(IssmDouble* pvalue,int enum_type){ 97 97 98 98 vector<Object*>::iterator object; … … 122 122 /*}}}*/ 123 123 /*FUNCTION Inputs::GetInputAverage{{{*/ 124 void Inputs::GetInputAverage( double* pvalue,int enum_type){124 void Inputs::GetInputAverage(IssmDouble* pvalue,int enum_type){ 125 125 126 126 vector<Object*>::iterator object; … … 206 206 /*}}}*/ 207 207 /*FUNCTION Inputs::ConstrainMin{{{*/ 208 void Inputs::ConstrainMin(int constrain_enum, double minimum){208 void Inputs::ConstrainMin(int constrain_enum, IssmDouble minimum){ 209 209 210 210 Input* constrain_input=NULL; … … 220 220 /*}}}*/ 221 221 /*FUNCTION Inputs::InfinityNorm{{{*/ 222 double Inputs::InfinityNorm(int enumtype){223 224 /*Output*/ 225 double norm;222 IssmDouble Inputs::InfinityNorm(int enumtype){ 223 224 /*Output*/ 225 IssmDouble norm; 226 226 227 227 /*Get input*/ … … 241 241 /*}}}*/ 242 242 /*FUNCTION Inputs::Max{{{*/ 243 double Inputs::Max(int enumtype){244 245 /*Output*/ 246 double max;243 IssmDouble Inputs::Max(int enumtype){ 244 245 /*Output*/ 246 IssmDouble max; 247 247 248 248 /*Get input*/ … … 262 262 /*}}}*/ 263 263 /*FUNCTION Inputs::MaxAbs{{{*/ 264 double Inputs::MaxAbs(int enumtype){265 266 /*Output*/ 267 double max;264 IssmDouble Inputs::MaxAbs(int enumtype){ 265 266 /*Output*/ 267 IssmDouble max; 268 268 269 269 /*Get input*/ … … 283 283 /*}}}*/ 284 284 /*FUNCTION Inputs::Min{{{*/ 285 double Inputs::Min(int enumtype){286 287 /*Output*/ 288 double min;285 IssmDouble Inputs::Min(int enumtype){ 286 287 /*Output*/ 288 IssmDouble min; 289 289 290 290 /*Get input*/ … … 304 304 /*}}}*/ 305 305 /*FUNCTION Inputs::MinAbs{{{*/ 306 double Inputs::MinAbs(int enumtype){307 308 /*Output*/ 309 double min;306 IssmDouble Inputs::MinAbs(int enumtype){ 307 308 /*Output*/ 309 IssmDouble min; 310 310 311 311 /*Get input*/ … … 406 406 /*}}}*/ 407 407 /*FUNCTION Inputs::AXPY{{{*/ 408 void Inputs::AXPY(int MeshYEnum, double scalar, int MeshXEnum){408 void Inputs::AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum){ 409 409 410 410 Input* xinput=NULL; -
issm/trunk-jpl/src/c/Container/Inputs.h
r12365 r12466 31 31 int AddInput(Input* in_input); 32 32 void ChangeEnum(int enumtype,int new_enumtype); 33 void ConstrainMin(int constrain_enum, double minimum);33 void ConstrainMin(int constrain_enum, IssmDouble minimum); 34 34 int DeleteInput(int enum_type); 35 35 void DuplicateInput(int original_enum,int new_enum); 36 36 Input* GetInput(int enum_name); 37 37 Inputs* SpawnTriaInputs(int* indices); 38 void AXPY(int MeshYEnum, double scalar, int MeshXEnum);39 double InfinityNorm(int enumtype);40 double Max(int enumtype);41 double MaxAbs(int enumtype);42 double Min(int enumtype);43 double MinAbs(int enumtype);38 void AXPY(int MeshYEnum, IssmDouble scalar, int MeshXEnum); 39 IssmDouble InfinityNorm(int enumtype); 40 IssmDouble Max(int enumtype); 41 IssmDouble MaxAbs(int enumtype); 42 IssmDouble Min(int enumtype); 43 IssmDouble MinAbs(int enumtype); 44 44 45 void GetInputAverage( double* pvalue, int enum_type);45 void GetInputAverage(IssmDouble* pvalue, int enum_type); 46 46 void GetInputValue(bool* pvalue,int enum_type); 47 47 void GetInputValue(int* pvalue,int enum_type); 48 void GetInputValue( double* pvalue,int enum_type);48 void GetInputValue(IssmDouble* pvalue,int enum_type); 49 49 50 50 void Configure(Parameters* parameters); -
issm/trunk-jpl/src/c/Container/Observations.cpp
r12459 r12466 34 34 } 35 35 /*}}}*/ 36 /*FUNCTION Observations::Observations( double* observations_list,double* x,double* y,int n,Options* options){{{*/37 Observations::Observations( double* observations_list,double* x,double* y,int n,Options* options){36 /*FUNCTION Observations::Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options){{{*/ 37 Observations::Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options){ 38 38 39 39 /*Intermediaries*/ 40 40 int i,j,maxdepth,level,counter,index; 41 41 int xi,yi; 42 double xmin,xmax,ymin,ymax;43 double offset,minlength,minspacing,mintrimming,maxtrimming;42 IssmDouble xmin,xmax,ymin,ymax; 43 IssmDouble offset,minlength,minspacing,mintrimming,maxtrimming; 44 44 int *indices = NULL; 45 45 Observation *observation = NULL; … … 69 69 else{ 70 70 maxdepth = 30; 71 minlength=max(xmax-xmin,ymax-ymin)/ double((1L<<maxdepth)-1);71 minlength=max(xmax-xmin,ymax-ymin)/IssmDouble((1L<<maxdepth)-1); 72 72 } 73 73 … … 117 117 /*Methods*/ 118 118 /*FUNCTION Observations::ClosestObservation{{{*/ 119 void Observations::ClosestObservation( double *px,double *py,double *pobs,double x_interp,double y_interp,double radius){119 void Observations::ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius){ 120 120 121 121 /*Output and Intermediaries*/ 122 122 bool stop; 123 123 int nobs,i,index; 124 double h2,hmin2,radius2;124 IssmDouble h2,hmin2,radius2; 125 125 int *indices = NULL; 126 126 Observation *observation = NULL; … … 165 165 166 166 }/*}}}*/ 167 /*FUNCTION Observations::ObservationList( double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double radius,int maxdata){{{*/168 void Observations::ObservationList( double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double radius,int maxdata){167 /*FUNCTION Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata){{{*/ 168 void Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata){ 169 169 170 170 /*Output and Intermediaries*/ 171 171 bool stop; 172 172 int nobs,tempnobs,i,j,k,n,counter; 173 double h2,radius2;173 IssmDouble h2,radius2; 174 174 int *indices = NULL; 175 175 int *tempindices = NULL; 176 double *dists = NULL;177 double *x = NULL;178 double *y = NULL;179 double *obs = NULL;176 IssmDouble *dists = NULL; 177 IssmDouble *x = NULL; 178 IssmDouble *y = NULL; 179 IssmDouble *obs = NULL; 180 180 Observation *observation = NULL; 181 181 … … 190 190 if(tempnobs){ 191 191 indices = xNew<int>(tempnobs); 192 dists = xNew< double>(tempnobs);192 dists = xNew<IssmDouble>(tempnobs); 193 193 } 194 194 nobs = 0; … … 225 225 } 226 226 } 227 xDelete< double>(dists);227 xDelete<IssmDouble>(dists); 228 228 xDelete<int>(tempindices); 229 229 230 230 if(nobs){ 231 231 /*Allocate vectors*/ 232 x = xNew< double>(nobs);233 y = xNew< double>(nobs);234 obs = xNew< double>(nobs);232 x = xNew<IssmDouble>(nobs); 233 y = xNew<IssmDouble>(nobs); 234 obs = xNew<IssmDouble>(nobs); 235 235 236 236 /*Loop over all observations and fill in x, y and obs*/ … … 248 248 *pnobs=nobs; 249 249 }/*}}}*/ 250 /*FUNCTION Observations::ObservationList( double **px,double **py,double **pobs,int* pnobs){{{*/251 void Observations::ObservationList( double **px,double **py,double **pobs,int* pnobs){250 /*FUNCTION Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs){{{*/ 251 void Observations::ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs){ 252 252 253 253 /*Output and Intermediaries*/ 254 254 int nobs; 255 double *x = NULL;256 double *y = NULL;257 double *obs = NULL;255 IssmDouble *x = NULL; 256 IssmDouble *y = NULL; 257 IssmDouble *obs = NULL; 258 258 Observation *observation = NULL; 259 259 … … 261 261 262 262 if(nobs){ 263 x = xNew< double>(nobs);264 y = xNew< double>(nobs);265 obs = xNew< double>(nobs);263 x = xNew<IssmDouble>(nobs); 264 y = xNew<IssmDouble>(nobs); 265 obs = xNew<IssmDouble>(nobs); 266 266 for(int i=0;i<this->Size();i++){ 267 267 observation=(Observation*)this->GetObjectByOffset(i); … … 277 277 }/*}}}*/ 278 278 /*FUNCTION Observations::InterpolationIDW{{{*/ 279 void Observations::InterpolationIDW( double *pprediction,double x_interp,double y_interp,double radius,int mindata,int maxdata,double power){279 void Observations::InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power){ 280 280 281 281 /*Intermediaries*/ 282 282 int i,n_obs; 283 double prediction;284 double numerator,denominator,h,weight;285 double *x = NULL;286 double *y = NULL;287 double *obs = NULL;283 IssmDouble prediction; 284 IssmDouble numerator,denominator,h,weight; 285 IssmDouble *x = NULL; 286 IssmDouble *y = NULL; 287 IssmDouble *obs = NULL; 288 288 289 289 /*Some checks*/ … … 321 321 /*clean-up*/ 322 322 *pprediction = prediction; 323 xDelete< double>(x);324 xDelete< double>(y);325 xDelete< double>(obs);323 xDelete<IssmDouble>(x); 324 xDelete<IssmDouble>(y); 325 xDelete<IssmDouble>(obs); 326 326 }/*}}}*/ 327 327 /*FUNCTION Observations::InterpolationKriging{{{*/ 328 void Observations::InterpolationKriging( double *pprediction,double *perror,double x_interp,double y_interp,double radius,int mindata,int maxdata,Variogram* variogram){328 void Observations::InterpolationKriging(IssmDouble *pprediction,IssmDouble *perror,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,Variogram* variogram){ 329 329 330 330 /*Intermediaries*/ 331 331 int i,j,n_obs; 332 double prediction,error;333 double numerator,denominator,ratio;334 double *x = NULL;335 double *y = NULL;336 double *obs = NULL;337 double *Gamma = NULL;338 double *GinvG0 = NULL;339 double *Ginv1 = NULL;340 double *GinvZ = NULL;341 double *gamma0 = NULL;342 double *ones = NULL;332 IssmDouble prediction,error; 333 IssmDouble numerator,denominator,ratio; 334 IssmDouble *x = NULL; 335 IssmDouble *y = NULL; 336 IssmDouble *obs = NULL; 337 IssmDouble *Gamma = NULL; 338 IssmDouble *GinvG0 = NULL; 339 IssmDouble *Ginv1 = NULL; 340 IssmDouble *GinvZ = NULL; 341 IssmDouble *gamma0 = NULL; 342 IssmDouble *ones = NULL; 343 343 344 344 /*Some checks*/ … … 360 360 361 361 /*Allocate intermediary matrix and vectors*/ 362 Gamma = xNew< double>(n_obs*n_obs);363 gamma0 = xNew< double>(n_obs);364 ones = xNew< double>(n_obs);362 Gamma = xNew<IssmDouble>(n_obs*n_obs); 363 gamma0 = xNew<IssmDouble>(n_obs); 364 ones = xNew<IssmDouble>(n_obs); 365 365 366 366 /*First: Create semivariogram matrix for observations*/ … … 401 401 *pprediction = prediction; 402 402 *perror = error; 403 xDelete< double>(x);404 xDelete< double>(y);405 xDelete< double>(obs);406 xDelete< double>(Gamma);407 xDelete< double>(gamma0);408 xDelete< double>(ones);409 xDelete< double>(GinvG0);410 xDelete< double>(Ginv1);411 xDelete< double>(GinvZ);403 xDelete<IssmDouble>(x); 404 xDelete<IssmDouble>(y); 405 xDelete<IssmDouble>(obs); 406 xDelete<IssmDouble>(Gamma); 407 xDelete<IssmDouble>(gamma0); 408 xDelete<IssmDouble>(ones); 409 xDelete<IssmDouble>(GinvG0); 410 xDelete<IssmDouble>(Ginv1); 411 xDelete<IssmDouble>(GinvZ); 412 412 413 413 }/*}}}*/ 414 414 /*FUNCTION Observations::InterpolationNearestNeighbor{{{*/ 415 void Observations::InterpolationNearestNeighbor( double *pprediction,double x_interp,double y_interp,double radius){415 void Observations::InterpolationNearestNeighbor(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius){ 416 416 417 417 /*Intermediaries*/ 418 double x,y,obs;418 IssmDouble x,y,obs; 419 419 420 420 /*Get clostest observation*/ … … 425 425 }/*}}}*/ 426 426 /*FUNCTION Observations::QuadtreeColoring{{{*/ 427 void Observations::QuadtreeColoring( double* A,double *x,double *y,int n){427 void Observations::QuadtreeColoring(IssmDouble* A,IssmDouble *x,IssmDouble *y,int n){ 428 428 429 429 int xi,yi,level; … … 432 432 this->quadtree->IntergerCoordinates(&xi,&yi,x[i],y[i]); 433 433 this->quadtree->QuadtreeDepth(&level,xi,yi); 434 A[i]=( double)level;434 A[i]=(IssmDouble)level; 435 435 } 436 436 437 437 }/*}}}*/ 438 438 /*FUNCTION Observations::Variomap{{{*/ 439 void Observations::Variomap( double* gamma,double *x,int n){439 void Observations::Variomap(IssmDouble* gamma,IssmDouble *x,int n){ 440 440 441 441 /*Output and Intermediaries*/ 442 442 int i,j,k; 443 double distance;443 IssmDouble distance; 444 444 Observation *observation1 = NULL; 445 445 Observation *observation2 = NULL; 446 446 447 double *counter = xNew<double>(n);447 IssmDouble *counter = xNew<IssmDouble>(n); 448 448 for(j=0;j<n;j++) counter[j] = 0.0; 449 449 for(j=0;j<n;j++) gamma[j] = 0.0; … … 474 474 475 475 /*Assign output pointer*/ 476 xDelete< double>(counter);477 }/*}}}*/ 476 xDelete<IssmDouble>(counter); 477 }/*}}}*/ -
issm/trunk-jpl/src/c/Container/Observations.h
r12422 r12466 20 20 /*constructors, destructors*/ 21 21 Observations(); 22 Observations( double* observations_list,double* x,double* y,int n,Options* options);22 Observations(IssmDouble* observations_list,IssmDouble* x,IssmDouble* y,int n,Options* options); 23 23 ~Observations(); 24 24 25 25 /*Methods*/ 26 void ClosestObservation( double *px,double *py,double *pobs,double x_interp,double y_interp,double radius);27 void InterpolationIDW( double *pprediction,double x_interp,double y_interp,double radius,int mindata,int maxdata,double power);28 void InterpolationKriging( double *pprediction,double *perror,double x_interp,double y_interp,double radius,int mindata,int maxdata,Variogram* variogram);29 void InterpolationNearestNeighbor( double *pprediction,double x_interp,double y_interp,double radius);30 void ObservationList( double **px,double **py,double **pobs,int* pnobs);31 void ObservationList( double **px,double **py,double **pobs,int* pnobs,double x_interp,double y_interp,double radius,int maxdata);32 void QuadtreeColoring( double* A,double *x,double *y,int n);33 void Variomap( double* gamma,double *x,int n);26 void ClosestObservation(IssmDouble *px,IssmDouble *py,IssmDouble *pobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius); 27 void InterpolationIDW(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,IssmDouble power); 28 void InterpolationKriging(IssmDouble *pprediction,IssmDouble *perror,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int mindata,int maxdata,Variogram* variogram); 29 void InterpolationNearestNeighbor(IssmDouble *pprediction,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius); 30 void ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs); 31 void ObservationList(IssmDouble **px,IssmDouble **py,IssmDouble **pobs,int* pnobs,IssmDouble x_interp,IssmDouble y_interp,IssmDouble radius,int maxdata); 32 void QuadtreeColoring(IssmDouble* A,IssmDouble *x,IssmDouble *y,int n); 33 void Variomap(IssmDouble* gamma,IssmDouble *x,int n); 34 34 35 35 }; -
issm/trunk-jpl/src/c/Container/Options.cpp
r12459 r12466 106 106 } 107 107 /*}}}*/ 108 /*FUNCTION Options::Get( double* pvalue, char* name){{{*/109 void Options::Get( double* pvalue,const char* name){110 111 vector<Object*>::iterator object; 112 Option* option=NULL; 113 114 /*Get option*/ 115 option=GetOption(name); 116 117 /*If the pointer is not NULL, the option has been found*/ 118 if(option){ 119 option->Get(pvalue); 120 } 121 /*Else, the Option does not exist, no default provided*/ 122 else{ 123 _error_("option of name \"%s\" not found, and no default value has been provided",name); 124 } 125 } 126 /*}}}*/ 127 /*FUNCTION Options::Get( double* pvalue, char* name,double default_value){{{*/128 void Options::Get( double* pvalue,const char* name,double default_value){108 /*FUNCTION Options::Get(IssmDouble* pvalue, char* name){{{*/ 109 void Options::Get(IssmDouble* pvalue,const char* name){ 110 111 vector<Object*>::iterator object; 112 Option* option=NULL; 113 114 /*Get option*/ 115 option=GetOption(name); 116 117 /*If the pointer is not NULL, the option has been found*/ 118 if(option){ 119 option->Get(pvalue); 120 } 121 /*Else, the Option does not exist, no default provided*/ 122 else{ 123 _error_("option of name \"%s\" not found, and no default value has been provided",name); 124 } 125 } 126 /*}}}*/ 127 /*FUNCTION Options::Get(IssmDouble* pvalue, char* name,IssmDouble default_value){{{*/ 128 void Options::Get(IssmDouble* pvalue,const char* name,IssmDouble default_value){ 129 129 130 130 vector<Object*>::iterator object; … … 223 223 stringsize=strlen(default_value)+1; 224 224 outstring=xNew<char>(stringsize); 225 memcpy(outstring,default_value,stringsize*sizeof(char));225 xMemCpy<char>(outstring,default_value,stringsize); 226 226 *pvalue=outstring; 227 227 } … … 275 275 } 276 276 /*}}}*/ 277 /*FUNCTION Options::Get( double** pvalue,int* numel,const char* name){{{*/278 void Options::Get( double** pvalue,int* numel,const char* name){277 /*FUNCTION Options::Get(IssmDouble** pvalue,int* numel,const char* name){{{*/ 278 void Options::Get(IssmDouble** pvalue,int* numel,const char* name){ 279 279 280 280 vector<Object*>::iterator object; -
issm/trunk-jpl/src/c/Container/Options.h
r12292 r12466 20 20 int AddOption(Option* in_oobject); 21 21 Option* GetOption(const char* name); 22 void Get( double* pvalue,const char* name);23 void Get( double* pvalue,const char* name,double default_value);22 void Get(IssmDouble* pvalue,const char* name); 23 void Get(IssmDouble* pvalue,const char* name,IssmDouble default_value); 24 24 void Get(int* pvalue,const char* name); 25 25 void Get(int* pvalue,const char* name,int default_value); … … 29 29 void Get(char** pvalue,const char* name,const char* default_value); 30 30 void Get(char*** pvalue,int* numel,const char* name); 31 void Get( double** pvalue,int* numel,const char* name);31 void Get(IssmDouble** pvalue,int* numel,const char* name); 32 32 }; 33 33 -
issm/trunk-jpl/src/c/Container/Parameters.cpp
r12365 r12466 85 85 } 86 86 /*}}}*/ 87 /*FUNCTION Parameters::FindParam( double* pscalar, int enum_type){{{*/88 void Parameters::FindParam( double* pscalar, int enum_type){ _assert_(this);87 /*FUNCTION Parameters::FindParam(IssmDouble* pscalar, int enum_type){{{*/ 88 void Parameters::FindParam(IssmDouble* pscalar, int enum_type){ _assert_(this); 89 89 90 90 vector<Object*>::iterator object; … … 174 174 } 175 175 /*}}}*/ 176 /*FUNCTION Parameters::FindParam( double** pdoublearray,int* pM,int enum_type){{{*/177 void Parameters::FindParam( double** pdoublearray,int* pM, int enum_type){ _assert_(this);178 179 vector<Object*>::iterator object; 180 Param* param=NULL; 181 182 for ( object=objects.begin() ; object < objects.end(); object++ ){ 183 184 param=(Param*)(*object); 185 if(param->InstanceEnum()==enum_type){ 186 param->GetParameterValue(p doublearray,pM);187 return; 188 } 189 } 190 _error_("could not find parameter %s",EnumToStringx(enum_type)); 191 192 } 193 /*}}}*/ 194 /*FUNCTION Parameters::FindParam( double** pdoublearray,int* pM, int* pN,int enum_type){{{*/195 void Parameters::FindParam( double** pdoublearray,int* pM, int* pN,int enum_type){ _assert_(this);196 197 vector<Object*>::iterator object; 198 Param* param=NULL; 199 200 for ( object=objects.begin() ; object < objects.end(); object++ ){ 201 202 param=(Param*)(*object); 203 if(param->InstanceEnum()==enum_type){ 204 param->GetParameterValue(p doublearray,pM,pN);205 return; 206 } 207 } 208 _error_("could not find parameter %s",EnumToStringx(enum_type)); 209 210 } 211 /*}}}*/ 212 /*FUNCTION Parameters::FindParam( double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{*/213 void Parameters::FindParam( double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this);176 /*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type){{{*/ 177 void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int enum_type){ _assert_(this); 178 179 vector<Object*>::iterator object; 180 Param* param=NULL; 181 182 for ( object=objects.begin() ; object < objects.end(); object++ ){ 183 184 param=(Param*)(*object); 185 if(param->InstanceEnum()==enum_type){ 186 param->GetParameterValue(pIssmDoublearray,pM); 187 return; 188 } 189 } 190 _error_("could not find parameter %s",EnumToStringx(enum_type)); 191 192 } 193 /*}}}*/ 194 /*FUNCTION Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){{{*/ 195 void Parameters::FindParam(IssmDouble** pIssmDoublearray,int* pM, int* pN,int enum_type){ _assert_(this); 196 197 vector<Object*>::iterator object; 198 Param* param=NULL; 199 200 for ( object=objects.begin() ; object < objects.end(); object++ ){ 201 202 param=(Param*)(*object); 203 if(param->InstanceEnum()==enum_type){ 204 param->GetParameterValue(pIssmDoublearray,pM,pN); 205 return; 206 } 207 } 208 _error_("could not find parameter %s",EnumToStringx(enum_type)); 209 210 } 211 /*}}}*/ 212 /*FUNCTION Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{*/ 213 void Parameters::FindParam(IssmDouble*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ _assert_(this); 214 214 215 215 vector<Object*>::iterator object; … … 305 305 } 306 306 /*}}}*/ 307 /*FUNCTION Parameters::SetParam( double scalar,int enum_type);{{{*/308 void Parameters::SetParam( double scalar,int enum_type){307 /*FUNCTION Parameters::SetParam(IssmDouble scalar,int enum_type);{{{*/ 308 void Parameters::SetParam(IssmDouble scalar,int enum_type){ 309 309 310 310 Param* param=NULL; … … 341 341 } 342 342 /*}}}*/ 343 /*FUNCTION Parameters::SetParam( double* doublearray,int M,int enum_type);{{{*/344 void Parameters::SetParam( double* doublearray,int M, int enum_type){345 346 Param* param=NULL; 347 348 /*first, figure out if the param has already been created: */ 349 param=(Param*)this->FindParamObject(enum_type); 350 351 if(param) param->SetValue( doublearray,M); //already exists, just set it.352 else this->AddObject(new DoubleVecParam(enum_type, doublearray,M)); //just add the new parameter.353 } 354 /*}}}*/ 355 /*FUNCTION Parameters::SetParam( double* doublearray,int M,int N, int enum_type);{{{*/356 void Parameters::SetParam( double* doublearray,int M, int N, int enum_type){357 358 Param* param=NULL; 359 360 /*first, figure out if the param has already been created: */ 361 param=(Param*)this->FindParamObject(enum_type); 362 363 if(param) param->SetValue( doublearray,M,N); //already exists, just set it.364 else this->AddObject(new DoubleMatParam(enum_type, doublearray,M,N)); //just add the new parameter.343 /*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int enum_type);{{{*/ 344 void Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int enum_type){ 345 346 Param* param=NULL; 347 348 /*first, figure out if the param has already been created: */ 349 param=(Param*)this->FindParamObject(enum_type); 350 351 if(param) param->SetValue(IssmDoublearray,M); //already exists, just set it. 352 else this->AddObject(new DoubleVecParam(enum_type,IssmDoublearray,M)); //just add the new parameter. 353 } 354 /*}}}*/ 355 /*FUNCTION Parameters::SetParam(IssmDouble* IssmDoublearray,int M,int N, int enum_type);{{{*/ 356 void Parameters::SetParam(IssmDouble* IssmDoublearray,int M, int N, int enum_type){ 357 358 Param* param=NULL; 359 360 /*first, figure out if the param has already been created: */ 361 param=(Param*)this->FindParamObject(enum_type); 362 363 if(param) param->SetValue(IssmDoublearray,M,N); //already exists, just set it. 364 else this->AddObject(new DoubleMatParam(enum_type,IssmDoublearray,M,N)); //just add the new parameter. 365 365 } 366 366 /*}}}*/ -
issm/trunk-jpl/src/c/Container/Parameters.h
r12365 r12466 32 32 void FindParam(bool* pinteger,int enum_type); 33 33 void FindParam(int* pinteger,int enum_type); 34 void FindParam( double* pscalar, int enum_type);34 void FindParam(IssmDouble* pscalar, int enum_type); 35 35 void FindParam(char** pstring,int enum_type); 36 36 void FindParam(char*** pstringarray,int* pM,int enum_type); 37 37 void FindParam(int** pintarray,int* pM,int enum_type); 38 38 void FindParam(int** pintarray,int* pM,int* PN,int enum_type); 39 void FindParam( double** pdoublearray,int* pM,int enum_type);40 void FindParam( double** pdoublearray,int* pM,int* pN,int enum_type);41 void FindParam( double*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type);39 void FindParam(IssmDouble** pIssmDoublearray,int* pM,int enum_type); 40 void FindParam(IssmDouble** pIssmDoublearray,int* pM,int* pN,int enum_type); 41 void FindParam(IssmDouble*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type); 42 42 void FindParam(Vector** pvec,int enum_type); 43 43 void FindParam(Matrix** pmat,int enum_type); … … 46 46 void SetParam(bool boolean,int enum_type); 47 47 void SetParam(int integer,int enum_type); 48 void SetParam( double scalar, int enum_type);48 void SetParam(IssmDouble scalar, int enum_type); 49 49 void SetParam(char* string,int enum_type); 50 50 void SetParam(char** stringarray,int M,int enum_type); 51 void SetParam( double* doublearray,int M,int enum_type);52 void SetParam( double* doublearray,int M,int N,int enum_type);51 void SetParam(IssmDouble* IssmDoublearray,int M,int enum_type); 52 void SetParam(IssmDouble* IssmDoublearray,int M,int N,int enum_type); 53 53 void SetParam(int* intarray,int M,int enum_type); 54 54 void SetParam(int* intarray,int M,int N,int enum_type);
Note:
See TracChangeset
for help on using the changeset viewer.