Changeset 596
- Timestamp:
- 05/26/09 13:20:52 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/ProcessParamsx/ProcessParamsx.cpp
r586 r596 24 24 double* vy=NULL; 25 25 double* vz=NULL; 26 double* pressure=NULL;27 26 28 27 double* u_g=NULL; … … 40 39 double* p_g=NULL; 41 40 41 /*thermal*/ 42 double* pressure=NULL; 43 double* temperature=NULL; 44 double* melting=NULL; 45 46 double* p_g=NULL; 47 double* t_g=NULL; 48 double* m_g=NULL; 49 42 50 /*prognostic: */ 43 51 double* a_g=NULL; 44 double* m_g=NULL;45 52 double* h_g=NULL; 46 53 double* accumulation=NULL; … … 61 68 /*First serialize partition vector: */ 62 69 if(part)VecToMPISerial(&partition,part); 63 64 70 65 71 if ( (analysis_type==ControlAnalysisEnum()) || … … 156 162 if(analysis_type==ThermalAnalysisEnum()){ 157 163 164 parameters->FindParam((void*)&temperature,"temperature"); 165 parameters->FindParam((void*)&melting,"melting"); 158 166 parameters->FindParam((void*)&pressure,"pressure"); 159 160 /*Now, from pressure, build p_g, correctly partitioned: */ 167 168 /*Now, from temperature and melting, build t_g and m_g, correctly partitioned: */ 169 t_g=(double*)xcalloc(numberofnodes,sizeof(double)); 170 m_g=(double*)xcalloc(numberofnodes,sizeof(double)); 161 171 p_g=(double*)xcalloc(numberofnodes,sizeof(double)); 162 172 163 for(i=0;i<numberofnodes;i++){ 173 for(i=0;i<numberofnodes;i++){ 174 t_g[(int)(partition[i])]=temperature[i]; 175 m_g[(int)(partition[i])]=melting[i]; 164 176 p_g[(int)(partition[i])]= pressure[i]; 165 } 166 167 /*Now, create new parameter: */ 177 } 178 179 /*Now, create new parameter: */ 180 count++; 181 param= new Param(count,"t_g",DOUBLEVEC); 182 param->SetDoubleVec(t_g,numberofnodes); 183 parameters->AddObject(param); 184 185 count++; 186 param= new Param(count,"m_g",DOUBLEVEC); 187 param->SetDoubleVec(m_g,numberofnodes); 188 parameters->AddObject(param); 189 168 190 count++; 169 191 param= new Param(count,"p_g",DOUBLEVEC); … … 171 193 parameters->AddObject(param); 172 194 173 /*erase old parameter: */ 195 /*erase old parameter: */ 196 param=(Param*)parameters->FindParamObject("temperature"); 197 parameters->DeleteObject((Object*)param); 198 199 param=(Param*)parameters->FindParamObject("melting"); 200 parameters->DeleteObject((Object*)param); 201 174 202 param=(Param*)parameters->FindParamObject("pressure"); 175 203 parameters->DeleteObject((Object*)param); … … 179 207 180 208 parameters->FindParam((void*)&melting,"melting"); 181 182 /*Now, from melting, build m_g, correctly partitioned: */ 209 parameters->FindParam((void*)&thickness,"thickness"); 210 parameters->FindParam((void*)&accumulation,"accumulation"); 211 212 /*Now, from melting accumulation and thickness, build m_g, h_g, correctly partitioned: */ 183 213 m_g=(double*)xcalloc(numberofnodes,sizeof(double)); 214 h_g=(double*)xcalloc(numberofnodes,sizeof(double)); 215 a_g=(double*)xcalloc(numberofnodes,sizeof(double)); 184 216 185 217 for(i=0;i<numberofnodes;i++){ 186 218 m_g[(int)(partition[i])]= melting[i]; 219 h_g[(int)(partition[i])]= thickness[i]; 220 a_g[(int)(partition[i])]= accumulation[i]; 187 221 } 188 222 … … 193 227 parameters->AddObject(param); 194 228 229 count++; 230 param= new Param(count,"h_g",DOUBLEVEC); 231 param->SetDoubleVec(h_g,numberofnodes); 232 parameters->AddObject(param); 233 234 count++; 235 param= new Param(count,"a_g",DOUBLEVEC); 236 param->SetDoubleVec(a_g,numberofnodes); 237 parameters->AddObject(param); 238 195 239 /*erase old parameter: */ 196 240 param=(Param*)parameters->FindParamObject("melting"); 197 241 parameters->DeleteObject((Object*)param); 198 199 200 201 parameters->FindParam((void*)&thickness,"thickness"); 202 203 /*Now, from thickness, build h_g, correctly partitioned: */ 204 h_g=(double*)xcalloc(numberofnodes,sizeof(double)); 205 206 for(i=0;i<numberofnodes;i++){ 207 h_g[(int)(partition[i])]= thickness[i]; 208 } 209 210 /*Now, create new parameter: */ 211 count++; 212 param= new Param(count,"h_g",DOUBLEVEC); 213 param->SetDoubleVec(h_g,numberofnodes); 214 parameters->AddObject(param); 215 216 /*erase old parameter: */ 242 217 243 param=(Param*)parameters->FindParamObject("thickness"); 218 244 parameters->DeleteObject((Object*)param); 219 245 220 221 222 223 parameters->FindParam((void*)&accumulation,"accumulation");224 225 /*Now, from accumulation, build a_g, correctly partitioned: */226 a_g=(double*)xcalloc(numberofnodes,sizeof(double));227 228 for(i=0;i<numberofnodes;i++){229 a_g[(int)(partition[i])]= accumulation[i];230 }231 232 /*Now, create new parameter: */233 count++;234 param= new Param(count,"a_g",DOUBLEVEC);235 param->SetDoubleVec(a_g,numberofnodes);236 parameters->AddObject(param);237 238 /*erase old parameter: */239 246 param=(Param*)parameters->FindParamObject("accumulation"); 240 247 parameters->DeleteObject((Object*)param); 241 242 243 244 248 } 245 249 xfree((void**)&partition);
Note:
See TracChangeset
for help on using the changeset viewer.