Changeset 16208
- Timestamp:
- 09/20/13 11:09:57 (12 years ago)
- Location:
- issm/trunk-jpl/src/c/classes
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Element.h ¶
r16188 r16208 67 67 virtual void InputToResult(int enum_type,int step,IssmDouble time)=0; 68 68 virtual void InputDuplicate(int original_enum,int new_enum)=0; 69 virtual void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0;69 virtual void InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code)=0; 70 70 virtual void RequestedOutput(int output_enum,int step,IssmDouble time)=0; 71 71 -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Penta.cpp ¶
r16200 r16208 1874 1874 } 1875 1875 /*}}}*/ 1876 /*FUNCTION Penta::InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/1877 void Penta::InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements1876 /*FUNCTION Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/ 1877 void Penta::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){ 1878 1878 1879 1879 /*Intermediaries*/ … … 1891 1891 for(i=0;i<6;i++){ 1892 1892 _assert_(iomodel->elements); 1893 penta_vertex_ids[i]=iomodel->elements[6* index+i]; //ids for vertices are in the elements array from Matlab1893 penta_vertex_ids[i]=iomodel->elements[6*this->sid+i]; //ids for vertices are in the elements array from Matlab 1894 1894 } 1895 1895 … … 1930 1930 1931 1931 if (code==5){ //boolean 1932 this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool,IssmDouble>(vector[ index])));1932 this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool,IssmDouble>(vector[this->sid]))); 1933 1933 } 1934 1934 else if (code==6){ //integer 1935 this->inputs->AddInput(new IntInput(vector_enum,reCast<int,IssmDouble>(vector[ index])));1935 this->inputs->AddInput(new IntInput(vector_enum,reCast<int,IssmDouble>(vector[this->sid]))); 1936 1936 } 1937 1937 else if (code==7){ //IssmDouble 1938 this->inputs->AddInput(new DoubleInput(vector_enum,vector[ index]));1938 this->inputs->AddInput(new DoubleInput(vector_enum,vector[this->sid])); 1939 1939 } 1940 1940 else _error_("could not recognize nature of vector from code " << code); -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Penta.h ¶
r16188 r16208 94 94 int Sid(); 95 95 void InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max); 96 void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);96 void InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); 97 97 void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum); 98 98 void InputDuplicate(int original_enum,int new_enum); -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.cpp ¶
r16188 r16208 24 24 /*FUNCTION Tria::Tria(){{{*/ 25 25 Tria::Tria(){ 26 this->nodes = NULL;27 this->vertices = NULL;28 this->material = NULL;29 this->matpar = NULL;26 this->nodes = NULL; 27 this->vertices = NULL; 28 this->material = NULL; 29 this->matpar = NULL; 30 30 this->inputs = NULL; 31 31 this->parameters = NULL; … … 36 36 /*FUNCTION Tria::Tria(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/ 37 37 Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels) 38 :TriaRef(nummodels) 39 ,ElementHook(nummodels,index+1,3,iomodel){ 38 :TriaRef(nummodels),ElementHook(nummodels,index+1,3,iomodel){ 40 39 41 40 /*id: */ 42 this->id =tria_id;43 this->sid =tria_sid;41 this->id = tria_id; 42 this->sid = tria_sid; 44 43 45 44 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. 46 this->parameters =NULL;45 this->parameters = NULL; 47 46 48 47 /*intialize inputs and results: */ … … 81 80 tria->hnodes=new Hook*[tria->numanalyses]; 82 81 for(i=0;i<tria->numanalyses;i++)tria->hnodes[i]=(Hook*)this->hnodes[i]->copy(); 83 tria->hvertices =(Hook*)this->hvertices->copy();84 tria->hmaterial =(Hook*)this->hmaterial->copy();85 tria->hmatpar =(Hook*)this->hmatpar->copy();82 tria->hvertices = (Hook*)this->hvertices->copy(); 83 tria->hmaterial = (Hook*)this->hmaterial->copy(); 84 tria->hmatpar = (Hook*)this->hmatpar->copy(); 86 85 87 86 /*deal with Tria fields: */ 88 tria->id =this->id;89 tria->sid =this->sid;87 tria->id = this->id; 88 tria->sid = this->sid; 90 89 if(this->inputs){ 91 90 tria->inputs=(Inputs*)this->inputs->Copy(); … … 104 103 105 104 /*recover objects: */ 106 tria->nodes =xNew<Node*>(3); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.105 tria->nodes = xNew<Node*>(3); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 107 106 for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i]; 108 tria->vertices=(Vertex**)tria->hvertices->deliverp(); 109 tria->material=(Material*)tria->hmaterial->delivers(); 110 tria->matpar=(Matpar*)tria->hmatpar->delivers(); 107 108 tria->vertices = (Vertex**)tria->hvertices->deliverp(); 109 tria->material = (Material*)tria->hmaterial->delivers(); 110 tria->matpar = (Matpar*)tria->hmatpar->delivers(); 111 111 112 112 return tria; … … 1867 1867 } 1868 1868 /*}}}*/ 1869 /*FUNCTION Tria::InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/1870 void Tria::InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){//index into elements1869 /*FUNCTION Tria::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){{{*/ 1870 void Tria::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){ 1871 1871 1872 1872 /*Intermediaries*/ … … 1884 1884 for(i=0;i<3;i++){ 1885 1885 _assert_(iomodel->elements); 1886 tria_vertex_ids[i]=reCast<int>(iomodel->elements[3* index+i]); //ids for vertices are in the elements array from Matlab1886 tria_vertex_ids[i]=reCast<int>(iomodel->elements[3*this->sid+i]); //ids for vertices are in the elements array from Matlab 1887 1887 } 1888 1888 … … 1923 1923 1924 1924 if (code==5){ //boolean 1925 this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool>(vector[ index])));1925 this->inputs->AddInput(new BoolInput(vector_enum,reCast<bool>(vector[this->sid]))); 1926 1926 } 1927 1927 else if (code==6){ //integer 1928 this->inputs->AddInput(new IntInput(vector_enum,reCast<int>(vector[ index])));1928 this->inputs->AddInput(new IntInput(vector_enum,reCast<int>(vector[this->sid]))); 1929 1929 } 1930 1930 else if (code==7){ //IssmDouble 1931 this->inputs->AddInput(new DoubleInput(vector_enum,vector[ index]));1931 this->inputs->AddInput(new DoubleInput(vector_enum,vector[this->sid])); 1932 1932 } 1933 1933 else _error_("could not recognize nature of vector from code " << code); -
TabularUnified issm/trunk-jpl/src/c/classes/Elements/Tria.h ¶
r16188 r16208 91 91 void GetVectorFromResults(Vector<IssmDouble>* vector,int offset,int enum_in,int interp); 92 92 void InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max); 93 void InputCreate(IssmDouble* vector, int index,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);93 void InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); 94 94 void InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum=MeshElementsEnum); 95 95 void InputDuplicate(int original_enum,int new_enum); -
TabularUnified issm/trunk-jpl/src/c/classes/IoModel.cpp ¶
r16186 r16208 531 531 } 532 532 /*}}}*/ 533 /*FUNCTION IoModel::FetchData(bool* pbool,int data_enum){{{*/533 /*FUNCTION IoModel::FetchData(bool* pbool,int data_enum){{{*/ 534 534 void IoModel::FetchData(bool* pboolean,int data_enum){ 535 535 … … 560 560 } 561 561 /*}}}*/ 562 /*FUNCTION IoModel::FetchData(int* pinteger,int data_enum){{{*/562 /*FUNCTION IoModel::FetchData(int* pinteger,int data_enum){{{*/ 563 563 void IoModel::FetchData(int* pinteger,int data_enum){ 564 564 … … 616 616 } 617 617 /*}}}*/ 618 /*FUNCTION IoModel::FetchData(char** pstring,int data_enum){{{*/618 /*FUNCTION IoModel::FetchData(char** pstring,int data_enum){{{*/ 619 619 void IoModel::FetchData(char** pstring,int data_enum){ 620 620 … … 663 663 } 664 664 /*}}}*/ 665 /*FUNCTION IoModel::FetchData(int** pintegerematrix,int* pM,int* pN,int data_enum){{{*/665 /*FUNCTION IoModel::FetchData(int** pintegerematrix,int* pM,int* pN,int data_enum){{{*/ 666 666 void IoModel::FetchData(int** pmatrix,int* pM,int* pN,int data_enum){ 667 667 … … 792 792 } 793 793 /*}}}*/ 794 /*FUNCTION IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){{{*/794 /*FUNCTION IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){{{*/ 795 795 void IoModel::FetchData(char*** pstrings,int* pnumstrings,int data_enum){ 796 796 … … 1033 1033 /*}}}*/ 1034 1034 /*FUNCTION IoModel::FetchDataToInput{{{*/ 1035 void IoModel::FetchDataToInput(Elements* elements,int vector_enum, int default_vector_enum,IssmDouble default_value){1035 void IoModel::FetchDataToInput(Elements* elements,int vector_enum,IssmDouble default_value){ 1036 1036 1037 1037 /*intermediary: */ 1038 1038 int i; 1039 bool defaulting = false; 1040 int code = 0; 1041 int vector_layout = 0; 1042 int counter; 1043 int numberofelements; 1039 int code,vector_layout; 1044 1040 1045 1041 /*variables being fetched: */ … … 1051 1047 int M,N; 1052 1048 1053 /*Fetch parameters: */1054 this->constants->FindParam(&numberofelements,MeshNumberofelementsEnum);1055 1056 1049 /*First of, find the record for the enum, and get code of data type: */ 1057 1050 this->SetFilePointerToData(&code, &vector_layout,vector_enum); 1058 1051 1059 1052 switch(code){ 1060 case 1: //boolean constant . {{{1053 case 1: //boolean constant 1061 1054 this->FetchData(&boolean,vector_enum); 1062 1055 for(i=0;i<elements->Size();i++){ … … 1064 1057 element->InputUpdateFromConstant(boolean,vector_enum); 1065 1058 } 1066 break; /*}}}*/1067 case 2: //integer constant . {{{1059 break; 1060 case 2: //integer constant 1068 1061 this->FetchData(&integer,vector_enum); 1069 1062 for(i=0;i<elements->Size();i++){ … … 1071 1064 element->InputUpdateFromConstant(integer,vector_enum); 1072 1065 } 1073 break; /*}}}*/1074 case 3: //IssmDouble constant . {{{1066 break; 1067 case 3: //IssmDouble constant 1075 1068 this->FetchData(&scalar,vector_enum); 1076 1069 for(i=0;i<elements->Size();i++){ … … 1078 1071 element->InputUpdateFromConstant(scalar,vector_enum); 1079 1072 } 1080 break; /*}}}*/ 1081 case 5: //boolean vector. {{{ 1082 1083 /*Fetch vector:*/ 1073 break; 1074 case 5: //boolean vector 1084 1075 this->FetchData(&doublearray,&M,&N,vector_enum); //we still have a doublearray, because it might include times in transient mode 1085 /*Check we got something, otherwise fetch default: */ 1086 if(doublearray){ 1087 defaulting=false; //we are not defaulting, because we do have a vector 1088 } 1089 else{ 1090 /*do we have a default enum to go fetch? */ 1091 if(default_vector_enum!=NoneEnum){ 1092 /*yes. fetch it: */ 1093 this->FetchData(&doublearray,&M,&N,default_vector_enum); 1094 if(doublearray){ 1095 defaulting=false; //we are not defaulting, because we do have a vector 1096 } 1097 else{ 1098 /*even the default vector is non existent. we are defaulting to the default value: */ 1099 defaulting=true; 1100 } 1101 } 1102 else{ 1103 /*we are left with the default value: */ 1104 defaulting=true; 1105 } 1106 } 1107 1108 /*Create inputs:*/ 1109 counter=0; 1110 for (i=0;i<numberofelements;i++){ 1111 if(this->my_elements[i]){ 1112 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(counter)); 1113 if(defaulting) element->InputUpdateFromConstant(reCast<bool>(default_value),vector_enum); 1114 else element->InputCreate(doublearray,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1115 counter++; 1116 } 1117 } 1118 break; /*}}}*/ 1119 case 6: //int vector{{{ 1120 1121 /*Fetch vector:*/ 1076 for(i=0;i<elements->Size();i++){ 1077 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 1078 if(!doublearray) element->InputUpdateFromConstant(reCast<bool>(default_value),vector_enum); 1079 else element->InputCreate(doublearray,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1080 element->InputUpdateFromConstant(boolean,vector_enum); 1081 } 1082 break; 1083 case 6: //int vector 1122 1084 this->FetchData(&doublearray,&M,&N,vector_enum); //we still have a doublearray, because it might include times in transient mode 1123 /*Check we got something, otherwise fetch default: */ 1124 if(doublearray){ 1125 defaulting=false; //we are not defaulting, because we do have a vector 1126 } 1127 else{ 1128 /*do we have a default enum to go fetch? */ 1129 if(default_vector_enum!=NoneEnum){ 1130 /*yes. fetch it: */ 1131 this->FetchData(&doublearray,&M,&N,default_vector_enum); 1132 if(doublearray){ 1133 defaulting=false; //we are not defaulting, because we do have a vector 1134 } 1135 else{ 1136 /*even the default vector is non existent. we are defaulting to the default value: */ 1137 defaulting=true; 1138 } 1139 } 1140 else{ 1141 /*we are left with the default value: */ 1142 defaulting=true; 1143 } 1144 } 1145 1146 /*Create inputs:*/ 1147 counter=0; 1148 for (i=0;i<numberofelements;i++){ 1149 if(this->my_elements[i]){ 1150 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(counter)); 1151 if(defaulting) element->InputUpdateFromConstant(reCast<int>(default_value),vector_enum); 1152 else element->InputCreate(doublearray,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1153 counter++; 1154 } 1155 } 1156 break; /*}}}*/ 1157 case 7: //IssmDouble vector{{{ 1158 1159 /*Fetch vector:*/ 1085 for(i=0;i<elements->Size();i++){ 1086 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 1087 if(!doublearray) element->InputUpdateFromConstant(reCast<int>(default_value),vector_enum); 1088 else element->InputCreate(doublearray,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1089 element->InputUpdateFromConstant(boolean,vector_enum); 1090 } 1091 break; 1092 case 7: //IssmDouble vector 1160 1093 this->FetchData(&doublearray,&M,&N,vector_enum); 1161 /*Check we got something, otherwise fetch default: */ 1162 if(doublearray){ 1163 defaulting=false; //we are not defaulting, because we do have a vector 1164 } 1165 else{ 1166 /*do we have a default enum to go fetch? */ 1167 if(default_vector_enum!=NoneEnum){ 1168 /*yes. fetch it: */ 1169 this->FetchData(&doublearray,&M,&N,default_vector_enum); 1170 if(doublearray){ 1171 defaulting=false; //we are not defaulting, because we do have a vector 1172 } 1173 else{ 1174 /*even the default vector is non existent. we are defaulting to the default value: */ 1175 defaulting=true; 1176 } 1177 } 1178 else{ 1179 /*we are left with the default value: */ 1180 defaulting=true; 1181 } 1182 } 1183 1184 /*Create inputs:*/ 1185 counter=0; 1186 for (i=0;i<numberofelements;i++){ 1187 if(this->my_elements[i]){ 1188 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(counter)); 1189 if(defaulting) element->InputUpdateFromConstant(default_value,vector_enum); 1190 else element->InputCreate(doublearray,i,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1191 counter++; 1192 } 1193 } 1194 1195 break; /*}}}*/ 1196 default: /*{{{*/ 1094 for(i=0;i<elements->Size();i++){ 1095 Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i)); 1096 if(!doublearray) element->InputUpdateFromConstant(default_value,vector_enum); 1097 else element->InputCreate(doublearray,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements. 1098 element->InputUpdateFromConstant(boolean,vector_enum); 1099 } 1100 break; 1101 default: 1197 1102 _error_("data code " << code << " not supported yet!"); 1198 1103 break; 1199 /*}}}*/1200 1104 } 1201 1105 /*Free ressources. Pay attention to not freeing an AD mode independent variable though!:*/ 1202 if (!this->independents[vector_enum] && !this->independents[default_vector_enum]) xDelete<IssmDouble>(doublearray);1106 if (!this->independents[vector_enum]) xDelete<IssmDouble>(doublearray); 1203 1107 xDelete<char>(string); 1204 1108 } -
TabularUnified issm/trunk-jpl/src/c/classes/IoModel.h ¶
r15611 r16208 78 78 void FetchData(Option **poption,int data_enum); 79 79 void FetchData(int num,...); 80 void FetchDataToInput(Elements* elements,int vector_enum, int default_vector_enum=NoneEnum,IssmDouble default_value=0.);80 void FetchDataToInput(Elements* elements,int vector_enum,IssmDouble default_value=0.); 81 81 void LastIndex(int *pindex); 82 82 FILE* SetFilePointerToData(int* pcode,int* pvector_type, int data_enum);
Note:
See TracChangeset
for help on using the changeset viewer.