10 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
38 #include "../../shared/shared.h"
39 #include "../../toolkits/toolkits.h"
46 for(
int i=0;i<
NUMPARAMS;i++) this->params[i] = NULL;
52 if(this->params[i])
delete this->params[i];
74 int index = EnumToIndex(param_enum);
77 if(this->params[index]){
78 delete this->params[index];
79 this->params[index] = NULL;
83 this->params[index] = newparam;
101 if(this->params[i]) this->params[i]->DeepEcho();
108 if(this->params[i]) this->params[i]->Echo();
124 if(this->params[i]) num_params++;
131 obj_enum = this->params[i]->ObjectEnum();
133 this->params[i]->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
143 for(
int i=0;i<num_params;i++){
151 doubleparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
152 this->AddObject(doubleparam);
157 intparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
158 this->AddObject(intparam);
163 intmparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
164 this->AddObject(intmparam);
169 intvparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
170 this->AddObject(intvparam);
175 boolparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
176 this->AddObject(boolparam);
181 dsparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
182 this->AddObject(dsparam);
187 dmaparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
188 this->AddObject(dmaparam);
193 dmparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
194 this->AddObject(dmparam);
199 dvparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
200 this->AddObject(dvparam);
205 fileparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
213 sparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
214 this->AddObject(sparam);
219 saparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
220 this->AddObject(saparam);
225 transparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
226 this->AddObject(transparam);
231 transarrayparam->
Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
232 this->AddObject(transarrayparam);
245 int index = EnumToIndex(param_enum);
246 if(this->params[index]){
247 delete this->params[index];
248 this->params[index] = NULL;
256 int index = EnumToIndex(param_enum);
257 if(this->params[index])
return true;
264 int index = EnumToIndex(param_enum);
266 this->params[index]->GetParameterValue(pbool);
271 int index = EnumToIndex(param_enum);
273 this->params[index]->GetParameterValue(pinteger);
277 int index = EnumToIndex(param_enum);
279 this->params[index]->GetParameterValue(pscalar);
284 int index = EnumToIndex(param_enum);
286 this->params[index]->GetParameterValue(pscalar,time);
291 int index = EnumToIndex(param_enum);
293 this->params[index]->GetParameterValue(pscalar,row,time);
298 int index = EnumToIndex(param_enum);
300 this->params[index]->GetParameterValue(pstring);
306 int index = EnumToIndex(param_enum);
308 this->params[index]->GetParameterValue(pstringarray,pM);
313 int index = EnumToIndex(param_enum);
315 this->params[index]->GetParameterValue(pintarray,pM);
321 int index = EnumToIndex(param_enum);
323 this->params[index]->GetParameterValue(pintarray,pM,pN);
329 int index = EnumToIndex(param_enum);
332 this->params[index]->GetParameterValue(pIssmDoublearray,pM);
338 int index = EnumToIndex(param_enum);
340 this->params[index]->GetParameterValue(pIssmDoublearray,pM,pN);
345 int index = EnumToIndex(param_enum);
347 this->params[index]->GetParameterValue(parray,pM,pmdims_array,pndims_array);
352 int index = EnumToIndex(param_enum);
354 this->params[index]->GetParameterValue(pvec);
359 int index = EnumToIndex(param_enum);
361 this->params[index]->GetParameterValue(pmat);
366 int index = EnumToIndex(param_enum);
368 this->params[index]->GetParameterValue(pfid);
374 int index = EnumToIndex(param_enum);
376 this->params[index]->GetParameterValue(pdataset);
383 int index = EnumToIndex(param_enum);
385 this->params[index]->GetParameterValue(&intermediary);
388 *pscalar=reCast<IssmPDouble>(intermediary);
393 int index = EnumToIndex(param_enum);
400 this->params[index]->GetParameterValue(&vector,&n);
404 for(
int i=0;i<n;i++) output[i] = reCast<IssmPDouble>(vector[i]);
407 if(pvec) *pvec = output;
413 int index = EnumToIndex(dataset_type);
417 DataSetParam* dataset_param = xDynamicCast<DataSetParam*>(this->params[index]);
418 for( vector<Object*>::iterator
object=dataset_param->
value->
objects.begin() ; object < dataset_param->value->objects.end();
object++ ){
419 Param* param = xDynamicCast<Param*>(*
object);
432 int index = EnumToIndex(param_enum);
436 this->params[index]->GetParameterValue(&value);
446 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
449 else this->AddObject(
new BoolParam(enum_type,
boolean));
457 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
460 else this->AddObject(
new IntParam(enum_type,integer));
468 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
470 else this->AddObject(
new DoubleParam(enum_type,scalar));
478 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
481 else this->AddObject(
new StringParam(enum_type,
string));
489 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
491 if(param) param->
SetValue(stringarray,M);
500 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
502 if(param) param->
SetValue(IssmDoublearray,M);
503 else this->AddObject(
new DoubleVecParam(enum_type,IssmDoublearray,M));
511 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
513 if(param) param->
SetValue(IssmDoublearray,M,N);
514 else this->AddObject(
new DoubleMatParam(enum_type,IssmDoublearray,M,N));
522 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
524 if(param) param->
SetValue(intarray,M);
525 else this->AddObject(
new IntVecParam(enum_type,intarray,M));
533 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
535 if(param) param->
SetValue(intarray,M,N);
536 else this->AddObject(
new IntMatParam(enum_type,intarray,M,N));
544 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
547 else this->AddObject(
new VectorParam(enum_type,vector));
555 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
558 else this->AddObject(
new MatrixParam(enum_type,matrix));
566 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
569 else this->AddObject(
new FileParam(enum_type,fid));
577 param=xDynamicCast<Param*>(this->FindParamObject(enum_type));
590 return this->params[EnumToIndex(param_enum)];
600 char *outstring = NULL;
601 char *outtoolkit = NULL;
605 int *analyses = NULL;
606 char **strings = NULL;
608 char **toolkits = NULL;
609 char *toolkit = NULL;
618 if(numanalyses==0)
return NULL;
621 for(i=0;i<numanalyses;i++){
622 if(analyses[i]==analysis_type){
629 for(i=0;i<numanalyses;i++){
641 outtoolkit=xNew<char>(strlen(toolkits[found])+1);
642 strcpy(outtoolkit,toolkits[found]);
643 *pouttoolkit = outtoolkit;
646 outstring=xNew<char>(strlen(strings[found])+1);
647 strcpy(outstring,strings[found]);
650 for(i=0;i<numanalyses;i++){
651 xDelete<char>(toolkits[i]);
652 xDelete<char>(strings[i]);
654 xDelete<char*>(toolkits);
655 xDelete<char*>(strings);
656 xDelete<int>(analyses);
669 char* options = NULL;
670 char* toolkit = NULL;
681 #if (_PETSC_MINOR_>=7)
682 PetscOptionsSetFromOptions(NULL);
683 PetscOptionsClear(NULL);
684 int ierr = PetscOptionsInsertString(NULL,options);
688 PetscOptionsSetFromOptions();
690 int ierr = PetscOptionsInsertString(options);
693 if(ierr)
_error_(
"Could not enter PETSc options");
697 xDelete<char>(options);
698 xDelete<char>(toolkit);