Changeset 8263 for issm/trunk
- Timestamp:
- 05/11/11 11:56:19 (14 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/Container/Parameters.cpp
r6213 r8263 43 43 44 44 /*Object management*/ 45 /*FUNCTION Parameters::Exist{{{1*/ 46 bool Parameters::Exist(int enum_type){ 47 48 vector<Object*>::iterator object; 49 Param* param=NULL; 50 51 for ( object=objects.begin() ; object < objects.end(); object++ ){ 52 param=(Param*)(*object); 53 if(param->EnumType()==enum_type) return true; 54 } 55 return false; 56 } 57 /*}}}*/ 45 58 /*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{1*/ 46 int Parameters::FindParam(bool* pbool,int enum_type){ 47 48 /*Go through a dataset, and find a Param* object 49 *which parameter name is "name" : */ 50 51 vector<Object*>::iterator object; 52 Param* param=NULL; 53 54 int found=0; 55 56 for ( object=objects.begin() ; object < objects.end(); object++ ){ 57 58 /*Ok, this object is a parameter, recover it and ask which name it has: */ 59 param=(Param*)(*object); 60 61 if(param->EnumType()==enum_type){ 62 /*Ok, this is the one! Recover the value of this parameter: */ 59 void Parameters::FindParam(bool* pbool,int enum_type){ 60 61 vector<Object*>::iterator object; 62 Param* param=NULL; 63 64 for ( object=objects.begin() ; object < objects.end(); object++ ){ 65 66 param=(Param*)(*object); 67 if(param->EnumType()==enum_type){ 63 68 param->GetParameterValue(pbool); 64 found=1; 65 break; 66 } 67 } 68 return found; 69 return; 70 } 71 } 72 _error_("could not find parameter %s",EnumToStringx(enum_type)); 69 73 } 70 74 /*}}}*/ 71 75 /*FUNCTION Parameters::FindParam(int* pinteger,int enum_type){{{1*/ 72 int Parameters::FindParam(int* pinteger,int enum_type){ 73 74 /*Go through a dataset, and find a Param* object 75 *which parameter name is "name" : */ 76 77 vector<Object*>::iterator object; 78 Param* param=NULL; 79 80 int found=0; 81 82 for ( object=objects.begin() ; object < objects.end(); object++ ){ 83 84 /*Ok, this object is a parameter, recover it and ask which name it has: */ 85 param=(Param*)(*object); 86 87 if(param->EnumType()==enum_type){ 88 /*Ok, this is the one! Recover the value of this parameter: */ 76 void Parameters::FindParam(int* pinteger,int enum_type){ 77 78 vector<Object*>::iterator object; 79 Param* param=NULL; 80 81 for ( object=objects.begin() ; object < objects.end(); object++ ){ 82 83 param=(Param*)(*object); 84 if(param->EnumType()==enum_type){ 89 85 param->GetParameterValue(pinteger); 90 found=1; 91 break; 92 } 93 } 94 return found; 86 return; 87 } 88 } 89 _error_("could not find parameter %s",EnumToStringx(enum_type)); 95 90 } 96 91 /*}}}*/ 97 92 /*FUNCTION Parameters::FindParam(double* pscalar, int enum_type){{{1*/ 98 int Parameters::FindParam(double* pscalar, int enum_type){ 99 100 /*Go through a dataset, and find a Param* object 101 *which parameter name is "name" : */ 102 103 vector<Object*>::iterator object; 104 Param* param=NULL; 105 106 int found=0; 107 108 for ( object=objects.begin() ; object < objects.end(); object++ ){ 109 110 /*Ok, this object is a parameter, recover it and ask which name it has: */ 111 param=(Param*)(*object); 112 113 if(param->EnumType()==enum_type){ 114 /*Ok, this is the one! Recover the value of this parameter: */ 93 void Parameters::FindParam(double* pscalar, int enum_type){ 94 95 vector<Object*>::iterator object; 96 Param* param=NULL; 97 98 for ( object=objects.begin() ; object < objects.end(); object++ ){ 99 100 param=(Param*)(*object); 101 if(param->EnumType()==enum_type){ 115 102 param->GetParameterValue(pscalar); 116 found=1; 117 break; 118 } 119 } 120 return found; 103 return; 104 } 105 } 106 _error_("could not find parameter %s",EnumToStringx(enum_type)); 121 107 } 122 108 /*}}}*/ 123 109 /*FUNCTION Parameters::FindParam(char** pstring,int enum_type){{{1*/ 124 int Parameters::FindParam(char** pstring,int enum_type){ 125 126 /*Go through a dataset, and find a Param* object 127 *which parameter name is "name" : */ 128 129 vector<Object*>::iterator object; 130 Param* param=NULL; 131 132 int found=0; 133 134 for ( object=objects.begin() ; object < objects.end(); object++ ){ 135 136 /*Ok, this object is a parameter, recover it and ask which name it has: */ 137 param=(Param*)(*object); 138 139 if(param->EnumType()==enum_type){ 140 /*Ok, this is the one! Recover the value of this parameter: */ 110 void Parameters::FindParam(char** pstring,int enum_type){ 111 112 vector<Object*>::iterator object; 113 Param* param=NULL; 114 115 for ( object=objects.begin() ; object < objects.end(); object++ ){ 116 117 param=(Param*)(*object); 118 if(param->EnumType()==enum_type){ 141 119 param->GetParameterValue(pstring); 142 found=1; 143 break; 144 } 145 } 146 return found; 120 return; 121 } 122 } 123 _error_("could not find parameter %s",EnumToStringx(enum_type)); 147 124 148 125 } 149 126 /*}}}*/ 150 127 /*FUNCTION Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){{{1*/ 151 int Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){ 152 153 /*Go through a dataset, and find a Param* object 154 *which parameter name is "name" : */ 155 156 vector<Object*>::iterator object; 157 Param* param=NULL; 158 159 int found=0; 160 161 for ( object=objects.begin() ; object < objects.end(); object++ ){ 162 163 /*Ok, this object is a parameter, recover it and ask which name it has: */ 164 param=(Param*)(*object); 165 166 if(param->EnumType()==enum_type){ 167 /*Ok, this is the one! Recover the value of this parameter: */ 128 void Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){ 129 130 vector<Object*>::iterator object; 131 Param* param=NULL; 132 133 for ( object=objects.begin() ; object < objects.end(); object++ ){ 134 135 param=(Param*)(*object); 136 if(param->EnumType()==enum_type){ 168 137 param->GetParameterValue(pstringarray,pM); 169 found=1; 170 break; 171 } 172 } 173 return found; 138 return; 139 } 140 } 141 _error_("could not find parameter %s",EnumToStringx(enum_type)); 174 142 175 143 } 176 144 /*}}}*/ 177 145 /*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int enum_type){{{1*/ 178 int Parameters::FindParam(int** pintarray,int* pM, int enum_type){ 179 180 /*Go through a dataset, and find a Param* object 181 *which parameter name is "name" : */ 182 183 vector<Object*>::iterator object; 184 Param* param=NULL; 185 186 int found=0; 187 188 for ( object=objects.begin() ; object < objects.end(); object++ ){ 189 190 /*Ok, this object is a parameter, recover it and ask which name it has: */ 191 param=(Param*)(*object); 192 193 if(param->EnumType()==enum_type){ 194 /*Ok, this is the one! Recover the value of this parameter: */ 146 void Parameters::FindParam(int** pintarray,int* pM, int enum_type){ 147 148 vector<Object*>::iterator object; 149 Param* param=NULL; 150 151 for ( object=objects.begin() ; object < objects.end(); object++ ){ 152 153 param=(Param*)(*object); 154 if(param->EnumType()==enum_type){ 195 155 param->GetParameterValue(pintarray,pM); 196 found=1; 197 break; 198 } 199 } 200 return found; 156 return; 157 } 158 } 159 _error_("could not find parameter %s",EnumToStringx(enum_type)); 201 160 202 161 } 203 162 /*}}}*/ 204 163 /*FUNCTION Parameters::FindParam(double** pdoublearray,int* pM,int enum_type){{{1*/ 205 int Parameters::FindParam(double** pdoublearray,int* pM, int enum_type){ 206 207 /*Go through a dataset, and find a Param* object 208 *which parameter name is "name" : */ 209 210 vector<Object*>::iterator object; 211 Param* param=NULL; 212 213 int found=0; 214 215 for ( object=objects.begin() ; object < objects.end(); object++ ){ 216 217 /*Ok, this object is a parameter, recover it and ask which name it has: */ 218 param=(Param*)(*object); 219 220 if(param->EnumType()==enum_type){ 221 /*Ok, this is the one! Recover the value of this parameter: */ 164 void Parameters::FindParam(double** pdoublearray,int* pM, int enum_type){ 165 166 vector<Object*>::iterator object; 167 Param* param=NULL; 168 169 for ( object=objects.begin() ; object < objects.end(); object++ ){ 170 171 param=(Param*)(*object); 172 if(param->EnumType()==enum_type){ 222 173 param->GetParameterValue(pdoublearray,pM); 223 found=1; 224 break; 225 } 226 } 227 return found; 174 return; 175 } 176 } 177 _error_("could not find parameter %s",EnumToStringx(enum_type)); 228 178 229 179 } 230 180 /*}}}*/ 231 181 /*FUNCTION Parameters::FindParam(double** pdoublearray,int* pM, int* pN,int enum_type){{{1*/ 232 int Parameters::FindParam(double** pdoublearray,int* pM, int* pN,int enum_type){ 233 234 /*Go through a dataset, and find a Param* object 235 *which parameter name is "name" : */ 236 237 vector<Object*>::iterator object; 238 Param* param=NULL; 239 240 int found=0; 241 242 for ( object=objects.begin() ; object < objects.end(); object++ ){ 243 244 /*Ok, this object is a parameter, recover it and ask which name it has: */ 245 param=(Param*)(*object); 246 247 if(param->EnumType()==enum_type){ 248 /*Ok, this is the one! Recover the value of this parameter: */ 182 void Parameters::FindParam(double** pdoublearray,int* pM, int* pN,int enum_type){ 183 184 vector<Object*>::iterator object; 185 Param* param=NULL; 186 187 for ( object=objects.begin() ; object < objects.end(); object++ ){ 188 189 param=(Param*)(*object); 190 if(param->EnumType()==enum_type){ 249 191 param->GetParameterValue(pdoublearray,pM,pN); 250 found=1; 251 break; 252 } 253 } 254 return found; 192 return; 193 } 194 } 195 _error_("could not find parameter %s",EnumToStringx(enum_type)); 255 196 256 197 } 257 198 /*}}}*/ 258 199 /*FUNCTION Parameters::FindParam(double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{1*/ 259 int Parameters::FindParam(double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ 260 261 /*Go through a dataset, and find a Param* object 262 *which parameter name is "name" : */ 263 264 vector<Object*>::iterator object; 265 Param* param=NULL; 266 267 int found=0; 268 269 for ( object=objects.begin() ; object < objects.end(); object++ ){ 270 271 /*Ok, this object is a parameter, recover it and ask which name it has: */ 272 param=(Param*)(*object); 273 274 if(param->EnumType()==enum_type){ 275 /*Ok, this is the one! Recover the value of this parameter: */ 200 void Parameters::FindParam(double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){ 201 202 vector<Object*>::iterator object; 203 Param* param=NULL; 204 205 for ( object=objects.begin() ; object < objects.end(); object++ ){ 206 207 param=(Param*)(*object); 208 if(param->EnumType()==enum_type){ 276 209 param->GetParameterValue(parray,pM,pmdims_array,pndims_array); 277 found=1; 278 break; 279 } 280 } 281 return found; 210 return; 211 } 212 } 213 _error_("could not find parameter %s",EnumToStringx(enum_type)); 282 214 } 283 215 /*}}}*/ 284 216 /*FUNCTION Parameters::FindParam(Vec* pvec,int enum_type){{{1*/ 285 int Parameters::FindParam(Vec* pvec,int enum_type){ 286 287 /*Go through a dataset, and find a Param* object 288 *which parameter name is "name" : */ 289 290 vector<Object*>::iterator object; 291 Param* param=NULL; 292 293 int found=0; 294 295 for ( object=objects.begin() ; object < objects.end(); object++ ){ 296 297 /*Ok, this object is a parameter, recover it and ask which name it has: */ 298 param=(Param*)(*object); 299 300 if(param->EnumType()==enum_type){ 301 /*Ok, this is the one! Recover the value of this parameter: */ 217 void Parameters::FindParam(Vec* pvec,int enum_type){ 218 219 vector<Object*>::iterator object; 220 Param* param=NULL; 221 222 for ( object=objects.begin() ; object < objects.end(); object++ ){ 223 224 param=(Param*)(*object); 225 if(param->EnumType()==enum_type){ 302 226 param->GetParameterValue(pvec); 303 found=1; 304 break; 305 } 306 } 307 return found; 227 return; 228 } 229 } 230 _error_("could not find parameter %s",EnumToStringx(enum_type)); 308 231 309 232 } 310 233 /*}}}*/ 311 234 /*FUNCTION Parameters::FindParam(Mat* pmat,int enum_type){{{1*/ 312 int Parameters::FindParam(Mat* pmat,int enum_type){ 313 314 /*Go through a dataset, and find a Param* object 315 *which parameter name is "name" : */ 316 317 vector<Object*>::iterator object; 318 Param* param=NULL; 319 320 int found=0; 321 322 for ( object=objects.begin() ; object < objects.end(); object++ ){ 323 324 /*Ok, this object is a parameter, recover it and ask which name it has: */ 325 param=(Param*)(*object); 326 327 if(param->EnumType()==enum_type){ 328 /*Ok, this is the one! Recover the value of this parameter: */ 235 void Parameters::FindParam(Mat* pmat,int enum_type){ 236 237 vector<Object*>::iterator object; 238 Param* param=NULL; 239 240 for ( object=objects.begin() ; object < objects.end(); object++ ){ 241 242 param=(Param*)(*object); 243 if(param->EnumType()==enum_type){ 329 244 param->GetParameterValue(pmat); 330 found=1; 331 break; 332 } 333 } 334 return found; 245 return; 246 } 247 } 248 _error_("could not find parameter %s",EnumToStringx(enum_type)); 335 249 336 250 } 337 251 /*}}}*/ 338 252 /*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{1*/ 339 int Parameters::FindParam(FILE** pfid,int enum_type){ 340 341 /*Go through a dataset, and find a Param* object 342 *which parameter name is "name" : */ 343 344 vector<Object*>::iterator object; 345 Param* param=NULL; 346 347 int found=0; 348 349 for ( object=objects.begin() ; object < objects.end(); object++ ){ 350 351 /*Ok, this object is a parameter, recover it and ask which name it has: */ 352 param=(Param*)(*object); 353 354 if(param->EnumType()==enum_type){ 355 /*Ok, this is the one! Recover the value of this parameter: */ 253 void Parameters::FindParam(FILE** pfid,int enum_type){ 254 255 vector<Object*>::iterator object; 256 Param* param=NULL; 257 258 for ( object=objects.begin() ; object < objects.end(); object++ ){ 259 260 param=(Param*)(*object); 261 if(param->EnumType()==enum_type){ 356 262 param->GetParameterValue(pfid); 357 found=1; 358 break; 359 } 360 } 361 return found; 263 return; 264 } 265 } 266 _error_("could not find parameter %s",EnumToStringx(enum_type)); 362 267 } 363 268 /*}}}*/ … … 487 392 Object* Parameters::FindParamObject(int enum_type){ 488 393 489 /*Go through a dataset, and find a Param* object 490 *which parameter name is "name" : */ 491 492 vector<Object*>::iterator object; 493 Param* param=NULL; 494 495 for ( object=objects.begin() ; object < objects.end(); object++ ){ 496 497 /*Ok, this object is a parameter, recover it and ask which name it has: */ 498 param=(Param*)(*object); 499 500 if(param->EnumType()==enum_type){ 501 /*Ok, this is the one! Return the object: */ 394 vector<Object*>::iterator object; 395 Param* param=NULL; 396 397 for ( object=objects.begin() ; object < objects.end(); object++ ){ 398 399 param=(Param*)(*object); 400 if(param->EnumType()==enum_type){ 502 401 return (*object); 503 402 } -
issm/trunk/src/c/Container/Parameters.h
r6213 r8263 26 26 /*}}}*/ 27 27 /*numerics: {{{1*/ 28 int FindParam(bool* pinteger,int enum_type); 29 int FindParam(int* pinteger,int enum_type); 30 int FindParam(double* pscalar, int enum_type); 31 int FindParam(char** pstring,int enum_type); 32 int FindParam(char*** pstringarray,int* pM,int enum_type); 33 int FindParam(int** pintarray,int* pM,int enum_type); 34 int FindParam(double** pdoublearray,int* pM,int enum_type); 35 int FindParam(double** pdoublearray,int* pM,int* pN,int enum_type); 36 int FindParam(double*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type); 37 int FindParam(Vec* pvec,int enum_type); 38 int FindParam(Mat* pmat,int enum_type); 39 int FindParam(FILE** pfid,int enum_type); 28 bool Exist(int enum_type); 29 30 void FindParam(bool* pinteger,int enum_type); 31 void FindParam(int* pinteger,int enum_type); 32 void FindParam(double* pscalar, int enum_type); 33 void FindParam(char** pstring,int enum_type); 34 void FindParam(char*** pstringarray,int* pM,int enum_type); 35 void FindParam(int** pintarray,int* pM,int enum_type); 36 void FindParam(double** pdoublearray,int* pM,int enum_type); 37 void FindParam(double** pdoublearray,int* pM,int* pN,int enum_type); 38 void FindParam(double*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type); 39 void FindParam(Vec* pvec,int enum_type); 40 void FindParam(Mat* pmat,int enum_type); 41 void FindParam(FILE** pfid,int enum_type); 40 42 41 43 void SetParam(bool boolean,int enum_type); … … 55 57 }; 56 58 57 58 59 59 #endif //ifndef _PARAMETERS_H_ 60 -
issm/trunk/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp
r6412 r8263 35 35 36 36 /*First, recover qmu partition of vertices: */ 37 if(!parameters->FindParam(&qmu_part,&dummy,QmuPartEnum))_error_(" could not find qmu partition vector");37 parameters->FindParam(&qmu_part,&dummy,QmuPartEnum); 38 38 39 39 /*Some parameters: */ -
issm/trunk/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp
r6412 r8263 22 22 23 23 /*Recover numberofelements: */ 24 found= parameters->FindParam(&numberofelements,NumberOfElementsEnum); 25 if (!found) _error_("numberofelements not provided in parameters"); 24 parameters->FindParam(&numberofelements,NumberOfElementsEnum); 26 25 27 26 /*Allocate sigma on numberofelements: */ -
issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
r8224 r8263 50 50 51 51 /*Now, pick up the parameter corresponding to root: */ 52 if(!parameters->FindParam(¶meter,NULL,StringToEnumx(root))){ 53 _error_("%s%s"," could not find Qmu parameter: ",root); 54 } 52 parameters->FindParam(¶meter,NULL,StringToEnumx(root)); 55 53 56 54 /*We've got the parameter, we need to update it using qmu_part (a partitioning vector), and the distributed_values: */ -
issm/trunk/src/c/modules/MassFluxx/MassFluxx.cpp
r6684 r8263 36 36 37 37 /*First, figure out which segment to compute our mass flux on. Start with retrieving qmu_mass_flux_segments: */ 38 if(!parameters->FindParam(&array,&M,&mdims_array,&ndims_array,QmuMassFluxSegmentsEnum))_error_(" could not find QmuMassFluxSegmentsEnum");38 parameters->FindParam(&array,&M,&mdims_array,&ndims_array,QmuMassFluxSegmentsEnum); 39 39 40 40 /*Retrieve index of segments being used for MassFlux computation: */ 41 if(!parameters->FindParam(&counter,IndexEnum))_error_(" could not find IndexEnum");41 parameters->FindParam(&counter,IndexEnum); 42 42 43 43 /*retrieve segments from array: */ -
issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
r8224 r8263 50 50 51 51 /*Now, open file for writing, if not already done: */ 52 if(!parameters-> FindParam(&fid,OutputFilePointerEnum)){52 if(!parameters->Exist(OutputFilePointerEnum)){ 53 53 54 54 /*We don't have a file pointer. Retrieve the output file name and open it for writing:*/ … … 64 64 else{ 65 65 /*We are opening different files for output on all cpus. Append the rank to the filename, and open: */ 66 parameters->FindParam(&fid,OutputFilePointerEnum); 66 67 sprintf(cpu_outputfilename,"%s.%i",outputfilename,my_rank); 67 68 fid=pfopen(cpu_outputfilename ,"wb"); … … 72 73 parameters->SetParam(fid,OutputFilePointerEnum); 73 74 } 74 75 75 #endif 76 76 -
issm/trunk/src/c/objects/FemModel.cpp
r8224 r8263 168 168 this->loads->SetCurrentConfiguration(elements, loads, nodes,vertices, materials,parameters); 169 169 170 /*take care of petsc options, that depend on this analysis type: */ 171 PetscOptionsFromAnalysis(this->parameters,analysis_type); 172 _printf_(VerboseSolver()," petsc Options set for analysis type: %s\n",EnumToStringx(analysis_type)); 170 /*take care of petsc options, that depend on this analysis type (present only after model processor)*/ 171 if(this->parameters->Exist(PetscOptionsStringsEnum)){ 172 PetscOptionsFromAnalysis(this->parameters,analysis_type); 173 _printf_(VerboseSolver()," petsc Options set for analysis type: %s\n",EnumToStringx(analysis_type)); 174 } 173 175 174 176 }
Note:
See TracChangeset
for help on using the changeset viewer.