Changeset 12299
- Timestamp:
- 05/29/12 13:58:10 (13 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Tria.cpp
r12294 r12299 2255 2255 double sp; // elevation between altitude of the prec record and current altitude 2256 2256 2257 2258 2257 // PDD and PD constants and variables 2259 2258 double siglim; // sigma limit for the integration which is equal to 2.5 sigmanorm … … 2295 2294 GetInputListOnVertices(&prectmp[0],SurfaceforcingsPrecipitationEnum); 2296 2295 2297 for(i=0;i<NUMVERTICES;i++) ttmp[i]=ttmp[i]-273.15; // convertion from Kelvin to celcius 2296 /*Recover monthly temperatures*/ 2297 Input* input=inputs->GetInput(SurfaceforcingsMonthlytemperatures); _assert_(input); 2298 GaussTria* gauss=new GaussTria(); 2299 double time,yts; 2300 this->parameters->FindParam(&time,TimeEnum); 2301 this->parameters->FindParam(&yts,ConstantsYtsEnum); 2302 for(int month=0;month<12;month++){ 2303 for(int iv=0;iv<NUMVERTICES;iv++){ 2304 gauss->GaussVertex(iv); 2305 input->GetInputValue(&t[iv][month],gauss,time+month/12*yts); 2306 t[iv][month]=t[iv][month]-273.15; // conversion from Kelvin to celcius 2307 } 2308 } 2298 2309 2299 2310 for(i=0;i<NUMVERTICES;i++) -
issm/trunk/src/c/objects/Inputs/BoolInput.h
r11995 r12299 54 54 void GetInputValue(double* pvalue); 55 55 void GetInputValue(double* pvalue,GaussTria* gauss); 56 void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");}; 56 57 void GetInputValue(double* pvalue,GaussPenta* gauss); 57 58 void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; -
issm/trunk/src/c/objects/Inputs/ControlInput.h
r11995 r12299 59 59 void GetInputValue(double* pvalue); 60 60 void GetInputValue(double* pvalue,GaussTria* gauss); 61 void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");}; 61 62 void GetInputValue(double* pvalue,GaussPenta* gauss); 62 63 void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; -
issm/trunk/src/c/objects/Inputs/DatasetInput.h
r11995 r12299 54 54 void GetInputValue(double* pvalue){_error_("not implemented yet");}; 55 55 void GetInputValue(double* pvalue,GaussTria* gauss){_error_("not implemented yet");}; 56 void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");}; 56 57 void GetInputValue(double* pvalue,GaussPenta* gauss){_error_("not implemented yet");}; 57 58 void GetInputValue(double* pvalue,GaussTria* gauss ,int index); -
issm/trunk/src/c/objects/Inputs/DoubleInput.h
r11995 r12299 53 53 void GetInputValue(double* pvalue); 54 54 void GetInputValue(double* pvalue,GaussTria* gauss); 55 void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");}; 55 56 void GetInputValue(double* pvalue,GaussPenta* gauss); 56 57 void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; -
issm/trunk/src/c/objects/Inputs/Input.h
r11995 r12299 27 27 virtual void GetInputValue(double* pvalue)=0; 28 28 virtual void GetInputValue(double* pvalue,GaussTria* gauss)=0; 29 virtual void GetInputValue(double* pvalue,GaussTria* gauss,double time)=0; 29 30 virtual void GetInputValue(double* pvalue,GaussPenta* gauss)=0; 30 31 virtual void GetInputValue(double* pvalue,GaussTria* gauss ,int index)=0; -
issm/trunk/src/c/objects/Inputs/IntInput.h
r11995 r12299 54 54 void GetInputValue(double* pvalue); 55 55 void GetInputValue(double* pvalue,GaussTria* gauss); 56 void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");}; 56 57 void GetInputValue(double* pvalue,GaussPenta* gauss); 57 58 void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; -
issm/trunk/src/c/objects/Inputs/PentaP1Input.h
r11995 r12299 54 54 void GetInputValue(double* pvalue){_error_("not implemented yet");}; 55 55 void GetInputValue(double* pvalue,GaussTria* gauss){_error_("not implemented yet");}; 56 void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");}; 56 57 void GetInputValue(double* pvalue,GaussPenta* gauss); 57 58 void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; -
issm/trunk/src/c/objects/Inputs/TransientInput.cpp
r11995 r12299 2 2 * \brief: implementation of the TransientInput object 3 3 */ 4 /*Headers{{{ 1*/4 /*Headers{{{*/ 5 5 #ifdef HAVE_CONFIG_H 6 6 #include <config.h> … … 19 19 20 20 /*TransientInput constructors and destructor*/ 21 /*FUNCTION TransientInput::TransientInput(){{{ 1*/21 /*FUNCTION TransientInput::TransientInput(){{{*/ 22 22 TransientInput::TransientInput(){ 23 23 … … 30 30 } 31 31 /*}}}*/ 32 /*FUNCTION TransientInput::TransientInput(int in_enum_type){{{ 1*/32 /*FUNCTION TransientInput::TransientInput(int in_enum_type){{{*/ 33 33 TransientInput::TransientInput(int in_enum_type) 34 34 { … … 44 44 } 45 45 /*}}}*/ 46 /*FUNCTION TransientInput::~TransientInput{{{ 1*/46 /*FUNCTION TransientInput::~TransientInput{{{*/ 47 47 TransientInput::~TransientInput(){ 48 48 xfree((void**)&this->timesteps); … … 54 54 } 55 55 /*}}}*/ 56 /*FUNCTION void TransientInput::AddTimeInput(Input* input,double time){{{1*/57 void TransientInput::AddTimeInput(Input* input,double time){58 59 /*insert values at time step: */60 if (this->numtimesteps>0 && time<=this->timesteps[this->numtimesteps-1]) _assert_("timestep values must increase sequentially");61 62 //copy timesteps, add the new time, delete previous timesteps, and add the new input: inputs->AddObject(input);63 double* old_timesteps=NULL;64 65 if (this->numtimesteps > 0){66 old_timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double));67 memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof(double));68 xfree((void**)&this->timesteps);69 }70 71 this->numtimesteps=this->numtimesteps+1;72 this->timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double));73 74 if (this->numtimesteps > 1){75 memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof(double));76 xfree((void**)&old_timesteps);77 }78 79 /*go ahead and plug: */80 this->timesteps[this->numtimesteps-1]=time;81 inputs->AddObject(input);82 83 }84 /*}}}*/85 56 86 57 /*Object virtual functions definitions:*/ 87 /*FUNCTION TransientInput::Echo {{{ 1*/58 /*FUNCTION TransientInput::Echo {{{*/ 88 59 void TransientInput::Echo(void){ 89 60 this->DeepEcho(); 90 61 } 91 62 /*}}}*/ 92 /*FUNCTION TransientInput::DeepEcho{{{ 1*/63 /*FUNCTION TransientInput::DeepEcho{{{*/ 93 64 void TransientInput::DeepEcho(void){ 94 65 … … 105 76 } 106 77 /*}}}*/ 107 /*FUNCTION TransientInput::Id{{{ 1*/78 /*FUNCTION TransientInput::Id{{{*/ 108 79 int TransientInput::Id(void){ return -1; } 109 80 /*}}}*/ 110 /*FUNCTION TransientInput::MyRank{{{ 1*/81 /*FUNCTION TransientInput::MyRank{{{*/ 111 82 int TransientInput::MyRank(void){ 112 83 extern int my_rank; … … 115 86 /*}}}*/ 116 87 #ifdef _SERIAL_ 117 /*FUNCTION TransientInput::Marshall{{{ 1*/88 /*FUNCTION TransientInput::Marshall{{{*/ 118 89 void TransientInput::Marshall(char** pmarshalled_dataset){ 119 90 … … 149 120 } 150 121 /*}}}* 151 /*FUNCTION TransientInput::MarshallSize{{{ 1*/122 /*FUNCTION TransientInput::MarshallSize{{{*/ 152 123 int TransientInput::MarshallSize(){ 153 124 … … 160 131 } 161 132 /*}}}*/ 162 /*FUNCTION TransientInput::Demarshall{{{ 1*/133 /*FUNCTION TransientInput::Demarshall{{{*/ 163 134 void TransientInput::Demarshall(char** pmarshalled_dataset){ 164 135 … … 187 158 /*}}}*/ 188 159 #endif 189 /*FUNCTION TransientInput::ObjectEnum{{{ 1*/160 /*FUNCTION TransientInput::ObjectEnum{{{*/ 190 161 int TransientInput::ObjectEnum(void){ 191 162 … … 194 165 } 195 166 /*}}}*/ 196 /*FUNCTION TransientInput::copy{{{ 1*/167 /*FUNCTION TransientInput::copy{{{*/ 197 168 Object* TransientInput::copy() { 198 169 … … 213 184 214 185 /*TransientInput management*/ 215 /*FUNCTION TransientInput::InstanceEnum{{{ 1*/186 /*FUNCTION TransientInput::InstanceEnum{{{*/ 216 187 int TransientInput::InstanceEnum(void){ 217 188 … … 220 191 } 221 192 /*}}}*/ 222 /*FUNCTION TransientInput::SpawnTriaInput{{{ 1*/193 /*FUNCTION TransientInput::SpawnTriaInput{{{*/ 223 194 Input* TransientInput::SpawnTriaInput(int* indices){ 224 195 … … 240 211 } 241 212 /*}}}*/ 242 /*FUNCTION TransientInput::SpawnResult{{{ 1*/213 /*FUNCTION TransientInput::SpawnResult{{{*/ 243 214 ElementResult* TransientInput::SpawnResult(int step, double time){ 244 215 … … 258 229 259 230 /*Object functions*/ 260 /*FUNCTION TransientInput::GetInputValue(double* pvalue,GaussTria* gauss){{{ 1*/231 /*FUNCTION TransientInput::GetInputValue(double* pvalue,GaussTria* gauss){{{*/ 261 232 void TransientInput::GetInputValue(double* pvalue,GaussTria* gauss){ 262 263 233 double time; 264 234 … … 273 243 274 244 delete input; 275 276 } 277 /*}}}*/ 278 /*FUNCTION TransientInput::GetInputDerivativeValue(double* p, double* xyz_list, GaussTria* gauss){{{1*/ 245 } 246 /*}}}*/ 247 /*FUNCTION TransientInput::GetInputValue(double* pvalue,GaussTria* gauss,double time){{{*/ 248 void TransientInput::GetInputValue(double* pvalue,GaussTria* gauss,double time){ 249 250 /*Retrieve interpolated values for this time step: */ 251 Input* input=GetTimeInput(time); 252 253 /*Call input function*/ 254 input->GetInputValue(pvalue,gauss); 255 256 delete input; 257 } 258 /*}}}*/ 259 /*FUNCTION TransientInput::GetInputDerivativeValue(double* p, double* xyz_list, GaussTria* gauss){{{*/ 279 260 void TransientInput::GetInputDerivativeValue(double* p, double* xyz_list, GaussTria* gauss){ 280 261 … … 294 275 } 295 276 /*}}}*/ 296 /*FUNCTION TransientInput::ChangeEnum{{{ 1*/277 /*FUNCTION TransientInput::ChangeEnum{{{*/ 297 278 void TransientInput::ChangeEnum(int newenumtype){ 298 279 this->enum_type=newenumtype; 299 280 } 300 281 /*}}}*/ 301 /*FUNCTION TransientInput::GetInputAverage{{{ 1*/282 /*FUNCTION TransientInput::GetInputAverage{{{*/ 302 283 void TransientInput::GetInputAverage(double* pvalue){ 303 284 … … 319 300 320 301 /*Intermediary*/ 321 /*FUNCTION TransientInput::SquareMin{{{1*/ 302 /*FUNCTION TransientInput::AddTimeInput{{{*/ 303 void TransientInput::AddTimeInput(Input* input,double time){ 304 305 /*insert values at time step: */ 306 if (this->numtimesteps>0 && time<=this->timesteps[this->numtimesteps-1]) _assert_("timestep values must increase sequentially"); 307 308 //copy timesteps, add the new time, delete previous timesteps, and add the new input: inputs->AddObject(input); 309 double* old_timesteps=NULL; 310 311 if (this->numtimesteps > 0){ 312 old_timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double)); 313 memcpy(old_timesteps,this->timesteps,this->numtimesteps*sizeof(double)); 314 xfree((void**)&this->timesteps); 315 } 316 317 this->numtimesteps=this->numtimesteps+1; 318 this->timesteps=(double*)xmalloc(this->numtimesteps*sizeof(double)); 319 320 if (this->numtimesteps > 1){ 321 memcpy(this->timesteps,old_timesteps,(this->numtimesteps-1)*sizeof(double)); 322 xfree((void**)&old_timesteps); 323 } 324 325 /*go ahead and plug: */ 326 this->timesteps[this->numtimesteps-1]=time; 327 inputs->AddObject(input); 328 329 } 330 /*}}}*/ 331 /*FUNCTION TransientInput::SquareMin{{{*/ 322 332 void TransientInput::SquareMin(double* psquaremin, bool process_units,Parameters* parameters){ 323 333 … … 337 347 } 338 348 /*}}}*/ 339 /*FUNCTION TransientInput::InfinityNorm{{{ 1*/349 /*FUNCTION TransientInput::InfinityNorm{{{*/ 340 350 double TransientInput::InfinityNorm(void){ 341 351 … … 357 367 } 358 368 /*}}}*/ 359 /*FUNCTION TransientInput::Max{{{ 1*/369 /*FUNCTION TransientInput::Max{{{*/ 360 370 double TransientInput::Max(void){ 361 371 … … 377 387 } 378 388 /*}}}*/ 379 /*FUNCTION TransientInput::MaxAbs{{{ 1*/389 /*FUNCTION TransientInput::MaxAbs{{{*/ 380 390 double TransientInput::MaxAbs(void){ 381 391 … … 398 408 } 399 409 /*}}}*/ 400 /*FUNCTION TransientInput::Min{{{ 1*/410 /*FUNCTION TransientInput::Min{{{*/ 401 411 double TransientInput::Min(void){ 402 412 … … 419 429 } 420 430 /*}}}*/ 421 /*FUNCTION TransientInput::MinAbs{{{ 1*/431 /*FUNCTION TransientInput::MinAbs{{{*/ 422 432 double TransientInput::MinAbs(void){ 423 433 … … 439 449 } 440 450 /*}}}*/ 441 /*FUNCTION TransientInput::GetVectorFromInputs{{{ 1*/451 /*FUNCTION TransientInput::GetVectorFromInputs{{{*/ 442 452 void TransientInput::GetVectorFromInputs(Vector* vector,int* doflist){ 443 453 … … 456 466 457 467 } /*}}}*/ 458 /*FUNCTION TransientInput::GetTimeInput{{{ 1*/468 /*FUNCTION TransientInput::GetTimeInput{{{*/ 459 469 Input* TransientInput::GetTimeInput(double intime){ 460 470 … … 515 525 } 516 526 /*}}}*/ 517 /*FUNCTION TransientInput::Configure{{{ 1*/527 /*FUNCTION TransientInput::Configure{{{*/ 518 528 void TransientInput::Configure(Parameters* parameters){ 519 529 this->parameters=parameters; -
issm/trunk/src/c/objects/Inputs/TransientInput.h
r11995 r12299 56 56 void GetInputValue(double* pvalue){_error_("not implemented yet");}; 57 57 void GetInputValue(double* pvalue,GaussTria* gauss); 58 void GetInputValue(double* pvalue,GaussTria* gauss,double time); 58 59 void GetInputValue(double* pvalue,GaussPenta* gauss){_error_("not implemented yet");}; 59 60 void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");}; -
issm/trunk/src/c/objects/Inputs/TriaP1Input.h
r11995 r12299 54 54 void GetInputValue(double* pvalue){_error_("not implemented yet");} 55 55 void GetInputValue(double* pvalue,GaussTria* gauss); 56 void GetInputValue(double* pvalue,GaussTria* gauss,double time){_error_("not implemented yet");}; 56 57 void GetInputValue(double* pvalue,GaussPenta* gauss){_error_("not implemented yet");}; 57 58 void GetInputValue(double* pvalue,GaussTria* gauss ,int index){_error_("not implemented yet");};
Note:
See TracChangeset
for help on using the changeset viewer.