Changeset 17269
- Timestamp:
- 02/12/14 15:47:44 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/Loads
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h
r17266 r17269 10 10 class Hook; 11 11 class Parameters; 12 class Inputs;13 12 class IoModel; 14 13 class Element; -
issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp
r16539 r17269 22 22 /*FUNCTION Riftfront::Riftfront(){{{*/ 23 23 Riftfront::Riftfront(){ 24 this->inputs=NULL;25 24 this->parameters=NULL; 26 25 this->hnodes=NULL; … … 90 89 this->state=reCast<int,IssmDouble>(*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+11)); 91 90 92 //intialize inputs, and add as many inputs per element as requested: 93 this->inputs=new Inputs(); 94 95 riftfront_type=SegmentRiftfrontEnum; 96 riftfront_fill = reCast<int,IssmDouble>(*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+7)); 97 riftfront_friction=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+8); 98 riftfront_fractionincrement=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+10); 99 riftfront_shelf=reCast<bool,IssmDouble>(iomodel->Data(MaskGroundediceLevelsetEnum)[node1-1]<0.); 100 101 this->inputs->AddInput(new IntInput(RiftfrontTypeEnum,riftfront_type)); 102 this->inputs->AddInput(new IntInput(FillEnum,riftfront_fill)); 103 this->inputs->AddInput(new DoubleInput(FrictionEnum,riftfront_friction)); 104 this->inputs->AddInput(new DoubleInput(FractionIncrementEnum,riftfront_fractionincrement)); 105 this->inputs->AddInput(new BoolInput(SegmentOnIceShelfEnum,riftfront_shelf)); 91 //intialize properties 92 this->type=SegmentRiftfrontEnum; 93 this->fill = reCast<int,IssmDouble>(*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+7)); 94 this->friction=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+8); 95 this->fractionincrement=*(iomodel->Data(RiftsRiftstructEnum)+RIFTINFOSIZE*i+10); 96 this->shelf=reCast<bool,IssmDouble>(iomodel->Data(MaskGroundediceLevelsetEnum)[node1-1]<0.); 106 97 107 98 //parameters and hooked fields: we still can't point to them, they may not even exist. Configure will handle this. … … 115 106 /*FUNCTION Riftfront::~Riftfront(){{{*/ 116 107 Riftfront::~Riftfront(){ 117 delete inputs;118 108 this->parameters=NULL; 119 120 109 delete hnodes; 121 110 delete helements; … … 127 116 /*FUNCTION Riftfront::Echo {{{*/ 128 117 void Riftfront::Echo(void){ 129 130 Input* input=NULL;131 int fill;132 IssmDouble friction,fractionincrement;133 134 /*recover some inputs first: */135 input=(Input*)this->inputs->GetInput(FillEnum); input->GetInputValue(&fill);136 input=(Input*)this->inputs->GetInput(FrictionEnum); input->GetInputValue(&friction);137 input=(Input*)this->inputs->GetInput(FractionIncrementEnum); input->GetInputValue(&fractionincrement);138 118 139 119 _printf_("Riftfront:\n"); … … 144 124 _printf_(" hmatpar: " << hmatpar << "\n"); 145 125 _printf_(" parameters: " << parameters << "\n"); 146 _printf_(" inputs: " << inputs << "\n");147 126 _printf_(" internal parameters: \n"); 148 127 _printf_(" normal: " << normal[0] << "|" << normal[1] << "\n"); … … 173 152 _printf_(" parameters\n"); 174 153 if(parameters)parameters->DeepEcho(); 175 _printf_(" inputs\n");176 if(inputs)inputs->DeepEcho();177 154 } 178 155 /*}}}*/ … … 197 174 riftfront->id=this->id; 198 175 riftfront->analysis_type=this->analysis_type; 199 if(this->inputs){200 riftfront->inputs=(Inputs*)this->inputs->Copy();201 }202 else{203 riftfront->inputs=new Inputs();204 } 176 riftfront->type=this->type; 177 riftfront->fill=this->fill; 178 riftfront->friction=this->friction; 179 riftfront->fractionincrement=this->fractionincrement; 180 riftfront->shelf=this->shelf; 181 205 182 /*point parameters: */ 206 183 riftfront->parameters=this->parameters; … … 237 214 /*FUNCTION Riftfront::InputUpdateFromConstant(bool constant,int name) {{{*/ 238 215 void Riftfront::InputUpdateFromConstant(bool constant,int name){ 239 240 /*Check that name is a Riftfront input*/241 if (!IsInput(name)) return;242 243 /*update input*/244 this->inputs->AddInput(new BoolInput(name,constant));245 246 216 } 247 217 /*}}}*/ … … 249 219 void Riftfront::InputUpdateFromConstant(IssmDouble constant,int name){ 250 220 251 /*Check that name is a Riftfront input*/252 if (!IsInput(name)) return;253 254 /*update input*/255 this->inputs->AddInput(new DoubleInput(name,constant));256 257 221 } 258 222 /*}}}*/ … … 260 224 void Riftfront::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 261 225 262 /*Check that name is a Riftfront input*/263 if (!IsInput(name)) return;264 265 /*update input*/266 226 _error_("not implemented yet"); 267 //this->inputs->AddInput(new DoubleInput(name,constant));268 227 269 228 } … … 458 417 IssmDouble h[2]; 459 418 IssmDouble penalty_offset; 460 IssmDouble friction;461 419 462 420 /*Objects: */ … … 475 433 /*Get some parameters: */ 476 434 this->parameters->FindParam(&penalty_offset,StressbalancePenaltyFactorEnum); 477 this->inputs->GetInputValue(&friction,FrictionEnum);478 435 tria1->GetInputValue(&h[0],nodes[0],ThicknessEnum); 479 436 tria2->GetInputValue(&h[1],nodes[1],ThicknessEnum); … … 547 504 IssmDouble pressure_melange; 548 505 IssmDouble pressure_water; 549 int fill;550 bool shelf;551 506 552 507 /*Objects: */ … … 564 519 565 520 /*Get some inputs: */ 566 this->inputs->GetInputValue(&fill,FillEnum);567 this->inputs->GetInputValue(&shelf,SegmentOnIceShelfEnum);568 521 rho_ice=matpar->GetRhoIce(); 569 522 rho_water=matpar->GetRhoWater(); … … 642 595 IssmDouble vx2; 643 596 IssmDouble vy2; 644 IssmDouble fractionincrement;645 597 646 598 /*Objects: */ … … 671 623 return 1; 672 624 } 673 674 /*recover parameters: */675 this->inputs->GetInputValue(&fractionincrement,FractionIncrementEnum);676 625 677 626 /*First recover velocity: */ … … 734 683 } 735 684 /*}}}*/ 736 /*FUNCTION Riftfront::IsInput{{{*/737 bool Riftfront::IsInput(int name){738 if (739 name==ConvergedEnum ||740 name==ThicknessEnum ||741 name==SurfaceEnum ||742 name==BedEnum743 ){744 return true;745 }746 else return false;747 }748 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Loads/Riftfront.h
r16783 r17269 11 11 class Hook; 12 12 class Parameters; 13 class Inputs;14 13 class IoModel; 15 14 /*}}}*/ … … 20 19 int id; 21 20 int analysis_type; 21 22 /*properties*/ 23 int type; 24 int fill; 25 IssmDouble friction; 26 IssmDouble fractionincrement; 27 bool shelf; 22 28 23 29 /*hooks: */ … … 44 50 45 51 Parameters *parameters; //pointer to solution parameters 46 Inputs *inputs;47 52 48 53 /*Riftfrontconstructors,destructors: {{{*/ … … 89 94 void FreezeConstraints(void); 90 95 bool IsFrozen(void); 91 bool IsInput(int name);92 96 /*}}}*/ 93 97 };
Note:
See TracChangeset
for help on using the changeset viewer.