Changeset 27696
- Timestamp:
- 04/20/23 11:09:20 (2 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 2 added
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Makefile.am
r27686 r27696 130 130 ./classes/Params/Parameters.cpp \ 131 131 ./classes/Params/BoolParam.cpp \ 132 ./classes/Params/ControlParam.cpp \ 132 133 ./classes/Params/IntParam.cpp \ 133 134 ./classes/Params/IntVecParam.cpp \ -
issm/trunk-jpl/src/c/classes/IoModel.cpp
r27668 r27696 1022 1022 } 1023 1023 /*}}}*/ 1024 void IoModel::FetchData(IssmDouble** pscalar, const char* data_name){/*{{{*/ 1025 1026 /*output: */ 1027 IssmPDouble *scalar = NULL; 1028 int code = 0; 1029 1030 /*recover my_rank:*/ 1031 int my_rank=IssmComm::GetRank(); 1032 1033 /*Set file pointer to beginning of the data: */ 1034 fid=this->SetFilePointerToData(&code,NULL,data_name); 1035 if(code!=3)_error_("expecting a IssmDouble for \""<<data_name<<"\""); 1036 1037 /*Now fetch: */ 1038 1039 /*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */ 1040 1041 /*Now allocate matrix: */ 1042 /*Read matrix on node 0, then broadcast: */ 1043 scalar=xNew<IssmPDouble>(1); 1044 if(my_rank==0) if(fread(scalar,sizeof(IssmPDouble),1,fid)!=1) _error_("could not read matrix "); 1045 ISSM_MPI_Bcast(scalar,1,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 1046 1047 _printf0_("scalar: " << *scalar << "\n"); 1048 *pscalar=xNew<IssmDouble>(1); 1049 *pscalar[0]=scalar[0]; 1050 xDelete<IssmPDouble>(scalar); 1051 } 1052 /*}}}*/ 1024 1053 void IoModel::FetchData(char** pstring,const char* data_name){/*{{{*/ 1025 1054 … … 1425 1454 if(pM) *pM=M; 1426 1455 if(pN) *pN=N; 1456 } 1457 /*}}}*/ 1458 void IoModel::FetchData(IssmPDouble** pscalar,const char* data_name){/*{{{*/ 1459 1460 /*output: */ 1461 IssmPDouble *scalar = NULL; 1462 int code; 1463 1464 /*recover my_rank:*/ 1465 int my_rank=IssmComm::GetRank(); 1466 1467 /*Set file pointer to beginning of the data: */ 1468 fid=this->SetFilePointerToData(&code,NULL,data_name); 1469 1470 if(code!=3)_error_("expecting a IssmDouble for \""<<data_name<<"\""); 1471 1472 /*We have to read a scalar from disk. First read the dimensions of the scalar, then the scalar: */ 1473 scalar=xNew<IssmPDouble>(1); 1474 if(my_rank==0){ 1475 if(fread(scalar,sizeof(IssmPDouble),1,fid)!=1)_error_("could not read scalar "); 1476 } 1477 ISSM_MPI_Bcast(scalar,1,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 1478 1479 1480 /*Assign output pointers: */ 1481 *pscalar=scalar; 1427 1482 } 1428 1483 /*}}}*/ -
issm/trunk-jpl/src/c/classes/IoModel.h
r27490 r27696 133 133 void FetchData(int* pinteger,const char* data_name); 134 134 void FetchData(IssmDouble* pscalar,const char* data_name); 135 void FetchData(IssmDouble** pscalar, const char* data_name); 135 136 void FetchData(char** pstring,const char* data_name); 136 137 void FetchData(char*** pstrings,int* pnumstrings,const char* data_name); … … 140 141 #if _HAVE_AD_ && !defined(_WRAPPERS_) 141 142 void FetchData(IssmPDouble** pscalarmatrix,int* pM,int* pN,const char* data_name); 143 void FetchData(IssmPDouble** pscalar,const char* data_name); 142 144 #endif 143 145 void FetchData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,const char* data_name); -
issm/trunk-jpl/src/c/classes/Params/BoolParam.h
r25508 r27696 49 49 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 52 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 52 53 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 62 63 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 63 64 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 65 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 64 66 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 70 72 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 71 73 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 74 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 72 75 /*}}}*/ 73 76 }; -
issm/trunk-jpl/src/c/classes/Params/DataSetParam.h
r25508 r27696 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 53 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("DataSet param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 54 55 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 64 65 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a file pointer");} 65 66 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 67 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 66 68 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 67 69 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 72 74 void SetValue(DataSet* dataset); 73 75 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("DataSet param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 76 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 74 77 /*}}}*/ 75 78 }; -
issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h
r25508 r27696 52 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} 53 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");} 54 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 54 55 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims); 55 56 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Vec");} … … 65 66 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a string");} 66 67 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a string array");} 68 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 67 69 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble vec array");} 68 70 void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a IssmDouble mat array");} … … 73 75 void SetValue(FILE* fid){_error_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 74 76 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array); 77 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 75 78 /*}}}*/ 76 79 }; -
issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.h
r25508 r27696 52 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 53 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN); 54 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 54 55 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 55 56 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 63 64 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 64 65 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 66 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} 66 68 void SetValue(IssmDouble* IssmDoublearray,int M,int N); … … 72 74 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 73 75 void SetEnum(int enum_in){this->enum_type = enum_in;}; 76 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 74 77 /*}}}*/ 75 78 /*DoubleMatParam specific routines:{{{*/ -
issm/trunk-jpl/src/c/classes/Params/DoubleParam.h
r25508 r27696 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM); 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN); 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 53 54 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 63 64 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 64 65 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 66 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 66 68 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 71 73 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 72 74 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 75 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 73 76 /*}}}*/ 74 77 }; -
issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.h
r25508 r27696 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM); 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN); 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 53 54 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 63 64 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 64 65 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 66 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* IssmDoublearray,int M); 66 68 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} … … 71 73 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 72 74 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 75 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 73 76 /*}}}*/ 74 77 /*DoubleVecParam specific routines:{{{*/ -
issm/trunk-jpl/src/c/classes/Params/FileParam.h
r25508 r27696 49 49 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 52 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 52 53 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 62 63 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 63 64 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 65 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 64 66 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 70 72 void SetValue(FILE* fid){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 71 73 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");} 74 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 72 75 /*}}}*/ 73 76 }; -
issm/trunk-jpl/src/c/classes/Params/GenericParam.h
r25531 r27696 77 77 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble array");} 78 78 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble array");} 79 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble array");} 79 80 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a matrix array");} 80 81 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Vec");} … … 91 92 void SetValue(char* string){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a string");} 92 93 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a string array");} 94 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");} 93 95 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");} 94 96 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");} … … 97 99 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a FILE");} 98 100 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an array of matrices");} 101 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an IssmDouble");}; 99 102 100 103 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Params/IntMatParam.h
r25508 r27696 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}; 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 53 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 54 55 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 64 65 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 65 66 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 67 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 66 68 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} 67 69 void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");}; … … 72 74 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 73 75 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 76 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 74 77 /*}}}*/ 75 78 }; -
issm/trunk-jpl/src/c/classes/Params/IntParam.h
r25508 r27696 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 53 54 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 65 66 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 66 67 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 68 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 67 69 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 68 70 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 71 73 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 72 74 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 75 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 73 76 /*}}}*/ 74 77 }; -
issm/trunk-jpl/src/c/classes/Params/IntVecParam.h
r25508 r27696 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array (maybe in serial?)");} 52 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 53 54 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 54 55 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 64 65 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 65 66 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 67 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 66 68 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} 67 69 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble mat array");} … … 72 74 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 73 75 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 76 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 74 77 /*}}}*/ 75 78 }; -
issm/trunk-jpl/src/c/classes/Params/MatrixParam.h
r25508 r27696 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 53 54 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a vec");} … … 63 64 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 64 65 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 66 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 66 68 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 71 73 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 72 74 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 75 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 73 76 /*}}}*/ 74 77 }; -
issm/trunk-jpl/src/c/classes/Params/Param.h
r25508 r27696 39 39 virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM)=0; 40 40 virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN)=0; 41 virtual void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data)=0; 41 42 virtual void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims)=0; 42 43 virtual void GetParameterValue(Vector<IssmDouble>** pvec)=0; … … 56 57 virtual void SetValue(DataSet* dataset){_error_("not implemented yet");}; 57 58 virtual void SetValue(IssmDouble* IssmDoublearray,int M)=0; 59 virtual void SetValue(IssmDouble* IssmDoublearray)=0; 58 60 virtual void SetValue(IssmDouble* pIssmDoublearray,int M,int N)=0; 59 61 virtual void SetValue(int* intarray,int M)=0; … … 63 65 virtual void SetValue(FILE* fid)=0; 64 66 virtual void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array)=0; 67 virtual void SetGradient(IssmDouble* poutput, int M)=0; 65 68 }; 66 69 #endif -
issm/trunk-jpl/src/c/classes/Params/Parameters.cpp
r27102 r27696 20 20 21 21 #include "./BoolParam.h" 22 #include "./ControlParam.h" 22 23 #include "./DoubleMatParam.h" 23 24 #include "./DataSetParam.h" … … 232 233 this->AddObject(transarrayparam); 233 234 } 235 else if(obj_enum==ControlParamEnum){ 236 ControlParam* controlparam=NULL; 237 controlparam=new ControlParam(); 238 controlparam->Marshall(marshallhandle); 239 this->AddObject(controlparam); 240 } 234 241 else if(obj_enum==GenericParamEnum){ 235 242 /*Skip for now (we don't want to Marhsall Comms)*/ … … 417 424 if(pM) *pM = n; 418 425 }/*}}}*/ 426 void Parameters::FindControlParam(IssmDouble** pvec,int* pM, int param_enum, const char* data){ _assert_(this);/*{{{*/ 427 428 int index = EnumToIndex(param_enum); 429 430 /*Output*/ 431 int n; 432 IssmDouble* vector = NULL; 433 434 if(!this->params[index]) _error_("Parameter " << EnumToStringx(param_enum) <<" not set"); 435 this->params[index]->GetParameterValue(pvec,pM,data); 436 437 }/*}}}*/ 438 void Parameters::FindControlParamAndMakePassive(IssmPDouble** pvec,int* pM, int param_enum, const char* data){ _assert_(this);/*{{{*/ 439 440 int index = EnumToIndex(param_enum); 441 442 /*Output*/ 443 int n; 444 IssmDouble* vector = NULL; 445 446 if(!this->params[index]) _error_("Parameter " << EnumToStringx(param_enum) <<" not set"); 447 this->params[index]->GetParameterValue(&vector,&n,data); 448 449 /*Make output passive*/ 450 #ifdef _HAVE_AD_ 451 IssmPDouble* output = xNew<IssmPDouble>(n); 452 for(int i=0;i<n;i++) output[i] = reCast<IssmPDouble>(vector[i]); 453 xDelete<IssmDouble>(vector); 454 if(pvec) *pvec = output; 455 #else 456 if(pvec) *pvec = vector; 457 #endif 458 459 /*assign output pointers*/ 460 if(pM) *pM = n; 461 }/*}}}*/ 419 462 void Parameters::FindParamInDataset(IssmDouble** pIssmDoublearray,int* pM,int* pN,int dataset_type,int enum_type){/*{{{*/ 420 463 _assert_(this); … … 524 567 } 525 568 /*}}}*/ 569 void Parameters::SetParam(IssmDouble* IssmDoublearray, int enum_type){/*{{{*/ 570 571 Param* param=NULL; 572 573 /*first, figure out if the param has already been created: */ 574 param=xDynamicCast<Param*>(this->FindParamObject(enum_type)); 575 if(param) param->SetValue(IssmDoublearray); //already exists, just set it. 576 else _error_("Param "<< EnumToStringx(enum_type) << " cannot setValue"); 577 578 //this->AddObject(new ControlParam(enum_type,IssmDoublearray,M,N)); //just add the new parameter. 579 } 580 /*}}}*/ 526 581 void Parameters::SetParam(int* intarray,int M, int enum_type){/*{{{*/ 527 582 … … 592 647 this->AddObject(new DataSetParam(enum_type,dataset)); //just add the new parameter. 593 648 } 649 } 650 /*}}}*/ 651 void Parameters::SetControlParam(IssmDouble* IssmDoublearray,int M, int enum_type){/*{{{*/ 652 653 Param* param=NULL; 654 655 /*first, figure out if the param has already been created: */ 656 param=xDynamicCast<Param*>(this->FindParamObject(enum_type)); 657 658 if(param) param->SetValue(IssmDoublearray,M); //already exists, just set it. 659 else _error_("Param "<< EnumToStringx(enum_type) << " cannot setValue"); 660 } 661 /*}}}*/ 662 void Parameters::ControlParamSetGradient(IssmDouble* IssmDoublearray, int M, int enum_type){/*{{{*/ 663 664 Param* param=NULL; 665 666 /*first, figure out if the param has already been created: */ 667 param=xDynamicCast<Param*>(this->FindParamObject(enum_type)); 668 if(param) param->SetGradient(IssmDoublearray,M); //already exists, just set it. 669 else _error_("Param "<< EnumToStringx(enum_type) << " cannot setValue"); 670 671 //this->AddObject(new ControlParam(enum_type,IssmDoublearray,M,N)); //just add the new parameter. 594 672 } 595 673 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Params/Parameters.h
r25508 r27696 55 55 void FindParamAndMakePassive(IssmPDouble* pscalar, int enum_type); 56 56 void FindParamAndMakePassive(IssmPDouble** pvec,int* pM,int enum_type); 57 void FindControlParam(IssmDouble** pvec,int* pM, int param_enum, const char* data); 58 void FindControlParamAndMakePassive(IssmPDouble** pvec,int* pM, int param_enum, const char* data); 57 59 void FindParamInDataset(IssmDouble** pIssmDoublearray,int* pM,int* pN,int dataset_type,int enum_type); 58 60 IssmDouble FindParam(int enum_type); … … 65 67 void SetParam(IssmDouble* IssmDoublearray,int M,int enum_type); 66 68 void SetParam(IssmDouble* IssmDoublearray,int M,int N,int enum_type); 69 void SetParam(IssmDouble* IssmDoublearray, int enum_type); 67 70 void SetParam(int* intarray,int M,int enum_type); 68 71 void SetParam(int* intarray,int M,int N,int enum_type); … … 71 74 void SetParam(FILE* fid,int enum_type); 72 75 void SetParam(DataSet* dataset,int enum_type); 73 76 void SetControlParam(IssmDouble* IssmDoublearray,int M, int enum_type); 77 void ControlParamSetGradient(IssmDouble* IssmDoublearray, int M, int enum_type); 74 78 Param* FindParamObject(int enum_type); 75 79 -
issm/trunk-jpl/src/c/classes/Params/StringArrayParam.h
r25508 r27696 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Vec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");} 53 54 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 63 64 void SetValue(char* string){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string");} 64 65 void SetValue(char** stringarray,int M); 66 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 66 68 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 71 73 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 72 74 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 75 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 73 76 /*}}}*/ 74 77 }; -
issm/trunk-jpl/src/c/classes/Params/StringParam.h
r25508 r27696 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 53 54 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");} … … 63 64 void SetValue(char* string); 64 65 void SetValue(char** stringarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a string array");} 66 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 66 68 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 71 73 void SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");} 72 74 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 75 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 73 76 /*}}}*/ 74 77 }; -
issm/trunk-jpl/src/c/classes/Params/TransientArrayParam.h
r26196 r27696 55 55 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 56 56 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 57 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 57 58 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a matrix array");} 58 59 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a Vec");} … … 68 69 void SetValue(char* string){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a string");} 69 70 void SetValue(char** stringarray,int M){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a string array");} 71 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 70 72 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} 71 73 void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 76 78 void SetValue(FILE* fid){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a FILE");} 77 79 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold an array of matrices");} 80 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 78 81 /*}}}*/ 79 82 }; -
issm/trunk-jpl/src/c/classes/Params/TransientParam.h
r26196 r27696 53 53 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 54 54 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 55 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 55 56 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a matrix array");} 56 57 void GetParameterValue(Vector<IssmDouble>** pvec){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a Vec");} … … 66 67 void SetValue(char* string){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a string");} 67 68 void SetValue(char** stringarray,int M){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a string array");} 69 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 68 70 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a IssmDouble vec array");} 69 71 void SetValue(IssmDouble* IssmDoublearray,int M,int N){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} … … 74 76 void SetValue(FILE* fid){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a FILE");} 75 77 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold an array of matrices");} 78 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 76 79 /*}}}*/ 77 80 }; -
issm/trunk-jpl/src/c/classes/Params/VectorParam.h
r25508 r27696 50 50 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 51 51 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 void GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, const char* data){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");} 52 53 void GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");} 53 54 void GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");} … … 63 64 void SetValue(char* string){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string");} 64 65 void SetValue(char** stringarray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a string array");} 66 void SetValue(IssmDouble* IssmDoublearray){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");} 65 67 void SetValue(IssmDouble* IssmDoublearray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} 66 68 void SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a IssmDouble array");} … … 71 73 void SetValue(FILE* fid){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");} 72 74 void SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");} 75 void SetGradient(IssmDouble* poutput, int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an IssmDouble");}; 73 76 /*}}}*/ 74 77 }; -
issm/trunk-jpl/src/c/classes/classes.h
r27686 r27696 90 90 #include "./Params/GenericParam.h" 91 91 #include "./Params/BoolParam.h" 92 #include "./Params/ControlParam.h" 92 93 #include "./Params/DoubleMatParam.h" 93 94 #include "./Params/DoubleTransientMatParam.h" -
issm/trunk-jpl/src/c/cores/controladm1qn3_core.cpp
r27666 r27696 234 234 double *XL = NULL; 235 235 double *XU = NULL; 236 GetPassiveVectorFromControlInputsx(&XL,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"lowerbound"); 237 GetPassiveVectorFromControlInputsx(&XU,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"upperbound"); 236 if(IsParamEnum(control_enum[0])){ 237 femmodel->parameters->FindControlParamAndMakePassive(&XL,NULL,control_enum[0],"lowerbound"); 238 femmodel->parameters->FindControlParamAndMakePassive(&XU,NULL,control_enum[0],"upperbound"); 239 } 240 else{ 241 GetPassiveVectorFromControlInputsx(&XL,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"lowerbound"); 242 GetPassiveVectorFromControlInputsx(&XU,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"upperbound"); 243 } 238 244 239 245 int offset = 0; … … 251 257 #ifdef _HAVE_CODIPACK_ 252 258 if(checkpoint_frequency && solution_type == TransientSolutionEnum){ 253 SetControlInputsFromVectorx(femmodel,X); 259 if(IsParamEnum(control_enum[0])){ 260 #ifdef _HAVE_AD_ 261 IssmDouble* aX=xNew<IssmDouble>(intn,"t"); 262 #else 263 IssmDouble* aX=xNew<IssmDouble>(intn); 264 #endif 265 for(int i=0;i<intn;i++) { 266 aX[i]=X[i]; 267 } 268 femmodel->parameters->SetControlParam(aX,M[0],control_enum[0]); 269 } 270 else{ 271 SetControlInputsFromVectorx(femmodel,X); 272 } 254 273 *pf = transient_ad(femmodel, G, &Jlist[(*Jlisti)*JlistN]); 255 274 } … … 304 323 305 324 ISSM_MPI_Bcast(aX,intn,ISSM_MPI_DOUBLE,0,IssmComm::GetComm()); 306 SetControlInputsFromVectorx(femmodel,aX); 325 if(IsParamEnum(control_enum[0])){ 326 femmodel->parameters->SetControlParam(aX,M[0],control_enum[0]); 327 } 328 else{ 329 SetControlInputsFromVectorx(femmodel,aX); 330 } 307 331 xDelete<IssmDouble>(aX); 308 332 … … 574 598 575 599 /*Get initial guess*/ 576 GetPassiveVectorFromControlInputsx(&X,&intn,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"value"); 600 if(IsParamEnum(control_enum[0])){ 601 femmodel->parameters->FindControlParamAndMakePassive(&X,NULL,control_enum[0],"value"); 602 intn=M[0]; 603 } 604 else{ 605 GetPassiveVectorFromControlInputsx(&X,&intn,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"value"); 606 } 577 607 578 608 /*Get problem dimension and initialize gradient and initial guess*/ … … 632 662 double *XL = NULL; 633 663 double *XU = NULL; 634 GetPassiveVectorFromControlInputsx(&XL,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"lowerbound"); 635 GetPassiveVectorFromControlInputsx(&XU,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"upperbound"); 664 if(IsParamEnum(control_enum[0])){ 665 femmodel->parameters->FindControlParamAndMakePassive(&XL,NULL,control_enum[0],"lowerbound"); 666 femmodel->parameters->FindControlParamAndMakePassive(&XU,NULL,control_enum[0],"upperbound"); 667 } 668 else{ 669 GetPassiveVectorFromControlInputsx(&XL,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"lowerbound"); 670 GetPassiveVectorFromControlInputsx(&XU,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"upperbound"); 671 } 636 672 637 673 offset = 0; … … 654 690 aG[i] = reCast<IssmDouble>(G[i]); 655 691 } 656 657 ControlInputSetGradientx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,aG); 658 SetControlInputsFromVectorx(femmodel,aX); 659 692 693 if(IsParamEnum(control_enum[0])){ 694 //femmodel->parameters->ControlParamSetGradient(aG,M[0],control_enum[0]); 695 femmodel->parameters->SetControlParam(aX,M[0],control_enum[0]); 696 } 697 else{ 698 ControlInputSetGradientx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,aG); 699 SetControlInputsFromVectorx(femmodel,aX); 700 } 660 701 xDelete(aX); 661 702 -
issm/trunk-jpl/src/c/cores/transient_core.cpp
r27314 r27696 274 274 int step,timestepping; 275 275 int checkpoint_frequency,num_responses; 276 int *M = NULL; 277 int *control_enum; 276 278 277 279 /*Get rank*/ … … 286 288 femmodel->parameters->FindParam(&num_responses,InversionNumCostFunctionsEnum); 287 289 femmodel->parameters->FindParam(&checkpoint_frequency,SettingsCheckpointFrequencyEnum); _assert_(checkpoint_frequency>0); 290 femmodel->parameters->FindParam(&control_enum,NULL,InversionControlParametersEnum); 291 femmodel->parameters->FindParam(&M,NULL,ControlInputSizeMEnum); 288 292 289 293 std::vector<IssmDouble> time_all; … … 356 360 /*Get X (control)*/ 357 361 IssmDouble *X = NULL; int Xsize; 358 GetVectorFromControlInputsx(&X,&Xsize,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"value"); 359 362 if(IsParamEnum(control_enum[0])){ 363 femmodel->parameters->FindControlParam(&X,NULL,control_enum[0],"value"); 364 Xsize=M[0]; 365 } 366 else{ 367 GetVectorFromControlInputsx(&X,&Xsize,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"value"); 368 } 360 369 /*Initialize model state adjoint (Yb)*/ 361 370 double *Yb = xNewZeroInit<double>(Ysize); … … 383 392 delete hdl_regin; 384 393 if(my_rank==0) for(int i=0; i < Xsize; i++) tape_codi.registerInput(X[i]); 385 SetControlInputsFromVectorx(femmodel,X); 386 394 395 if(IsParamEnum(control_enum[0])){ 396 femmodel->parameters->SetControlParam(X,M[0],control_enum[0]); 397 } 398 else{ 399 SetControlInputsFromVectorx(femmodel,X); 400 } 401 387 402 IssmDouble J = 0.; 388 403 int count = 0; … … 446 461 /*Tell codipack that X is the independent*/ 447 462 for(int i=0; i<Xsize; i++) tape_codi.registerInput(X[i]); 448 SetControlInputsFromVectorx(femmodel,X); 463 464 if(IsParamEnum(control_enum[0])){ 465 femmodel->parameters->SetControlParam(X,M[0],control_enum[0]); 466 } 467 else{ 468 SetControlInputsFromVectorx(femmodel,X); 469 } 449 470 450 471 /*Get New state*/ … … 510 531 xDelete<double>(Yb); 511 532 xDelete<int>(Yin); 533 xDelete<int>(control_enum); 534 xDelete<int>(M); 512 535 return J.getValue(); 513 536 }/*}}}*/ -
issm/trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
r27678 r27696 283 283 } 284 284 else if(IsParamEnum(input_enum)){ 285 _error_("not supported yet"); 285 //_error_("not supported yet"); 286 Interp_all[i] = P0Enum; 287 parameters->AddObject(new ControlParam(independent,independents_min,independents_max,input_enum,M_all[i])); 288 286 289 } 287 290 xDelete<IssmDouble>(independent); -
issm/trunk-jpl/src/c/shared/Enum/Enum.vim
r27688 r27696 1412 1412 syn keyword cConstant ControlInputMinsEnum 1413 1413 syn keyword cConstant ControlInputValuesEnum 1414 syn keyword cConstant ControlParamEnum 1414 1415 syn keyword cConstant CrouzeixRaviartEnum 1415 1416 syn keyword cConstant CuffeyEnum … … 1777 1778 syn keyword cType Contours 1778 1779 syn keyword cType ControlInput 1780 syn keyword cType ControlParam 1779 1781 syn keyword cType Covertree 1780 1782 syn keyword cType DatasetInput -
issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
r27688 r27696 1411 1411 ControlInputMinsEnum, 1412 1412 ControlInputValuesEnum, 1413 ControlParamEnum, 1413 1414 CrouzeixRaviartEnum, 1414 1415 CuffeyEnum, -
issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
r27688 r27696 1414 1414 case ControlInputMinsEnum : return "ControlInputMins"; 1415 1415 case ControlInputValuesEnum : return "ControlInputValues"; 1416 case ControlParamEnum : return "ControlParam"; 1416 1417 case CrouzeixRaviartEnum : return "CrouzeixRaviart"; 1417 1418 case CuffeyEnum : return "Cuffey"; -
issm/trunk-jpl/src/c/shared/Enum/Enumjl.vim
r27688 r27696 1405 1405 syn keyword juliaConstC ControlInputMinsEnum 1406 1406 syn keyword juliaConstC ControlInputValuesEnum 1407 syn keyword juliaConstC ControlParamEnum 1407 1408 syn keyword juliaConstC CrouzeixRaviartEnum 1408 1409 syn keyword juliaConstC CuffeyEnum -
issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
r27688 r27696 1447 1447 else if (strcmp(name,"ControlInputMins")==0) return ControlInputMinsEnum; 1448 1448 else if (strcmp(name,"ControlInputValues")==0) return ControlInputValuesEnum; 1449 else if (strcmp(name,"ControlParam")==0) return ControlParamEnum; 1449 1450 else if (strcmp(name,"CrouzeixRaviart")==0) return CrouzeixRaviartEnum; 1450 1451 else if (strcmp(name,"Cuffey")==0) return CuffeyEnum; … … 1489 1490 else if (strcmp(name,"FSpressure")==0) return FSpressureEnum; 1490 1491 else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum; 1491 else if (strcmp(name,"FemModel")==0) return FemModelEnum;1492 1492 else stage=13; 1493 1493 } 1494 1494 if(stage==13){ 1495 if (strcmp(name,"FileParam")==0) return FileParamEnum; 1495 if (strcmp(name,"FemModel")==0) return FemModelEnum; 1496 else if (strcmp(name,"FileParam")==0) return FileParamEnum; 1496 1497 else if (strcmp(name,"FixedTimestepping")==0) return FixedTimesteppingEnum; 1497 1498 else if (strcmp(name,"FloatingArea")==0) return FloatingAreaEnum; … … 1612 1613 else if (strcmp(name,"MatrixParam")==0) return MatrixParamEnum; 1613 1614 else if (strcmp(name,"MaxAbsVx")==0) return MaxAbsVxEnum; 1614 else if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;1615 1615 else stage=14; 1616 1616 } 1617 1617 if(stage==14){ 1618 if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum; 1618 if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum; 1619 else if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum; 1619 1620 else if (strcmp(name,"MaxDivergence")==0) return MaxDivergenceEnum; 1620 1621 else if (strcmp(name,"MaxVel")==0) return MaxVelEnum; … … 1735 1736 else if (strcmp(name,"StressbalanceAnalysis")==0) return StressbalanceAnalysisEnum; 1736 1737 else if (strcmp(name,"StressbalanceConvergenceNumSteps")==0) return StressbalanceConvergenceNumStepsEnum; 1737 else if (strcmp(name,"StressbalanceSIAAnalysis")==0) return StressbalanceSIAAnalysisEnum;1738 1738 else stage=15; 1739 1739 } 1740 1740 if(stage==15){ 1741 if (strcmp(name,"StressbalanceSolution")==0) return StressbalanceSolutionEnum; 1741 if (strcmp(name,"StressbalanceSIAAnalysis")==0) return StressbalanceSIAAnalysisEnum; 1742 else if (strcmp(name,"StressbalanceSolution")==0) return StressbalanceSolutionEnum; 1742 1743 else if (strcmp(name,"StressbalanceVerticalAnalysis")==0) return StressbalanceVerticalAnalysisEnum; 1743 1744 else if (strcmp(name,"StringArrayParam")==0) return StringArrayParamEnum; -
issm/trunk-jpl/src/c/shared/io/Marshalling/IoCodeConversions.cpp
r27692 r27696 166 166 const char* field = "md.calving.stress_threshold_groundedice"; 167 167 input_enum = CalvingStressThresholdGroundediceEnum; 168 fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1)); 169 } 170 else if(strcmp(string_in,"CalvingADStressThresholdGroundedice")==0){ 171 const char* field = "md.calving.stress_threshold_groundedice"; 172 input_enum = CalvingADStressThresholdGroundediceEnum; 168 173 fieldname=xNew<char>((strlen(field)+1)); xMemCpy<char>(fieldname,field,(strlen(field)+1)); 169 174 }
Note:
See TracChangeset
for help on using the changeset viewer.